Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 19, 2026, 7:55 PM ET / 23:55 UTC. ClawSweeper reviewWhat this changesThe PR changes device-identity migration cleanup to quarantine a receipt-mismatched retired JSON identity file rather than preserve it. Merge readinessThe prior P1 finding remains unresolved: this Doctor-oriented change also runs automatically during node-host startup, where it can rename divergent cryptographic identity material without an explicit startup-recovery decision. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherDevice identity migration imports a retired JSON identity into SQLite and records its digest. Doctor and node-host startup share that migration path before gateway identity validation, so cleanup affects both explicit recovery and normal startup. flowchart LR
A[Retired identity JSON] --> B[SQLite identity and receipt]
B --> C[Shared cleanup migrator]
H[Explicit Doctor] --> C
I[Node-host startup] --> C
C --> D{Digest matches receipt?}
D -->|yes| E[Remove retired file]
D -->|no| F[Quarantine backup]
E --> G[Gateway identity validation]
F --> G
Decision needed
Why: The shared migrator reaches both entry points, and the change affects cryptographic identity material and an existing fail-closed startup boundary. Before merge
Findings
Agent review detailsSecurityNeeds attention: The patch extends automatic handling of cryptographic identity material to node-host startup without an explicit startup-boundary decision. PR surfaceSource +12, Tests +10. Total +22 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep receipt-mismatch quarantine explicit to Doctor and add a startup regression proving a divergent identity remains fail-closed, unless the owner explicitly approves automatic startup recovery. Do we have a high-confidence way to reproduce the issue? Yes, from source: a completed receipt plus a different valid Is this the best way to solve the issue? No. The explicit Doctor recovery is well targeted, but the shared implementation also changes normal startup; it needs an authority gate or explicit owner approval. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c5fd6252a7d9. LabelsLabel justifications:
EvidenceSecurity concerns:
What 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 (1 earlier review cycle)
|
|
Thanks for tracking down the upgrade symptom and collecting Doctor evidence. Deep review shows that the reported outage was already fixed by #120610 (commit d9ff862), which this branch already contains: canonical SQLite identities are authoritative even when divergent legacy identity files reappear, with both TypeScript and OpenClawKit regression coverage. The additional quarantine change is not safe to land as written. Its shared receipt-cleanup path also runs during ordinary node-host startup, which currently passes the same Correcting those authority and identity-verification boundaries would be a separate security-hardening change, not the already-fixed P1 upgrade repair. Closing this proposal as superseded by #120610 rather than introducing an automatic identity-quarantine path. |
|
Agreed the quarantine patch shouldn't land as written — the two authority findings are correct ( But the supersede claim doesn't hold: the outage class is not fixed by #120610, and I reproduced it on a build containing d9ff862. On 2026-08-19 at 11:03 my gateway crash-looped running the dist deployed 2026-08-18 from base The failing path is not the identity loader #120610 fixed. It is the startup readiness gate: #120610 changed only the identity loaders ( Given #120610 already makes the canonical row authoritative, I think the canonical fix is in the gate's classification, not file quarantine: a preserved divergent retired file with a completed receipt and a valid canonical identity is a recorded, non-fatal condition (surface it in doctor/status), not a readiness blocker. Happy to update this to that approach — or send it as a follow-up PR — but the unrecoverable-loop class is reproducible on current |
|
Closing as superseded by #120610, which already fixes the reported upgrade blocker. The proposed quarantine additionally risks moving cryptographic identity material during ordinary startup without verifying that the canonical SQLite identity exists and matches; detailed maintainer findings are recorded above. Thanks for the investigation. |
Fixes #117270
What Problem This Solves
A divergent retired device identity JSON can conflict with its SQLite migration receipt. The gateway correctly fails closed, but Doctor previously preserved the file and left startup in a crash-loop.
Why This Change Was Made
Doctor now quarantines a valid retired identity file whose bytes differ from the receipt, preserving the evidence while removing the legacy runtime blocker. The runtime fail-closed check remains unchanged.
User Impact
openclaw doctor --fix can repair this post-migration legacy-file conflict without an operator manually renaming the identity file.
Evidence
Regression proof: against pre-fix 84c2111, the new device-identity migration test failed at src/infra/state-migrations.device-identity.test.ts:725, expect(retry.warnings).toEqual([]). The received warning was Retired device identity cleanup preserved ... bytes differ from the migration receipt, confirming that the divergent legacy file was only preserved and therefore still triggered the runtime fail-closed startup guard.
Changed-surface gates passed:
Isolated Doctor CLI proof, using the branch build with a throwaway OPENCLAW_STATE_DIR: Doctor first imported a valid legacy identity to SQLite, then a different valid device.json was introduced. A second node dist/index.js doctor --fix --non-interactive reported Quarantined retired device identity JSON that differs from its SQLite receipt; identity/device.json was absent afterward and the divergent bytes were renamed to device.json.doctor-quarantine-.bak. No live state directory or operator backup file was touched.
Deployed live validation (2026-08-19)
oc-update --skip-codexcompleted successfully on base61416e12542043e521de471a1f804fd1cbb7650a; its overlay log records both #126413 and #126414 as applied. The managed service reachedactive/runningwithNRestarts=0.Live validation did not pass. After the deploy doctor/restart sequence, the local state SQLite integrity check reported corruption in the delivery queue table. The Gateway process remained up but closed the read-only RPC connection during authentication, so no safe cron turn or admission-ledger probe could be completed. No repair, restart, retry, or data mutation was attempted after this observation.
For #126414, the operator-approved reproduction copied the existing retired artifact to
identity/device.jsonwhile retaining the original.stray-aug1-identity.bak.openclaw doctor --fix --non-interactivedid not emitQuarantined retired device identity JSON that differs from its SQLite receipt.and left the copied file in place. Per the validation contract, the copied file was then removed recoverably and no other identity file was edited. The canonical SQLite identity prefix was unchanged before and after (5a69fa71143b). This is a failed live validation, not a warning-preserve pass.Post-restore result (same day): PASS
The earlier failed run above had two causes unrelated to this fix: a recurrence of this host's known WAL-reset SQLite corruption (state DB restored from the updater's pre-deploy snapshot), and doctor being invoked while the running Gateway owned the state directory — the migration lock correctly refused with "Stop the Gateway and run
openclaw doctor --fixagain". With the Gateway stopped, the validation passed using the real artifact:identity/device.json.openclaw doctor --fix --non-interactive(offline) emittedQuarantined retired device identity JSON that differs from its SQLite receipt.and renamed the file todevice.json.doctor-quarantine-1787174079477.bak; the preserved original backup and the canonical SQLite identity (prefix5a69fa71) were untouched.Runtime: running,Connectivity probe: ok).