Repository navigation
fix(gateway): retain timeout notices after chat reload - #142135
Conversation
A hard run-timeout is delivered through the same AbortSignal machinery as an explicit user cancel, so its terminal lifecycle event carries aborted:true and can also land on the "end" phase rather than "error". The pre-reply failure-notice gate required phase === "error" and aborted !== true, so a deadline-killed turn with no assistant output left the transcript untouched: the next turn saw two consecutive user messages and no evidence the previous turn had ever run. Widen the gate to cover both terminal phases and drop the aborted exclusion; it added no coverage beyond the existing status check, since deliberate cancellations already classify to session status "killed" rather than "failed"/"timeout" and remain excluded. Fixes openclaw#141839.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 8, 2026, 2:35 PM ET / 18:35 UTC (Revision 5). ClawSweeper reviewWhat this changesPreserves no-reply timeout notices across chat reloads and history navigation while retaining the admitted CLI account’s context until terminal writes finish. Merge readiness⛔ Blocked before merge - 1 item remains This PR remains useful: current main still excludes aborted timeout notices and displayed custom reports from history. No blocking patch defect was found, and the supplied runtime evidence supports the repair. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway records terminal agent outcomes in session transcripts. History readers turn those records into chat messages, while CLI history ownership controls which saved context a later run may read. flowchart TD
A[Agent terminal event] --> B[Normalize run outcome]
B --> C[Check current run authority]
C --> D[Existing transcript report writer]
D --> E[Session transcript]
E --> F[Chat history and reload]
E --> G[Account-scoped later context]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +204, Tests +472. Total +676 across 24 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep one fenced failure-report writer and consistently expose its displayed records through history while preserving account-scoped continuation. Do we have a high-confidence way to reproduce the issue? Yes: current source excludes aborted timeout terminal events and custom reports from visible history, and the PR supplies a real Gateway deadline comparison. This review did not execute the reproduction. Is this the best way to solve the issue? Yes: the patch extends the existing report owner and readers rather than introducing competing persistence. The prior migration request is unnecessary for this repair of an established display contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7069a4772ff4. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
ClawSweeper's ask is for real-Gateway proof (an actual run-timeout deadline elapsing through the live pipeline, then a chat-history reload showing the notice), beyond the existing unit test that feeds synthetic lifecycle events straight into I searched this checkout for that harness rather than fabricate output: there is no existing test that boots a real Gateway, drives a run through an actual timeout deadline via the real agent pipeline, and reads the transcript back through the public The review's own "Mantis proof suggestion" (a live Gateway deadline + chat reload capture) is the right way to get that tier of proof — that needs a maintainer to trigger |
Use the existing failure-report owner for no-reply timeouts and retain explicitly displayed custom reports through history pages, deltas and archives. Preserve report identity, display ordering and private-detail sanitization without changing transcript storage or writer authority.
Carry the prepared CLI writer context through terminal persistence and revalidate its exact operational owner before commit. Drain accepted writes before normal admission close, while explicit revocation and fallback selection invalidate stale captures. Preserve same-account continuation and native-session recovery without weakening account guards.
Await terminal persistence on both optional session-resolution paths and express command completion with explicit async cleanup. Keep CLI history regressions with the existing failure-report tests within the current Gateway test-root limit.
|
landpr-approve-unrelated-red |
|
Thanks @chelsealong! Proof: A real Gateway deadline before any reply now leaves one notice that survives chat-history and Control UI reload. Actual same-account CLI requests retain the notice and recover a missing native session; changed-account and explicit-cancellation controls preserve their boundaries.
AI-assisted. Original contributor credit retained. CI exception: The completed run has one unrelated failure: The actual tested merge was The precise Windows teardown/census race and its introducing commit remain unverified. This is a separate CI follow-up. The guarded landing uses the recorded standing approval for this exact completed run; full CI is not claimed green. |
Fixes openclaw#141839. ## What Problem This Solves A Gateway deadline could end a turn before any reply without leaving a durable notice. History reload then hid the failed turn, and later context could contain consecutive user requests with no explanation. Use the existing failure-report writer for normalized timeout/failure outcomes on both terminal phases. Preserve its explicitly displayed custom records through history pages, cursor updates, reset navigation and archives. The notice truthfully says the turn ended before a reply. Carry the admitted CLI writer's existing account context through terminal persistence. Finish accepted writes before normal admission close, recheck exact current ownership at commit, and revoke the context before another fallback candidate. Same-account continuation and supported missing-native-session recovery retain saved history; changed accounts still cannot read the former account's history. ## Evidence A real source Gateway and matching Control UI ran with a deterministic loopback provider and the existing Gateway deadline. Pinned main omitted the notice. The repaired build persisted one notice across the aborted `end` and execution-settled `error`, retained it after history/UI reload and Gateway restart, and delivered it to a later turn. Actual `chat.history` notice from the corrected build, with private identifiers, timestamps and transcript-position metadata removed: ```json { "role": "custom", "customType": "run-failed-before-reply", "content": "This turn ended before a reply: Run timed out", "display": true } ``` A second real comparison addressed the accepted same-CLI history regression. Both builds first saved a successful native CLI session, then hit a real no-output Gateway deadline. Neither comparison changed the backend or account. After the fixture reported the resumed native session missing: | Public result | Prior published revision | Corrected build | | --- | --- | --- | | Later resume request | Saved timeout note absent | Saved timeout note present | | Supported fresh-session recovery | Refused because history coverage was lost | Prior conversation and saved notice restored | | `agent.wait` status | `error`: session not found | `ok` | | Durable timeout notice count | One for the timed-out run | One for the timed-out run | The actual successful recovery result, with private run identity and timestamp removed: ```json { "status": "ok", "terminalReply": { "disposition": "visible", "text": "The fixture produced this fixed response independently of input." } } ``` Provider input was inspected directly; the fixed response is not evidence of model recall. An independent source-blind operator repeated continuation, missing-session recovery, history/UI reload, same-connection cancellation, stale/repeated abort and changed-account exclusion. All supplemental probes passed. Complete raw captures and fixtures are retained privately for exact-head review; these public excerpts omit credentials, request data and infrastructure metadata. ## Validation and limits - Original proof: 79 lifecycle, 54 history-reader and 119 terminal/abort tests passed; changed regressions failed on pinned main for the intended missing-notice/history behavior. - Correction: 46 owner/history tests, 368 command/channel/event sibling tests, and all 21 project-session tests passed. Formatting, focused lint and the proof runtime/UI builds passed. - Real partial output followed by timeout added no extra failure notice. Explicit cancellation stayed killed and added no timeout notice. Stale ownership and cross-account controls remained enforced. - Automatic active-run startup recovery of the synthetic fixture backend was unavailable; that separate route is not claimed. Supported missing-native-session recovery passed. The partial-output control does not claim durable partial-text preservation. - No transcript schema, configuration, second writer, account policy or timeout change. Source-only and universal lifecycle clauses retain their component/source evidence rather than being claimed as fully source-blind observations. AI-assisted. Original contributor implementation and credit retained. Co-authored-by: Ayaan Zaidi <[email protected]>
Fixes #141839.
What Problem This Solves
A Gateway deadline could end a turn before any reply without leaving a durable notice. History reload then hid the failed turn, and later context could contain consecutive user requests with no explanation.
Use the existing failure-report writer for normalized timeout/failure outcomes on both terminal phases. Preserve its explicitly displayed custom records through history pages, cursor updates, reset navigation and archives. The notice truthfully says the turn ended before a reply.
Carry the admitted CLI writer's existing account context through terminal persistence. Finish accepted writes before normal admission close, recheck exact current ownership at commit, and revoke the context before another fallback candidate. Same-account continuation and supported missing-native-session recovery retain saved history; changed accounts still cannot read the former account's history.
Evidence
A real source Gateway and matching Control UI ran with a deterministic loopback provider and the existing Gateway deadline. Pinned main omitted the notice. The repaired build persisted one notice across the aborted
endand execution-settlederror, retained it after history/UI reload and Gateway restart, and delivered it to a later turn.Actual
chat.historynotice from the corrected build, with private identifiers, timestamps and transcript-position metadata removed:{ "role": "custom", "customType": "run-failed-before-reply", "content": "This turn ended before a reply: Run timed out", "display": true }A second real comparison addressed the accepted same-CLI history regression. Both builds first saved a successful native CLI session, then hit a real no-output Gateway deadline. Neither comparison changed the backend or account. After the fixture reported the resumed native session missing:
agent.waitstatuserror: session not foundokThe actual successful recovery result, with private run identity and timestamp removed:
{ "status": "ok", "terminalReply": { "disposition": "visible", "text": "The fixture produced this fixed response independently of input." } }Provider input was inspected directly; the fixed response is not evidence of model recall. An independent source-blind operator repeated continuation, missing-session recovery, history/UI reload, same-connection cancellation, stale/repeated abort and changed-account exclusion. All supplemental probes passed. Complete raw captures and fixtures are retained privately for exact-head review; these public excerpts omit credentials, request data and infrastructure metadata.
Validation and limits
AI-assisted. Original contributor implementation and credit retained.