Repository navigation
fix(cli): preserve shared state when gateway commands are offline - #125102
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 2:25 AM ET / 06:25 UTC. ClawSweeper reviewWhat this changesThe PR makes offline Gateway health, suspend, and resume commands validate configuration without observing state and use read-only shared-state access so they cannot alter Gateway SQLite files. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessNo blocking correctness findings. This maintainer-labeled PR is a focused extension of the shared-state ownership repair; likely related people: steipete (high confidence) and VACInc (medium confidence). Priority: P1 Review scores
Verification
How this fits togetherCLI Gateway commands validate local configuration, then connect to the Gateway over its RPC transport. The Gateway owns shared SQLite state, so a separate offline CLI process must not initialize identity, token, WAL, or SHM state before reporting a connection failure. flowchart LR
A[Operator CLI command] --> B[Startup policy]
B --> C[Non-observing config validation]
C --> D[Read-only Gateway transport]
D --> E{Gateway reachable?}
E -->|Yes| F[Gateway RPC result]
E -->|No| G[Connection error and unchanged state]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +13, Tests +103. Total +116 across 10 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one canonical read-only transport policy for one-shot Gateway RPCs and retain the process regression matrix proving offline commands preserve both absent and existing state artifacts. Do we have a high-confidence way to reproduce the issue? Yes. Current main exposes the observing configuration and writable transport paths, and the branch adds a concrete isolated offline-Gateway process matrix; this read-only review did not execute it. Is this the best way to solve the issue? Yes, with one compatibility check remaining. Repairing configuration and transport at their shared ownership boundaries is preferable to cleaning up artifacts afterward; verify the broader helper's device-auth behavior before merge. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2915e563d673. 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
|
|
Land-ready proof for
ClawSweeper rank-up move: skipped an additional reachable first-use device-auth live test. Stored device credentials are exercised through the shared read-only client owner and seeded-state proofs, and explicit token/password auth bypasses origin device-auth persistence. These one-shot read-only queries have no contract to create or rotate credentials. Proof gap: reachable first-use credential issuance was not live-tested; the change was verified through the real built CLI against an unreachable target plus exact-head CI. No ClawSweeper correctness finding remains; the reviewed head matches this exact SHA. |
|
Merged via squash.
|
Gateway health, suspend, and resume now preserve shared SQLite state when the target is unreachable. Related: openclaw#101290 Follow-up to openclaw#123674
Gateway health, suspend, and resume now preserve shared SQLite state when the target is unreachable. Related: openclaw#101290 Follow-up to openclaw#123674
* fix(cli): keep gateway diagnostics read-only Direct gateway calls and diagnostic probes now preserve shared SQLite ownership instead of creating or mutating state during read-only operations. Related: openclaw#101290 Follow-up to openclaw#125102 * fix(cli): keep required status probes read-only
Related: #101290
Follow-up to #123674
What Problem This Solves
Fixes an issue where operators running Gateway health, suspend, or resume commands against an unreachable Gateway could create or mutate the shared SQLite database before the connection failed. A clean isolated reproduction created
openclaw.sqlite, a 32 KiB SHM file, and roughly 1.7–2 MiB of WAL despite the target being offline.Why This Change Was Made
Gateway-owned suspension RPCs now use non-observing config validation, and all affected health and suspension transports use read-only shared-state access. Health fallback config reads also avoid plugin metadata observation. Process-level regressions cover root health, text and JSON Gateway health, suspend, and resume with both absent and pre-existing state.
User Impact
Health and cooperative suspension commands still report the normal connection failure when a Gateway is unreachable, but they no longer initialize or alter shared Gateway state. Existing database, WAL, and SHM bytes remain unchanged.
Evidence
fc677bcc3c26e058636fee24e366280cff17fd77: unreachable suspend created a 4 KiB database, 32 KiB SHM, and 1,730,432-byte WAL; root/Gateway health and resume reproduced the same class.src/cli/gateway-backed-exit.process.test.tsfailed 5 new cases while preserving the expected transport errors; each failure showed newly created SQLite/SHM/WAL artifacts.node scripts/check-changed.mjspassed all selected core/coreTests gates locally after remote workload routing was unavailable due provider capacity: core and test typechecks, changed-file lint/format, dead-export scan, database-first guards, import cycles, and boundary ratchets.dist/entry.js; absent state stayed absent and seeded shared-state inventories plus SHA-256 file digests remained byte-identical.AI-assisted: yes. The maintainer inspected the implementation, reproduced the failure, verified the regression red phase, and ran the final source-aware and source-blind proof.