Repository navigation
fix(cli): keep gateway calls and diagnostics read-only - #125178
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 6:56 AM ET / 10:56 UTC. ClawSweeper reviewWhat this changesThe PR makes one-shot Gateway CLI calls, required status probes, and diagnostic exports avoid creating or mutating shared SQLite state. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessNo blocking patch defect found. This maintainer-owned state-safety repair should remain open until exact-head checks complete. Priority: P2 Review scores
Verification
How this fits togetherGateway CLI diagnostics resolve startup, credentials, and a client connection before querying a running Gateway. These paths should return health and connectivity information without entering the shared SQLite write lifecycle. flowchart LR
A[CLI diagnostic command] --> B[Startup policy]
B --> C[Gateway client lifecycle]
C --> D[Read-only identity and token lookup]
D --> E[Running Gateway]
E --> F[Status or diagnostic output]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -4, Tests +247. Total +243 across 18 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: Land after exact-head CI confirms that authentication, status snapshots, and diagnostics remain available while absent and existing SQLite artifacts remain unchanged. Do we have a high-confidence way to reproduce the issue? Yes—source and the added process harness define a high-confidence path: run reachable calls, required status RPCs, and diagnostics export with absent or seeded state and compare artifacts before and after. Is this the best way to solve the issue? Yes—the patch carries read-only mode through the shared Gateway call, client, and probe boundaries rather than suppressing diagnostics or adding downstream cleanup. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8cae198210de. 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 (4 earlier review cycles)
|
8fabe2d to
f941c3d
Compare
|
Land-ready proof for
|
f941c3d to
a36a1d6
Compare
a36a1d6 to
5748fa1
Compare
|
Merged via squash.
|
* 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 #125102
What Problem This Solves
Fixes three remaining cases where one-shot Gateway diagnostics could touch shared SQLite state even though the command only reads or calls the running Gateway:
gateway callcould run observing startup/config work before reaching the read-only transport;gateway diagnostics exportcould initialize SQLite during startup, while its generic connectivity probe also used writable identity and token readers.gateway status --require-rpcmade a writable status call before its read-only connectivity probe.This could create or change
openclaw.sqlite, WAL, and SHM artifacts during ordinary diagnostics.Why This Change Was Made
Direct Gateway RPC commands now share one validation-only startup policy, while the diagnostics command group owns one corrupt-config-safe cold policy. Generic Gateway probes enforce their existing non-mutating contract with read-only identity/token access and a read-only client lifecycle, and the required status RPC now carries that same lifecycle mode. This preserves the status connectivity snapshot rather than disabling it.
The cleanup also removes the duplicate
loadDeviceIdentityIfPresentReadOnlyAPI; the canonicalloadDeviceIdentityIfPresentalready provides the same non-creating, artifact-preserving behavior. Internal helper names now state the read-only and non-observing boundaries directly.User Impact
Operators can run raw Gateway calls, required status probes, and diagnostics exports without the CLI joining the Gateway's SQLite write lifecycle. Reachable explicit and stored authentication continue to work, diagnostics still records status and health snapshots, and existing shared-state bytes remain unchanged.
Evidence
probeGatewayuse canonical read-only identity/token readers plussharedStateMode: "read-only"preserved the connectivity snapshot and made both export cases byte-identical.sharedStateMode: "read-only"; real-process cases prove both absent and seeded shared-state artifacts remain byte-identical after a successfulgateway status --require-rpc.node --import tsx scripts/check-env-var-count.mts --base origin/mainpassed at 501/501. The ratchet repair is owned by merged PR fix(ci): restore environment variable count ratchet #125185 and none of its budget/config/baseline files are included here.gateway restartvalidation policy; main already contained the identical preaction expectation, so Git dropped that redundant commit.node scripts/check-changed.mjspassed all selectedcoreandcoreTestsgates, including core/test typechecks, changed-file lint/format, dead-export scan, database-first guards, and import-cycle checks.pnpm buildpassed on the original owner-boundary patch with no ineffective dynamic-import failure; exact-head CI rebuilds the final sibling repair.gateway call healthsucceeded without state; invalid auth failed without state; diagnostics export produced status/health entries and no state when absent; export over existing unpaired state remained byte-identical and recorded the expected pairing-required snapshot. Stored-origin reachable success is covered by the real process fixture because live noninteractive pairing was unavailable to the source-blind validator.AI-assisted: yes. The maintainer inspected the owner boundaries, rejected broader performance/API abstractions, verified red phases, ran the final source-aware and built-product proof, and reviewed the complete diff.