Repository navigation
fix: unblock agent sessions after a Gateway owner dies - #188409
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: blocked before merge. What this changesThis PR admits matching dead-owner agent databases with QUICK verification and preserves that distinct receipt across clean restarts. Example: A Linux Gateway dies while opening an existing 35 GB agent database.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: it addresses a concrete restart outage, preserves existing ownership checks, and has no identified code defect. Priority: P1 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe agent database opener combines shared-state leases, physical-file provenance, schema validation, and integrity checks before exposing SQLite-backed session operations; clean-close seals preserve completed validation facts. flowchart TD
A[Gateway or native worker] --> B[Agent database opener]
B --> C[Lease and provenance owner]
C --> D[Integrity and schema admission]
D --> E[Writable agent sessions]
E --> F[Checkpoint and clean close]
F --> G[Validation seal]
G --> D
Technical reviewBest possible solution: Keep recovery in the existing lease, admission, and seal owners, with provenance-bound QUICK checks, retained FULL refusals, and distinct recovery receipts. Do we have a high-confidence way to reproduce the issue? Current-main source forces the full gate after stale-owner invalidation, and the supplied regression reports failing-before/passing-after native-worker execution; this review ran no target code. Is this the best way to solve the issue? The change uses the existing owners and adds only the recovery classification, pending FULL status, and distinct seal fact needed to prevent the outage from recurring on the following clean restart. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 66004e076d4d. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +65, Tests 0, Docs +15. Total +80 across 10 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 Reviewed October 30, 2026, 10:25 AM ET / 14:25 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
Recover matching dead Gateway owners with QUICK admission and carry a distinct recovery receipt across clean restarts. Preserve full verification for corruption evidence, unknown provenance and explicit full-check policies. Reviewed regression is base-red/fix-green. The documented inherited-CI exception covers five independently reproduced baseline assertions; CI is not reported green. Latest-stable update proof was explicitly waived by the requesting maintainer. Co-authored-by: steipete <[email protected]>
Backport 6614c50. Recover matching dead owners with QUICK admission and a distinct clean-close receipt. Preserve FULL checks for explicit policy and untrusted recovery. Co-authored-by: steipete <[email protected]> Co-authored-by: RomneyDa <[email protected]>
Related: #183052, #182984
What Problem This Solves
Fixes agent sessions remaining unavailable for a full database integrity scan after the previous Gateway owner dies, including during startup admission. Two healthy 35 GB Team database opens blocked sessions for 15 and 21.6 minutes.
User Impact
A matching dead-owner lease on Linux now takes QUICK admission, including after interrupted startup. A subsequent successful checkpoint and clean stop seal that QUICK receipt, so the following ordinary restart also avoids the full scan. Revoked validation, dirty receipts without matching dead-owner provenance, replaced files, prior corruption, live peers, and explicit maintenance policies retain full verification or refusal. Known FULL requirements survive interrupted verification in the existing lease status. Failed recovery QUICK checks fall back to FULL. No configuration or database schema migration is needed.
QUICK omits full index consistency checking. Its receipt remains distinct from FULL. Seal identity, journal, expiration, final-close, and refusal checks remain in effect; normal SQLite access, Doctor, and later full verification retain corruption detection.
Why This Change Was Made
SQLite WAL recovery preserves committed writes after process death. Treat matching dead-owner provenance as process death instead of corruption evidence, and recheck provenance after opening the file. The existing admission facts and clean-close seal owner carry a distinct successful recovery-QUICK receipt across clean restarts. Ordinary maintenance QUICK checks never mint that receipt. This avoids moving the outage to the next deploy and adds no background-check owner or persistent store.
Evidence
623776c93bd(replayed after rebase as89edda72c85): after QUICK admission and clean close, reopening runs another full scan. With the receipt/seal fix, the extended regression passes.timeout 180s node scripts/run-vitest.mjs src/state/openclaw-agent-execution.integrity.test.ts --maxWorkers=1 -t 'quickly admits matching killed owners'. Exercises real SIGKILL, native worker admission, session creation, WAL preservation and rollback, interrupted admission, dirty receipts, provenance mismatch, failed QUICK falling back to FULL, and clean restart after retiring process proof. It verifies no extra scan and no false FULL receipt on restart.6f098f501e6959d7688334a781a91c6964e044a0before verification. All 174 tests across eight focused owner/consumer files passed in 122.25 s, including shared-state admission, seal rejection/expiration, ordinary QUICK/FULL policies, and native crash recovery. Final restart-regression replay passed after simplifying receipt publication. Targeted state/SQLite typecheck, changed-file lint/format, docs link audit (16,144 links; zero broken), andgit diff --checkpass. Broad checks ran in PR CI; the unrelated failures and landing blocker are recorded below.6f098f501e6959d7688334a781a91c6964e044a0received scoped-clean P0–P2 autoreview with full admission/seal context. The review finding about interrupted known-FULL checks is fixed and covered by lease-status tests; earlier index-only findings were resolved by staging the complete candidate. Static review is separate from executed tests.6f098f501e6959d7688334a781a91c6964e044a0; their focused expectation repair is separately owned by fix(ci): repair deterministic scheduled full-CI failures #188398. All three refusal-product copy expectations (bio, cyber, misalignment) also reproduce on that baseline. The completed misalignment-only replay failed at the same terminal assertion (1 failed, 3 skipped, 87.78 s total): detailed review text was expected, but the generic failure summary was received. This completes the earlier timed-out baseline gap. The reproduction baseline has no R1 patch; inspected test, fixture, replay and copy-owner inputs also match the CI main parent and tested merge. Native inherited-failure evidence is prepared; these results remain failed CI.9e51e0fbdc09ceccbc601084404a8a0dcd7c200efound no actionable code defect and requests latest-stable-to-candidate data compatibility proof. The repository commandpnpm test:docker:published-upgrade-survivorwas submitted through the OpenClaw Crabbox wrapper to the configured Blacksmith Testbox provider. Allocationtbx_01m66mtjfgn692yqcm06kapjp3queued and was stopped without running the upgrade payload; run 41075675938 is cancelled, and cleanup reconciliation succeeded. The requesting maintainer explicitly waived the outstanding latest-stable upgrade proof on 2026-10-30. That upgrade remains unproven; no successful upgrade result is claimed. No live Team restart or 35 GB timing benchmark was performed.6614c50b2de7through the native inherited-failure exception after explicit investigated cancellation and native confirmation of retirement of the old auto-merge request. All five failing assertions retain baseline attribution; CI is not reported green. The requesting maintainer explicitly waived latest-stable upgrade proof. The landed tree was independently reconstructed from the actual landing parent and reviewed head and matched exactly.Requested by @steipete.
Work sessions