Repository navigation
fix: recover final answers after WebSocket disconnects - #138985
Conversation
|
🦞👀 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: needs maintainer review before merge. Reviewed September 6, 2026, 10:25 AM ET / 14:25 UTC. ClawSweeper reviewWhat this changesPreserves WebSocket failure classifications and lets OpenClaw recover a final answer after completed tool work without repeating those tools. Merge readiness✅ Ready for maintainer review This PR remains necessary: current main still has the reported recovery gap. The earlier payload-gate finding is resolved, the supplied transport proof covers the repaired boundary, and no actionable defect remains. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw’s provider adapter turns network failures into assistant results. The agent runner uses those results and completed-tool evidence to decide whether its existing tool-free finalizer can produce an answer. flowchart TD
A[Provider WebSocket] --> B[Classify transport failure]
B --> C[Project assistant result]
D[Completed tool results] --> C
C --> E{Recovery checks pass?}
E -->|Yes| F[Tool-free finalizer]
F --> G[Final answer]
E -->|No| H[Preserve terminal outcome]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +31, Tests +501, Other 0. Total +532 across 14 files. View PR surface stats
Review metrics
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 recovery in the existing tool-free finalizer, driven by structured provider facts and exact tool-settlement evidence. Do we have a high-confidence way to reproduce the issue? Yes: current-main source shows opaque WebSocket errors losing classification and assistant-reported failures missing recovery context; the supplied controlled disconnect scenario exercises that path. This read-only review did not execute it. Is this the best way to solve the issue? Yes: repairing transport facts and the existing producer/consumer gates is narrower than introducing another retry mechanism, and preserves the no-replay exclusions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 13cb0bafd53c. 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)
|
Classify transport-level WebSocket failures at the provider boundary and carry completed-assistant failures through the canonical terminal outcome policy. Permanent close codes and timeout observations remain fail-closed. Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc OpenClaw-Publication: dfe624ba-e8f9-4b4b-b100-7d095034170a Co-authored-by: VACInc <[email protected]>
Use the validated settled-turn recovery context as the provider-warning gate regardless of whether the provider failure was thrown or returned as an assistant error. Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc OpenClaw-Publication: 7444a256-821a-41c7-9444-ebdc6714d3e2 Co-authored-by: VACInc <[email protected]>
Exercise the real failed assistant through the shared attempt projector, terminal preparation, and tool-free finalization after HTTP and WebSocket failures. Preserve the completed tool and transcript exactly once. Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]>
Give the structured permanent-close marker precedence over retry-looking text in the existing terminal-error guard. Preserve refusal and no-replay behavior for ordinary retries and settled-turn finalization. Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]>
Keep the same transport-failure assistant, transcript and settled-tool evidence while following the three-argument execution, settled and prompt contract introduced on main. Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]>
09c5591 to
5808e6a
Compare
|
@clawsweeper re-review Please review candidate 5808e6a. The previous payload-gate P1 and actual-assistant HTTP/WebSocket composition coverage are addressed. The related permanent-close disposition now takes precedence in the existing terminal-error guard, including retry-looking reason text; the fixture follows the current upstream three-argument projector API. The PR body now distinguishes preserved pre-refresh local evidence from current-head validation. Fresh hosted CI is running at https://github.com/openclaw/openclaw/actions/runs/34037838739. Local cooldown and stale dependency limitations are disclosed; no policies or package pins were weakened. Review only: no merge, auto-merge, or autofix requested. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Related follow-up: #140335 has merged into main as It fixes a separate liveness gap: the built-in model-stream watchdog remains armed while its consumer is paused, and ChatGPT Responses WebSocket progress reaches the signal observed by that watchdog. #138985 remains the fix for transport-error classification and eligible final-answer recovery after tools settle. These changes are complementary, not replacements. #140335 does not broaden finalization eligibility or authorize replaying settled tools. |
* fix(agent): recover settled turns after websocket failures Classify transport-level WebSocket failures at the provider boundary and carry completed-assistant failures through the canonical terminal outcome policy. Permanent close codes and timeout observations remain fail-closed. Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> * fix: recover final answers after WebSocket disconnects Worked on by: - @VACInc OpenClaw-Publication: dfe624ba-e8f9-4b4b-b100-7d095034170a Co-authored-by: VACInc <[email protected]> * fix(agent): finalize assistant-reported transport failures Use the validated settled-turn recovery context as the provider-warning gate regardless of whether the provider failure was thrown or returned as an assistant error. Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> * Publish openclaw/openclaw-openclaw-vacinc-issue-138959 Worked on by: - @VACInc OpenClaw-Publication: 7444a256-821a-41c7-9444-ebdc6714d3e2 Co-authored-by: VACInc <[email protected]> * test(agent): prove WebSocket finalization without replay Exercise the real failed assistant through the shared attempt projector, terminal preparation, and tool-free finalization after HTTP and WebSocket failures. Preserve the completed tool and transcript exactly once. Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> * fix(agent): honor permanent WebSocket close disposition Give the structured permanent-close marker precedence over retry-looking text in the existing terminal-error guard. Preserve refusal and no-replay behavior for ordinary retries and settled-turn finalization. Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> * test(agent): adapt settled-turn fixture to current result API Keep the same transport-failure assistant, transcript and settled-tool evidence while following the three-argument execution, settled and prompt contract introduced on main. Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> --------- Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: VACInc <[email protected]>
|
Related transcript-state repair #138984 has now merged as b0ae5b6. It addresses atomic history publication, reset-crossing amplification, and selected-reader context. It does not replace the WebSocket liveness or final-answer recovery work tracked here. Similar visible stalls or stale answers can have different owners; these fixes remain complementary. |
Closes #138959
What Problem This Solves
A transient provider WebSocket disconnect after tool calls have settled can leave the user with a generic provider-error warning instead of a final answer. Opaque transport errors lost their classification evidence, and assistant-reported errors did not reach the existing tool-free finalizer.
Why This Change Was Made
The change reuses the existing isolated finalizer. It does not add a retry loop, broaden generic WebSocket message matching, change configuration or storage, or replay a settled tool operation. Production change: +71/-40 (net +31); tests and test support: net +501; assertion baseline: net 0. The production increase records explicit transport facts and supports the provider's actual failure representation rather than adding another recovery mechanism.
User Impact
After eligible completed tool work, transient transport failure can produce a final summary without repeating actions. Permanent close codes and refusals take precedence over message text. Existing cancellation, timeout, unfinished-tool, asynchronous-work, intentional-silence, and already-delivered-output exclusions remain in force. Recovery summarizes completed results; it does not imply that failed tools succeeded.
Evidence
Final candidate: 5808e6a, based on ba45712.
Focused regression command:
Review follow-up: the previous ClawSweeper payload-gate P1 and requested real-assistant composition coverage are addressed. The permanent-close follow-up also has a regression for retry-looking reason text and stale finalization context. Fresh ClawSweeper review of this exact final head completed September 6, 2026 at 14:10 UTC with no actionable findings, no before-merge items, and proof marked sufficient for this internal-reliability boundary. Review: #138985 (comment).
Worked on by:
View the OpenClaw team session