Repository navigation
fix(agents): unblock channel turns after repeated gateway restarts - #116728
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 5:13 AM ET / 09:13 UTC. ClawSweeper reviewWhat this changesThis PR changes main-session restart recovery so each recovery run ID has one current lifecycle owner, clears obsolete same-run fences on completion, and adds regression coverage for recovery persistence, lifecycle projection, restart marking, and channel admission. Merge readinessThe PR appears to make a coherent, bounded repair for the linked restart-recovery bug and now includes after-fix channel-runtime evidence. It remains open because it carries the protected Priority: P1 Review scores
Verification
How this fits togetherChannel updates enter the Gateway, which admits work against persisted main-session recovery state before starting an agent turn. Restart recovery records active run ownership; lifecycle terminal events then clear that ownership so later channel messages can proceed instead of being rejected as a changed session. flowchart LR
A[Channel update] --> B[Gateway turn admission]
B --> C[Persisted main-session recovery state]
C --> D[Recovery run lifecycle owner]
D --> E[Terminal lifecycle event]
E --> F[Clear settled recovery ownership]
F --> G[Next channel turn admitted]
Decision needed
Why: The patch is a plausible targeted repair with positive runtime proof, but it changes persisted session ownership semantics and the Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +141. Total +141 across 7 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Mantis proof suggestionA redacted before/after Telegram Desktop recording would directly demonstrate the user-visible symptom and recovery path beyond the supplied Matrix-channel runtime output. A maintainer can ask Mantis to capture proof by posting this exact PR comment: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase or merge-update the branch onto current Do we have a high-confidence way to reproduce the issue? Yes in source and hosted evidence: the reported state is two persisted fences with the same recovery run ID across lifecycle generations, followed by a current-generation terminal and another channel turn. The supplied exact-head Gateway/channel smoke demonstrates the after-fix restart-and-next-message path, but no local reproduction was run in this read-only review. Is this the best way to solve the issue? Yes, provisionally: making the run ID the canonical recovery owner aligns restart marking and admission, while retaining generation-specific treatment for delayed old terminals. The safest landing path is to refresh against current main and repeat the focused proof rather than broaden the design or add a fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a5c8c5b3ecc5. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review — The PR body now contains exact-head, inspectable verdict JSON from three passing real ephemeral-Gateway/channel restart-and-next-message scenarios (including the message markers), plus the full green hosted CI run. Baseline and candidate both independently hit the same unrelated subagent-fanout timeout in an optional broader parity sweep. Real-user Telegram Desktop proof for repeated restart recovery is already queued at https://github.com/openclaw/openclaw/actions/runs/30617945325 and will publish its recording to this PR. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
ClawSweeper rank-up moves reviewed before landing: (1) Not rebasing solely for behind-main drift: the current main delta has zero overlap with all seven PR files, GitHub reports MERGEABLE, the only scripts/ drift is unrelated |
|
Merged via squash.
|
* origin/main: (1976 commits) fix(ollama): models advertise tools when /api/show fails (openclaw#109971) fix(ollama): use CJK-aware char estimate for usage fallback (openclaw#110073) fix(ollama): release failed setup response bodies before returning (openclaw#111802) feat(plugins): externalize Synthetic provider (openclaw#116720) fix(agents): unblock channel turns after restart recovery (openclaw#116728) fix(telegram): keep typing alive during active steered tasks (openclaw#116721) fix(gateway): admit standalone MCP app work (openclaw#116727) fix(googlechat): record canonical receipt thread (openclaw#116717) test(ui): cover the Talk relay start-stop race fix(ui): close superseded Talk allocations fix(agents): resume interrupted turns past progress commentary (openclaw#116725) fix(gateway): sign device proofs with challenge time (openclaw#116679) fix(testing): load relay smoke through UI Vite config test(testing): guard realtime relay smoke module path fix(testing): repair realtime relay live smoke import test: type session request parameters (openclaw#116713) fix: retain event invalidation for pagination docs: note queued session refresh fix fix: preserve queued session refresh options fix(exec): require approval for abbreviated inline eval flags [AI] (openclaw#116529) ...
* commit 'refs/frozen/talk-pcm-output-main': (21 commits) fix(agents): compact session status change text (#116742) fix(llama-cpp): recover plaintext tool calls (#116736) fix(telegram): validate native queue arguments before fallback (#116726) chore(skills): add autonomous issue sweep workflow docs(auto-qa): require clean root-cause refactors fix(ollama): models advertise tools when /api/show fails (#109971) fix(ollama): use CJK-aware char estimate for usage fallback (#110073) fix(ollama): release failed setup response bodies before returning (#111802) feat(plugins): externalize Synthetic provider (#116720) fix(agents): unblock channel turns after restart recovery (#116728) fix(telegram): keep typing alive during active steered tasks (#116721) fix(gateway): admit standalone MCP app work (#116727) test(ui): cover the Talk relay start-stop race fix(ui): close superseded Talk allocations test(google): cover expired CLI OAuth compatibility docs(google): document supported auth paths fix(ui): clarify blocked inference setup fix(google): guide broken CLI profiles to supported auth fix(onboarding): hide unsupported Google CLI setup routes fix(google): retire Gemini CLI OAuth setup ...
Post-merge real Telegram proofExact landed commit: The protected live Telegram workflow executed 18 real Telegram scenarios twice against that exact commit: https://github.com/openclaw/openclaw/actions/runs/30619452176
The full protected workflow remains red exclusively because of those existing unrelated scenarios; the exact channel-delivery and recovery scenarios passed on the landed commit. |
* origin/main: (38 commits) fix(agents): compact session status change text (#116742) fix(llama-cpp): recover plaintext tool calls (#116736) fix(telegram): validate native queue arguments before fallback (#116726) chore(skills): add autonomous issue sweep workflow docs(auto-qa): require clean root-cause refactors fix(ollama): models advertise tools when /api/show fails (#109971) fix(ollama): use CJK-aware char estimate for usage fallback (#110073) fix(ollama): release failed setup response bodies before returning (#111802) feat(plugins): externalize Synthetic provider (#116720) fix(agents): unblock channel turns after restart recovery (#116728) fix(telegram): keep typing alive during active steered tasks (#116721) fix(gateway): admit standalone MCP app work (#116727) fix(googlechat): record canonical receipt thread (#116717) test(ui): cover the Talk relay start-stop race fix(ui): close superseded Talk allocations fix(agents): resume interrupted turns past progress commentary (#116725) fix(gateway): sign device proofs with challenge time (#116679) test(google): cover expired CLI OAuth compatibility fix(testing): load relay smoke through UI Vite config test(testing): guard realtime relay smoke module path ...
…16728) Co-authored-by: Peter Steinberger <[email protected]>
* commit 'refs/frozen/talk-pcm-output-main': (21 commits) fix(agents): compact session status change text (openclaw#116742) fix(llama-cpp): recover plaintext tool calls (openclaw#116736) fix(telegram): validate native queue arguments before fallback (openclaw#116726) chore(skills): add autonomous issue sweep workflow docs(auto-qa): require clean root-cause refactors fix(ollama): models advertise tools when /api/show fails (openclaw#109971) fix(ollama): use CJK-aware char estimate for usage fallback (openclaw#110073) fix(ollama): release failed setup response bodies before returning (openclaw#111802) feat(plugins): externalize Synthetic provider (openclaw#116720) fix(agents): unblock channel turns after restart recovery (openclaw#116728) fix(telegram): keep typing alive during active steered tasks (openclaw#116721) fix(gateway): admit standalone MCP app work (openclaw#116727) test(ui): cover the Talk relay start-stop race fix(ui): close superseded Talk allocations test(google): cover expired CLI OAuth compatibility docs(google): document supported auth paths fix(ui): clarify blocked inference setup fix(google): guide broken CLI profiles to supported auth fix(onboarding): hide unsupported Google CLI setup routes fix(google): retire Gemini CLI OAuth setup ...
* origin/main: (38 commits) fix(agents): compact session status change text (openclaw#116742) fix(llama-cpp): recover plaintext tool calls (openclaw#116736) fix(telegram): validate native queue arguments before fallback (openclaw#116726) chore(skills): add autonomous issue sweep workflow docs(auto-qa): require clean root-cause refactors fix(ollama): models advertise tools when /api/show fails (openclaw#109971) fix(ollama): use CJK-aware char estimate for usage fallback (openclaw#110073) fix(ollama): release failed setup response bodies before returning (openclaw#111802) feat(plugins): externalize Synthetic provider (openclaw#116720) fix(agents): unblock channel turns after restart recovery (openclaw#116728) fix(telegram): keep typing alive during active steered tasks (openclaw#116721) fix(gateway): admit standalone MCP app work (openclaw#116727) fix(googlechat): record canonical receipt thread (openclaw#116717) test(ui): cover the Talk relay start-stop race fix(ui): close superseded Talk allocations fix(agents): resume interrupted turns past progress commentary (openclaw#116725) fix(gateway): sign device proofs with challenge time (openclaw#116679) test(google): cover expired CLI OAuth compatibility fix(testing): load relay smoke through UI Vite config test(testing): guard realtime relay smoke module path ...
Closes #116694
What problem this solves
Fixes channel-backed main sessions that stop accepting new Telegram or heartbeat turns after repeated Gateway restarts, even though the resumed recovery run and Gateway remain healthy.
Root cause and fix
Recovery admission indexed lifecycle ownership by
(runId, lifecycleGeneration), while restart recovery already treated the run ID as the owner. A resumed run could therefore retain both its old and replacement lifecycle fences; when the current generation completed, its stale same-run fence survived and poisoned every subsequent turn withSession changed while starting work. Retry.Verification
codex-rs/app-server-protocol/src/protocol/v2/thread.rs:315-325,codex-rs/app-server/src/request_processors/thread_processor.rs:3074-3133, andcodex-rs/app-server/src/request_processors/turn_processor.rs:1418-1458.f1cd165075b60b730c1037732f963ee8eb9a84ed: 15/18 real Telegram scenarios passed in each attempt, including exact reply delivery and post-write recovery. The three failures exactly match earlier unchangedmainbaseline failures.User impact
Recovered channel conversations settle cleanly and accept subsequent messages instead of indefinitely retaining or retrying them.
Real Gateway/channel behavior proof
The exact PR head
38d9638da270f382e63010aa45a59f0075c32596passed the hosted QA Smoke profile against a real ephemeral Gateway and Matrix channel adapter: CI run 30617493014, profile 4/4.{ "head": "38d9638da270f382e63010aa45a59f0075c32596", "channel": "matrix", "gateway": "real ephemeral Gateway", "provider": "mock-openai", "passed": 3, "failed": 0, "scenarios": [ { "name": "Matrix room continues after restart recovery", "result": "pass", "observed": "MATRIX_QA_RESTART_FIRST_3F6AD5C0 -> restart -> MATRIX_QA_RESTART_SECOND_3E1FCF9C -> MATRIX_QA_RESTART_THIRD_20BA425D" }, { "name": "Matrix restart replay dedupe", "result": "pass", "observed": "MATRIX_QA_REPLAY_DEDUPE_61E78FBB -> restart -> MATRIX_QA_REPLAY_DEDUPE_FRESH_CAE198CC" }, { "name": "Matrix lane resumes after Gateway restart", "result": "pass", "observed": "MATRIX_QA_RESTART_BEFORE_CC49D99C -> restart -> MATRIX_QA_RESTART_AFTER_7BFCBF59" } ] }Post-merge real Telegram proof: protected live run 30619452176. Both attempts passed 15 scenarios, including
telegram-reply-chain-exact-marker(QA-TELEGRAM-REPLY-CHAIN-OK) andtelegram-empty-response-after-write-recovery(TELEGRAM-EMPTY-WRITE-RECOVERED-OK;requests=3 writes=1 continuations=1). The overall batch remains red because the same three unrelated scenarios also failed against earlier main baseline:channel-message-flows,native-command-session-target, andtelegram-assistant-transcript-role-boundary.Optional Mantis Desktop visual recording could not run its requested restart sequence because the burner Telegram user lacks Gateway-restart permission; no product failure was observed. The optional broader parity run independently hit the same unrelated
subagent-fanout-synthesis30-second timeout on both unchanged baseline and candidate; the PR's complete required hosted CI remains green.