refactor: store gateway restart recovery in SQLite#110014
Conversation
9a626ab to
6b29d3c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a626abcaa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
6b29d3c to
c7714f4
Compare
|
Codex review: found issues before merge. Reviewed July 17, 2026, 10:45 AM ET / 14:45 UTC. Summary PR surface: Source +1319, Tests +811, Docs +12, Other +56. Total +2198 across 24 files. Reproducibility: yes. at source level. Let startup outbound recovery complete before a restart notice fails to reproduce the retry gap; for the migration gap, leave only Review metrics: 2 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the SQLite-only runtime and single bounded legacy importer, but add the legacy sentinel and claim suffix to the fast migration detector, explicitly schedule or perform bounded recovery after a newly failed restart notice, and cover both paths with focused upgrade and post-startup-failure tests. Do we have a high-confidence way to reproduce the issue? Yes at source level. Let startup outbound recovery complete before a restart notice fails to reproduce the retry gap; for the migration gap, leave only Is this the best way to solve the issue? No, not yet. SQLite ownership and bounded migration are the correct architecture, but the implementation must preserve the existing bounded notice retry and ensure every guarded read detects the legacy source. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2c1c5b3a97a3. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1319, Tests +811, Docs +12, Other +56. Total +2198 across 24 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8dc30a72a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
b8dc30a to
acc33ba
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 513f28af35
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Merged via squash.
|
* refactor: move restart sentinel state to sqlite * fix: satisfy restart sentinel architecture gates * test: avoid cold startup migration timeout * fix: bound durable restart notice retries * test: type restart notice contention mock * fix: detect legacy restart sentinel before reads * fix: keep delivery attempt result internal * fix: narrow restart sentinel preflight guard
What Problem This Solves
Gateway restart recovery was still persisted as a JSON sidecar. That left OpenClaw-owned runtime state outside the canonical database and created crash windows between consuming a restart intent and durably recording its wake, continuation, or outbound delivery work.
Why This Change Was Made
This moves restart-sentinel ownership fully into the shared SQLite state database. Runtime code reads and writes only typed SQLite columns; startup and
openclaw doctor --fixown the bounded legacy JSON import. Revision fences, a durable revision floor, permanent delivery receipts, and atomic delivery-attempt reservations make consumption and retry replay-safe without dual reads, dual writes, or file fallbacks. Existing schema tables are reused, so this does not bump the state schema version.User Impact
Normal restart behavior stays the same. Upgrades preserve valid pending restart recovery, malformed transient legacy state is safely retired, and a crash during recovery no longer loses work, duplicates a completed delivery, or lets a stale consumer erase a newer restart intent. Restart notices retry in-process with a durable 45-attempt ceiling. Wake, continuation, notice, and outbound delivery ownership remain durable across replay.
Evidence
QA-RESTART-6ce38444,QA-RESTART-72274559).git diff --checkproof is clean. Exact-head hosted CI passed for8ccf13419f39f99ad1f30b10b977ad22e9a21970, includingopenclaw/ci-gate: https://github.com/openclaw/openclaw/actions/runs/29596380838/attempts/2AI-assisted. I reviewed the design and implementation and understand the migration, queue ownership, and crash-recovery invariants.