unbridled-41 opened a new issue, #5122: URL: https://github.com/apache/rocketmq-dashboard/issues/5122
### Before Creating the Bug Report - [x] I have searched the [open issues](https://github.com/apache/rocketmq-dashboard/issues) of this repository and believe that this is not a duplicate. - [x] This is a defect in RocketMQ Studio, not a usage question and not a defect in another Apache RocketMQ repository. - [x] I can reproduce this on the current `master` branch, or I have stated the exact version I am running below. ### Studio Version ``` branch: rocketmq-studio git commit id: 4ee173ad71ae777f01111394a88358958b9abad6 deployed as: built from source; the evidence below is the repository's own test suite run against that revision, not a deployed instance ``` ### Runtime Environment ``` OS: Ubuntu on Linux 6.6.87.2-microsoft-standard-WSL2 JDK: OpenJDK 21.0.12.1 Maven: 3.8.7 (offline) MySQL: not available in this environment, so the MySQL-backed *IntegrationTest classes are not part of the evidence ``` ### Connected RocketMQ Cluster None. The defect is in the hosted-AI run lifecycle (`server/src/main/java/org/apache/rocketmq/studio/ops/ai/conversation/`), which never talks to a RocketMQ cluster; the evidence uses the stub `AgentProvider` in `AiRunExecutorTest`. ### Describe the Bug `AiRunExecutor.execute` catches `LlmGatewayException` and `RuntimeException` (`AiRunExecutor.java:280`, `:283` at the commit above) and decides the run's terminal state in `finally` (`:286-291`). A `Throwable` that is neither matches no catch: the `Outcome` stays empty, `decide()` (`:466-494`) skips its gateway branch (`:476`) and its unexpected branch (`:481-484`), and falls through to the last branch at `:493`: ```java 493: return new Terminal(RunStatus.COMPLETED, null, null, null, outcome, false); ``` `finalizeRun` (`:496`) then persists that status with `runRepository.update(run)` (`:526`). ### Steps to Reproduce With the base revision of the production file in place and the regression test from the pull request below: ```bash git show origin/rocketmq-studio:server/src/main/java/org/apache/rocketmq/studio/ops/ai/conversation/AiRunExecutor.java \ > server/src/main/java/org/apache/rocketmq/studio/ops/ai/conversation/AiRunExecutor.java cd server && mvn -o test -Dtest='AiRunExecutorTest#anErrorFromTheWorkerShouldNotBeRecordedAsACompletedRunTest' cd .. && git checkout -- server/src/main/java/org/apache/rocketmq/studio/ops/ai/conversation/AiRunExecutor.java ``` The stub provider in that test emits one `TextDelta` and then throws `new StackOverflowError("nested tool output")`. Observed output at that revision: ```text 09:37:56.422 [main] INFO org.apache.rocketmq.studio.ops.ai.conversation.AiRunExecutor -- agent run 11 finished: status=COMPLETED reason=null durationMs=15 providerDurationMs=null tokens=null/null endSeq=3 expected: "FAILED" but was: "COMPLETED" ``` ### What Did You Expect to See? A terminal but unsuccessful run: `status=FAILED`, `stopReason=PROVIDER_ERROR`, error code `ai.run.internal_error` — the same terminal state the executor already writes for an unexpected `RuntimeException`, which `AiRunExecutorTest#anUnexpectedProviderFailureShouldNotLeaveTheRunNonTerminalTest` pins. ### What Did You See Instead? The run row was written as `COMPLETED` even though the run produced no answer. What that means in code terms: `finalizeRun` stamps `finishedAt`, `durationMs` and `endSeq`, writes a `COMPLETED` terminal timeline event, and the run is replayed from the timeline as a finished run; no abort was recorded, so `AgentRunHandle.stop` has nothing to correct. The path is reached by any `Throwable` that is not an `Exception` raised while the provider stream is consumed. ### Additional Context Related but different open items: #5003 (a replayed `run_finished` frame omits `durationMs`) and #4795 (a failed workspace preparation stranded the run in `QUEUED`, closed). Pull request with the fix and the regression test: #5118 -- 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]
