unbridled-41 opened a new issue, #5479:
URL: https://github.com/apache/rocketmq-dashboard/issues/5479
### Studio Version
branch: `rocketmq-studio` @ `6a68042f` (the revision verified; the branch is
based on it)
deployed as: CI (GitHub Actions `Backend Tests (Java 21)`)
### Runtime Environment
Not environment-specific; the failure appears under CI load. `cd server &&
mvn -o test -Dtest=AiRunServiceTest` passes locally.
### Connected RocketMQ Cluster
Not cluster-specific.
### Describe the Bug
`AiRunServiceTest.stopShouldAbortALiveRunAndLeaveItStoppedWithUserStopTest`
looked the run's handle up **again** after `service.stop(RUN_ID)` and required
it to be present with the user-stop reason. `stop()` cancels the worker, and
the worker's own finalisation removes the registration —
`AiRunExecutor.execute`'s `finally` calls `registry.finish(run.getId())`, which
does `runs.remove(runId)` — so that lookup races with the removal. Measured on
this machine: the run reaches `STOPPED`, and the registration is gone **2 ms**
later. On a loaded runner the worker wins and the assertion fails:
```
[ERROR]
AiRunServiceTest.stopShouldAbortALiveRunAndLeaveItStoppedWithUserStopTest:327
Expecting Optional to contain a value but it was empty.
```
The failure was recorded on branches that do not touch this class at all
(three of them in a batch of unrelated PRs, plus a run dated 2026-10-01), i.e.
roughly one in ten backend CI runs was red for no reason.
### Steps to Reproduce
1. Run the backend test suite in CI (`Backend Tests (Java 21)`);
intermittently the job fails on that assertion.
2. Locally, insert a temporary probe after the run reaches `STOPPED`:
`registry.handle(RUN_ID)` is still present immediately and disappears within ~2
ms.
### What Did You Expect to See?
The test asserts the stop attribution deterministically.
### What Did You See Instead?
An unrelated red CI job, with a failure that cannot be reproduced locally on
demand.
### Evidence
- `ops/ai/conversation/AiRunExecutor.java:301` (`registry.finish`),
`AgentRunRegistry.java` (`runs.remove`), `AgentRunHandle.java` (`awaitStop` →
`cancelWorker`), the test's lookup.
- `cd server && mvn -o test
-Dtest='org.apache.rocketmq.studio.ops.ai.conversation.*Test'` — `Tests run:
201, Failures: 0, Errors: 0`; `AiRunServiceTest` alone passed 10 consecutive
runs after the fix.
### Impact
Unrelated CI runs go red, sending contributors after phantom failures; the
intended assertion (the stop is attributed to the user and the run ends
STOPPED/USER_STOP) is preserved by the fix.
### Acceptance Criteria
- The test asserts the attribution on the handle it captured before
stopping, and keeps asserting the run row's terminal state.
**Corresponding PR:** #5450
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]