fix(gateway): emit error when turn cancels before agent ready - #66545
fix(gateway): emit error when turn cancels before agent ready#66545deniqlab wants to merge 1 commit into
Conversation
|
Thanks for isolating the deferred-start cancellation path. Current main still has the silent return at This is an automated hermes-sweeper review. |
SummaryThree PRs address or reference #63078: #65567 and #66545 add error emission for the pre-ready cancellation/not-running branch, while merged #71140 records a broader fix for the reported first-message loss by extending the agent-build wait and surfacing initialization failures. The two open PRs cover the silent-return symptom but do not resolve the underlying long-build timeout described by the issue. Related pull requests
Duplicates#66545 is substantively a duplicate of #65567; #65567's server-side change was subsequently incorporated into the broader merged #71140, yielding the explicit chain #66545 → #65567 → #71140. Suggested consolidationClose #66545 as duplicate of #65567, then close #65567 as duplicate of merged #71140. This departs from the keep_open reviews on #66545 and #65567 because the later merged #71140 records incorporation of #65567's server-side path and adds the broader build-wait fix; additionally, the blocking contributor review on #65567 requires intentional Stop not to emit a generic error, so neither open diff should be merged unchanged. Complex graphflowchart LR
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
I63078(["issue #63078 (closed)"])
subgraph Dup65567 ["PRs duplicating each other"]
P65567["PR #65567 (open)"]
P66545["PR #66545 (open)"]
end
P66545 -.->|partial| I63078
class I63078 closed
class P65567 open
class P66545 open
class P65567 best
class P66545 target
click I63078 "https://github.com/NousResearch/hermes-agent/issues/63078"
click P65567 "https://github.com/NousResearch/hermes-agent/pull/65567"
click P66545 "https://github.com/NousResearch/hermes-agent/pull/66545"
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 3 pull requests and 1 issue in this complex. Diffs were read for 2 of 3 PRs (rest unavailable); Assessment working set: 11 kB of PR diffs, 13 kB of issue/PR text, 13 kB of discussion (15 comments), 5 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
Summary
When a turn is cancelled during lazy agent startup,
run_after_agent_ready()used to clear the inflight turn and return silently. That made the Desktop look like the first send vanished:prompt.submitreturnedstreaming, but the user never received an error event or a turn start.This patch emits an explicit error event before returning in the cancelled / not-running path so the client can surface the failure instead of hanging silently.
Changes
tui_gateway/server.py: emit anerrorevent when the deferred turn is cancelled before agent readiness or the session is no longer running.tests/test_tui_gateway_server.py: add regression coverage for both the user-cancelled and not-running cases.Verification
/Users/debuggerson/.hermes/hermes-agent/venv/bin/python -m pytest tests/test_tui_gateway_server.py -k 'interrupt_before_agent_ready_prevents_late_turn_start or prompt_submit_emits_error_when_stopped_before_agent_ready'/Users/debuggerson/.hermes/hermes-agent/venv/bin/python -m pytest tests/test_tui_gateway_server.pygit diff --checkCloses #63078