Repository navigation
fix: resumed main-session turn after a gateway restart is delivered to the session's last route instead of silently completing - #127342
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 6:39 PM ET / 22:39 UTC. ClawSweeper reviewWhat this changesThe PR makes an unclaimed interrupted main-session turn deliver its recovered reply through the session’s persisted route after a Gateway restart, with regression and QA coverage. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open. Current main still omits the persisted-route opt-in for resumed turns; this PR adds the constrained existing fallback with no blocking defect found. Its mock-Gateway QA proof is sufficient; wait for queued exact-head checks before merge. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherGateway restart recovery resumes interrupted main-session turns after startup. It resolves an allowed delivery route, checks policy, and hands the completed reply to the channel adapter. flowchart LR
A[Interrupted main-session turn] --> B[Gateway restart]
B --> C[Restart recovery]
C --> D[Delivery route resolution]
D --> E[Send policy check]
E --> F[Outbound channel reply]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +1, Tests +12, Other +181. Total +194 across 4 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. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Merge the existing-resolver opt-in once exact-head checks confirm its claimed-route, send-policy, and no-duplicate safeguards. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main leaves the resolver fallback disabled at the resumed-turn call site, while the resolver admits the persisted route only when that flag is enabled and no active claim exists. Is this the best way to solve the issue? Yes: this is the narrowest owner-boundary repair because it reuses the existing normalized, policy-checked resolver rather than introducing a parallel delivery path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3f6f6799e95c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
…penclaw#127339) Co-authored-by: Peter Steinberger <[email protected]>
1918e2c to
cc60ecb
Compare
|
Merged via squash.
|
…o the session's last route instead of silently completing (openclaw#127342) * fix(agents): deliver unclaimed restart recoveries to session route (openclaw#127339) Co-authored-by: Peter Steinberger <[email protected]> * test(qa): validate restart isolation without stale inventory --------- Co-authored-by: Peter Steinberger <[email protected]>
Closes #127339.
What Problem This Solves
When the Gateway restarts during a main-session turn, startup recovery can resume an unclaimed interrupted session and write its completed answer to the transcript without delivering that answer to the channel where the conversation happened. The user experiences a silent dropped response even though the model believes it replied.
Why This Change Was Made
The successful resume owner called the existing restart-recovery delivery-context resolver without opting into the authoritative delivery route already persisted on the session. Its sibling failure-notice owner already enables that same route. This change enables the existing owner-controlled route for successful recovery as well; it adds one production line and introduces no new configuration, persistence shape, protocol, transport fallback, or authority.
The shared resolver still rejects claimed transcript-only recovery, non-deliverable or incomplete destinations, and denied send policies. Explicit run-owned delivery context retains precedence, and message-tool-only recovery continues to require its existing trusted channel authority.
The original exact-head CI also exposed an obsolete QA catalog assertion that enumerated exactly 15 restart scenarios. The new scenario already correctly declared isolated execution and a meaningful isolation reason; the test failed solely because it became the 16th valid scenario. The catalog now requires nonempty discovery and checks isolation across every discovered restart scenario, while specifically verifying this new scenario declares its reason. Existing scenarios whose optional reason is absent remain compatible.
User Impact
After an interrupted Gateway restart, users receive the recovered answer in the original conversation instead of silently losing it. Existing transcript-only recovery, denied send policies, and trusted tool-authority restrictions remain unchanged. Future correctly isolated restart scenarios no longer break QA because of a stale scenario inventory.
Evidence
Before the production fix, the expanded owner-boundary regression passed for the existing claimed delivery route but failed for the unclaimed persisted route: recovery requested
deliver: falseand emitted no channel delivery. After the fix, both routes call the real outbound adapter and reply-payload hook exactly once with the expected channel, destination, account, and thread. Send-policy denial is covered for both route sources.The catalog regression was separately reproduced before its repair:
requires explicit suite isolation for gateway state restart scenariosfailed with 16 actual scenarios versus the obsolete 15-item snapshot, specifically becausegateway-restart-unclaimed-deliverywas present.The isolated QA scenario crosses the real changed boundary: a genuine qa-channel inbound turn records the canonical session route; its ephemeral Gateway is stopped; an interrupted user turn is persisted with no recovery delivery claim or run-specific context; the replacement Gateway automatically recovers that session using the mock provider; and the original qa-channel receives exactly one completed response, followed by a 1.5-second no-duplicate quiet window.
Exact reviewed head:
4a48fdb46b1157e0e4ae7ab6e5ef04ada1ebd96e. Structured full-branch review and independent source-only review found no actionable defects. The existing claimed-route, transcript-only, deny-policy, reply-hook, and trusted message-tool authority sibling coverage remains green. Production delta: +1 line; owner regression tests +153/-131 (net +22), catalog isolation regression +7/-17 (net -10), and real-Gateway QA scenario +181 lines. Original fix and primary contribution: Ernest Rolfson (@ernestrolfson-design).