Repository navigation
fix(gateway): avoid repeated channel restarts after deferred thaw recovery - #186077
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
@clawsweeper re-review Please review current head |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR captures channel account lifetimes before thaw recovery is deferred and skips replacements recovered by another owner. Example: Health monitoring replaces discord/first while thaw recovery waits for active work to finish.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses a duplicate-restart path still present on main, and inspection found no actionable code defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherGateway maintenance detects host timing gaps and waits for idle work; the channel manager owns account lifetimes, transport teardown, and replacement startup. flowchart TD
A[Host timing gap] --> B[Capture account lifetimes]
B --> C[Pending maintenance targets]
C --> D[Idle admission check]
D --> E[Conditional account restart]
E --> F[Channel transport]
G[Health monitor recovery] --> F
G --> E
Technical reviewBest possible solution: Keep thaw targets in maintenance and let the existing account-lifecycle owner conditionally replace only the captured lifetime. Do we have a high-confidence way to reproduce the issue? Current-main source shows that recovery deferred behind active work later selects or restarts accounts without lifetime identity, allowing a health-recovered replacement to be restarted again; no product reproduction was run during this read-only review. Is this the best way to solve the issue? The change repairs selection timing and conditional replacement at the existing owners, removes the competing core-runtime target list, and preserves the established cleanup and admission contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f76e79be6a8f. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +80, Tests +287, Other 0. Total +367 across 16 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (5 earlier review cycles)
Reviewed October 27, 2026, 10:22 PM ET / October 28, 2026, 02:22 UTC (Revision 6). |
|
@clawsweeper re-review Please review current head |
|
🦞👀 Re-review progress:
|
Baseline-Refresh: 89870580a45169933124aca3d7164370d5578833
Baseline-Refresh: 043cb915c08ebf34eae45ac6d5afca3c72607be1
|
@clawsweeper re-review Please review current head |
|
🦞👀 Re-review progress:
|
Baseline-Refresh: c46cbc1ca7b96fb2c69eca170804909b64d480b5
|
@clawsweeper re-review Please review current head |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…overy (openclaw#186077) * fix(gateway): preserve recovered channels during deferred thaw recovery * fix(gateway): isolate account lifetime contracts and align regressions * fix(gateway): isolate private channel runtime store contracts * test(gateway): budget distinct thaw lifecycle regressions * test(gateway): align thaw regression budget with pinned main * test(gateway): reserve the reviewed recovery regression budget
What Problem This Solves
Fixes channels being restarted twice when host-thaw recovery waits for active work and health monitoring recovers them first.
User Impact
Accounts recovered by another owner stay online. Accounts still affected by the original timing gap continue through the existing bounded recovery window. No configuration or operator action changes.
Why This Change Was Made
Capture each affected account lifetime when the timing gap is detected, before active-work deferral. The account lifecycle owner conditionally stops and replaces only that captured lifetime, checking ownership again after awaited teardown. Maintenance owns the pending targets and deadline; the separate core-runtime target list and retry-selection mode are removed.
Manual stops, account removal, incomplete cleanup retries, and account-specific failure diagnostics remain intact. Shared lifecycle contracts stay separate from the manager's private runtime store, avoiding an import cycle.
Production delta: +240/-165 (net +75). The growth supplies the conditional lifetime-replacement boundary and its connected contracts; tests add 292 net lines.
Evidence
git diff --check, and the native line-cap ratchet passed for the authored fix.8793a69450f42e58b04440fe31004d9e506a473d. The runtime shard passed channel-manager 93, account-lifetime 11, work-scope 1, maintenance 36, and telemetry 9. Ordinary CI completed successfully: 42 checks passed, 27 skipped, none failed. The exact-head hosted review at 02:22 UTC on October 28 found no actionable finding or remaining rank-up move.2262f3d2d82c8743dcda1087032e57e60db890a2. Only the test-budget conflict was resolved, retaining the same ceiling; all 15 authored Gateway blobs and the production/test diff remain identical to the prior tested candidate. Current-head CI covers the integrated candidate; this does not claim unchanged dependency context.Local dependency qualification refused reuse. Focused remote thaw attempts queued and were stopped before payload execution. Baseline-red/head-green, isolated full-Gateway, and live Telegram recovery proof remain unverified; the regressions use real maintenance, scheduler and account-lifecycle owners. No live-channel success is claimed.
Test-Budget Justification
Pinned main
2262f3d2d82c8743dcda1087032e57e60db890a2contains 6,293,974 counted test lines, independently verified from the ratchet's exact filename patterns and literal newline counts: 58 changed matching blobs add 737 lines to the previously verified 6,293,237. Its existing ceiling is 6,293,776.The reviewed recovery fixes add this PR's 292 lines, the separate Telegram disconnect-episode fix's 241, and the separate health-admission fix's 235: 6,294,742 combined. The ceiling is 6,295,000, with 258 disclosed lines of slack. This follows the documented ratchet policy and merged rounded-allowance precedent. Both follow-ups reuse this allowance.
The separate test-budget allocation PR is pending landing. It sets this same ceiling on main to resolve the shared-file conflict while preserving this PR's reviewed head.
Separate Follow-ups
Telegram transport retry status owns its disconnect episode. Health monitoring must refresh each account's status after awaiting an earlier account. Those are separate narrow fixes; this PR repairs deferred outer account replacement.