iloveeyjafjalla opened a new pull request, #6848:
URL: https://github.com/apache/rocketmq-dashboard/pull/6848

   Fixes #6847
   
   ## The defect
   
   `decide()` fails a run whose agent stream closed without delivering a result 
frame, and scopes that rule with `!isHttpEngine(engine)` — which covers every 
CLI engine. The qoder engine never emits such a frame: `QoderAgentProvider` 
inherits the default `AgentProvider.streamEvents` adapter, which turns the 
completion into text deltas and nothing else, while only 
`ClaudeCodeAgentProvider` overrides `streamEvents` and only 
`ClaudeCodeStreamParser` produces an `AgentEvent.ResultMeta`. So every finished 
qoder turn is written as `FAILED` / `PROVIDER_ERROR` / `llm.provider.no_result` 
although its answer streamed and its CLI exited 0.
   
   The shipped image is affected (`server/Dockerfile:81` installs 
`@qoder-ai/qodercli`), and the console shows it: failed marker on the answer 
bubble, error state on the conversation.
   
   ## The fix
   
   `AiRunExecutor` scopes the branch to the engines whose stream carries a 
result frame:
   
   ```java
   if (expectsResultFrame(context.getEngine()) && 
!StringUtils.hasText(outcome.subtype)) {
   ```
   
   `expectsResultFrame(engine)` sits next to the existing 
`isHttpEngine(engine)` and states the protocol fact where the decision needs 
it: only claude-code resolves a terminal result frame from its CLI's frame 
vocabulary. A text-only engine's turn is gated by its provider instead — 
`CliAgentProvider.complete()` throws `llm.provider.cli_error` on a non-zero 
exit and `llm.provider.empty_completion` on blank output — so a missing frame 
proves nothing about the process there.
   
   claude-code keeps its protection: 
`aStreamThatEndsWithoutAResultFrameMustNotCompleteTheRunTest` is untouched and 
still fails a claude-code run that ends without a frame.
   
   ## Tests
   
   Red on the trunk baseline before the change:
   
   ```
   [ERROR] 
AiRunServiceTest.aTextOnlyEngineTurnMustCompleteWithoutAResultFrameTest:375
   expected: "COMPLETED" but was: "FAILED"
   [ERROR] 
AiRunServiceTest.admissionShouldQueueTheRunWithASnapshotOfTheEngineAndModelTest:181
   expected: "COMPLETED" but was: "FAILED"
   ```
   
   The new `aTextOnlyEngineTurnMustCompleteWithoutAResultFrameTest` runs a 
`qoder` turn whose stream carries one text delta — the shape of a real qoder 
turn — and pins `COMPLETED` with no stop reason and no error code. The 
admission test, whose engine is `qoder` too, gets the same qoder shape and the 
assertion it had before #6391.
   
   Green after:
   
   ```
   [INFO] Tests run: 20, Failures: 0, Errors: 0 -- AiRunExecutorTest
   [INFO] Tests run: 28, Failures: 0, Errors: 0 -- AiRunServiceTest
   [INFO] You have 0 Checkstyle violations.
   ```
   
   Package-wide (`-Dtest='org.apache.rocketmq.studio.ops.ai.**.*Test'`): 973 
tests, 0 failures, 2 errors — both in `ClaudeCodeAgentProviderTest`, and both 
reproduce on pristine trunk in this environment (its fixtures spawn the CLI in 
a way this Windows host cannot execute), so they are unrelated to this change.
   
   ## Scope
   
   No conflict with the in-flight qoder work in #6768: that PR gives 
`QoderAgentProvider` its own `streamEvents` but still emits only text deltas, 
so the terminal decision is where this belongs either way.
   


-- 
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]

Reply via email to