fix(dashboard-api): recognize reasoning tokens and tool calls in pixel chat stream - #5607
Open
vaibhavsrv wants to merge 1 commit into
Open
vaibhavsrv wants to merge 1 commit into
vaibhavsrv wants to merge 1 commit into
Conversation
vaibhavsrv
force-pushed
the
fix/pixel-chat-reasoning-answer
branch
from
September 17, 2026 04:09
6e118f4 to
db1545c
Compare
vaibhavsrv
force-pushed
the
fix/pixel-chat-reasoning-answer
branch
from
September 17, 2026 04:26
db1545c to
b5e71b4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this matters
In
ods/extensions/services/dashboard-api/routers/pixel.py, the retained chat stream handler_produce_retained_result()monitors Server-Sent Events (SSE) from the Pixel edge service to determine whether a response contains meaningful output before saving it intoChatResultStore. Lines 780-783 evaluateanswer_seenby strictly checkingif isinstance(payload, dict) and isinstance(payload.get("content"), str) and payload["content"]: answer_seen = True. When using reasoning models (such as DeepSeek-R1 distillations, Qwen reasoning checkpoints, or models emitting thought traces) or tool-calling models, generated tokens are streamed inreasoning_content(ortool_calls) whilecontentremains empty or omitted. Becauseanswer_seenremainsFalse, the arrival ofdata: [DONE](lines 784-794) misclassifies the completed response as an aborted/zero-output session, flagsfailed = True, and overwrites the user transcript with an error frame:"Pixel returned no answer. Try again.".This fix surgically expands the stream content probe in
_produce_retained_result()to setanswer_seen = Truewhenpayloadcontains non-emptyreasoning_contentortool_calls. Genuine zero-token aborts (such as premature cancellations or role-only frames) remain rejected as empty, while reasoning streams and tool executions complete successfully. Existing receipts persistence, ownership boundaries, and stream timeouts remain untouched.Validation
reasoning_contentchunks followed bydata: [DONE]evaluatedanswer_seenasFalse, marking the session state asinterruptedand appending"Pixel returned no answer. Try again.".reasoning_contentortool_callsresolve cleanly to statecompletewithout injecting false errors, while role-only streams without tokens continue to be flagged as interrupted."[Dashboard-api] suites: 3 passed. New-test Ruff, ShellCheck, and diff checks pass; new regressions wired into Linux CI."Overlap check
fix(model-contract): coerce integer float token limits in projection): Addressed integer float coercion inods/bin/pixel_model_contract.py; does not touch dashboard SSE stream consumption.fix(pixel-relay): return 502 bad gateway when upstream model router is unavailable): Addressed upstream connectivity error boundaries inpixel-model-relay; does not touch dashboard receipt tracking.fix(pixel-edge): accumulate content before finish reason in stream fallback guard): Focused on edge runtime buffer accumulation; does not alter dashboard-api retained stream event parsing.Risk / AI disclosure
AI-assisted investigation, implementation and CLI regressions. This strengthens SSE stream payload accounting for reasoning models, not runtime admission. Independent human review and platform/runtime qualification remain gates. No running configuration, deployment or upstream merge changed.
Follow-up integration evidence
Composed with #5606 at ebe8577 without conflicts. Production and test diffs passed together; pixel chat results and stream checks remain intact.
Backlog composition was local-only (production/test diffs, excluding workflow/Makefile wiring); it is not an upstream merge or independent human approval. Declared live-review gates remain open.