Repository navigation
Description
Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
A queued reply started through Gateway RPC can lose restart recovery after its original chat.send run finishes but before final delivery completes.
Steps to reproduce
- Start an isolated Gateway with a loopback mock OpenAI Responses provider.
- Send two authenticated
chat.sendrequests to the same session withqueueMode: "followup", holding the first provider response until the second request is queued. - Allow both model turns to complete, and hold the queued turn at the existing final-delivery boundary.
- Close the Gateway with a restart expected and
drainTimeoutMs: 0. - Inspect the session's restart-recovery state.
The reproduction uses the actual Gateway, WebSocket requests, reply pipeline, session admissions and SQLite store. It does not construct synthetic reply operations or admissions.
Expected behavior
The still-undelivered queued reply remains eligible for the documented Gateway restart recovery.
Actual behavior
Before close, the real queued reply remains active and the original chat-run registrations are gone. The session remains done without a restart-recovery marker after close.
OpenClaw version
Source build d58c93f334ce5f867707a07591c0d032f6d1f641. The affected producer files remain unchanged at main e449371c3b157d59292cbdee1aa9a9112fb1c7b6.
Operating system
macOS 27.0
Install method
Isolated source worktree with pinned workspace dependencies; repository Vitest Gateway harness.
Model
Synthetic OpenAI Responses text fixture; no public model call.
Provider / routing chain
Authenticated WebSocket client → actual Gateway → loopback HTTP SSE provider fixture → queued final-delivery boundary.
Logs
Before close: status=done, operation=queued_followup, activeChatRuns=0, queued=1
Admission selected by closing host resolver=false
Admission selected by retained RPC resolver=true
After close: restart marker=false, safe recovery tools=false, status=done
Screenshots, recordings, and evidence
The failure is covered by an executable Gateway regression test in the accompanying repair. No GUI recording or second-process resumed-delivery observation is claimed.
Impact and severity
Affected workflow: queued RPC replies, including webchat followups, when restart interrupts final delivery after the original client run has finished. The deterministic reproduction loses the recovery marker. Production frequency is unknown.
Additional information
Follow-up to #138071. Its exact-host shutdown filtering matches the bootstrap resolver, while the RPC and scheduled lifetime wrappers do not record that host binding. Binding the wrappers at their producers changes the same reproduction to restart marker=true, safe recovery tools=true, status=running while preserving execution availability checks.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Sep 4, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed September 4, 2026, 4:00 PM ET / 20:00 UTC.
Summary
Keep open: this is a current Gateway lifecycle regression with a formally linked open repair PR, and its
maintainerlabel prevents automated cleanup.Reproducibility: yes. —source-reproducible, though not executed in this read-only review. The report supplies an authenticated two-request Gateway scenario, and current source shows the exact owner-filtered shutdown path and queued-operation resolver binding involved.
Regression provenance
Possible regression — probable (reproduction; failure trace; reviewed change). No predecessor PR is attributed.
Root-cause cluster
Relationship:
canonicalCanonical: #138564
Summary: This issue is the canonical record for the remaining queued-RPC restart-recovery gap; an open PR is its candidate repair.
Members:
fixed_by_candidate: fix(gateway): preserve queued replies during restart #138565 - The open same-repository PR explicitly identifies this queued-RPC recovery behavior as its target.partial_overlap: fix(gateway): recover in-flight replies across restart #138071 - The merged earlier repair covers the adjacent Gateway restart-recovery owner boundary but does not supersede the separately reported queued-RPC gap.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Next step
A formally linked open PR already owns the bounded repair, and the protected
maintainerlabel requires normal maintainer handling rather than duplicate fix dispatch.Review details
Best possible solution:
Review and land the linked repair if it binds queued RPC and scheduled lifetime resolvers to the canonical Gateway host while preserving the existing execution-liveness fences and regression scenario.
Do we have a high-confidence way to reproduce the issue?
Yes—source-reproducible, though not executed in this read-only review. The report supplies an authenticated two-request Gateway scenario, and current source shows the exact owner-filtered shutdown path and queued-operation resolver binding involved.
Is this the best way to solve the issue?
Yes—the linked PR's producer-side canonical-host binding is the right repair direction, subject to exact-head review; a downstream recovery fallback would weaken the existing instance-ownership boundary.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against e8e09cb4cc26.
Label changes
Label changes:
P1: An interrupted queued follow-up can lose its documented automatic recovery path and leave users without the expected final reply.impact:message-loss: Without the recovery marker, an otherwise queued final reply can be abandoned after a restart.impact:session-state: The failure is the absence of durable restart-recovery state for an admitted session turn.maturity:stable: The documented broken contract is primarily Gateway Lifecycle, whose Gateway runtime owner is M4 Stable.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:linked-pr-open: Current issue advisory state selects this label.clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.Label justifications:
P1: An interrupted queued follow-up can lose its documented automatic recovery path and leave users without the expected final reply.impact:session-state: The failure is the absence of durable restart-recovery state for an admitted session turn.impact:message-loss: Without the recovery marker, an otherwise queued final reply can be abandoned after a restart.maturity:stable: The documented broken contract is primarily Gateway Lifecycle, whose Gateway runtime owner is M4 Stable.Evidence reviewed
What I checked:
docs/gateway/restart-recovery.md. (docs/gateway/restart-recovery.md:10, e8e09cb4cc26)src/auto-reply/reply/reply-run-registry.registry.ts:418, e8e09cb4cc26)src/gateway/scheduled-run-gateway-context.ts:22, e8e09cb4cc26)src/gateway/server-close.ts:339, 9319ba0799ce)qa/maturity-scores.yaml:22, e8e09cb4cc26)Likely related people:
How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.fix(gateway): recover queued RPC replies across restart (#138565)
fix(gateway): recover queued RPC replies across restart (openclaw#138565
chore: prepare extended-stable 2026.8.34 (#160960)