fix(api-server): stream run reasoning deltas - #67339
Conversation
Duplicate of #15169: the live patch uses the same |
|
Thanks for the focused regression coverage. The underlying gap is real on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
SummaryTwenty-six PRs address or reference this issue complex across four causes: incorrect answer-derived reasoning snapshots, missing live reasoning callbacks in Runs/Chat/Responses SSE, provider-specific reasoning-marker leakage, and an upstream LLM Gateway SSE parsing failure. The diffs either correct the reasoning source, wire structured reasoning to API transports, add delimiter scrubbers, or introduce a JSONDecodeError fallback; several combine or supersede those narrower changes. Related pull requests
DuplicatesRuns live-delta cluster: #15169, #55163, #61259, and #67339, with the same callback mechanism also included in broader #75562; Chat callback cluster: #11482, #13401, #22364, #35083, #52606, and the Chat portions of #57094/#75562. Reasoning-source duplicates are #24566/#24571 and the corresponding parts of #24535/#24852/#75562; Chinese-marker scrubbers are #43836/#43839/#43932; JSONDecodeError fallbacks are #24572/#24852. Suggested consolidationClose #67339 as a duplicate of #15169: despite the keep-open review and recorded best-fix verdict on #67339, its diff implements the same Runs callback and Complex graphflowchart TD
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
I24518(["issue #24518 (closed)"])
I60634(["issue #60634 (open)"])
subgraph Dup15169 ["PRs duplicating each other"]
P15169["PR #15169 (open)"]
P24535["PR #24535 (closed)"]
P55163["PR #55163 (open)"]
P61259["PR #61259 (open)"]
P67339["PR #67339 (open)"]
P75562["PR #75562 (open)"]
end
P67339 -.->|partial| I24518
P67339 -->|best fix| I60634
class I24518 closed
class I60634 open
class P15169 open
class P24535 closed
class P55163 open
class P61259 open
class P67339 open
class P75562 open
class P15169 best
class P24535 best
class P67339 best
class P75562 best
class P75562 best
class P67339 target
click I24518 "https://github.com/NousResearch/hermes-agent/issues/24518"
click I60634 "https://github.com/NousResearch/hermes-agent/issues/60634"
click P15169 "https://github.com/NousResearch/hermes-agent/pull/15169"
click P24535 "https://github.com/NousResearch/hermes-agent/pull/24535"
click P55163 "https://github.com/NousResearch/hermes-agent/pull/55163"
click P61259 "https://github.com/NousResearch/hermes-agent/pull/61259"
click P67339 "https://github.com/NousResearch/hermes-agent/pull/67339"
click P75562 "https://github.com/NousResearch/hermes-agent/pull/75562"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label). Cross-PR triage: Reviewed 26 pull requests and 5 issues in this complex. Each diff was read against this issue; Assessment working set: 230 kB of PR diffs, 89 kB of issue/PR text, 42 kB of discussion (64 comments), 40 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
Summary
/v1/runsexecution pathreasoning.deltaSSE events for structured reasoning chunksrun.completedRoot cause
The provider stream already invokes the agent's reasoning callback, but the API server's runs adapter did not pass such a callback when constructing
AIAgent. As a result, reasoning could be persisted and visible in session history after the run while remaining absent from the live runs SSE stream.Compatibility
This is an additive SSE event. Existing clients that ignore unknown event types continue to behave as before.
Validation
scripts/run_tests.sh tests/gateway/test_api_server_runs.pyFixes #60634