Repository navigation
fix(doctor): surface unreadable legacy plugin state instead of silently skipping migration - #130956
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
…ly skipping migration Preserve missing-source and intentional parser-null skips while forwarding other read and JSON parse errors to the existing Doctor warning boundaries. Keep plugin import, archive, and persistence behavior unchanged.
ee35c1e to
26b6e6f
Compare
|
Codex review: found issues before merge. Reviewed August 27, 2026, 10:56 AM ET / 14:56 UTC. ClawSweeper reviewWhat this changesThe PR changes the shared legacy JSON plugin-state migration helper so missing files skip cleanly while other read and JSON errors become Doctor warnings, with regression coverage and SDK migration documentation. Merge readinessKeep open: the intended owner-level fix is close, but its catch block still silently treats a plugin parser exception with Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherOpenClaw Doctor detects and imports legacy plugin-owned JSON state into the current plugin-state store. The shared helper reads a legacy file, then Doctor either presents migration work or records an operator-visible warning. flowchart LR
A[Legacy plugin JSON] --> B[Shared migration helper]
B --> C{Missing source?}
C -->|Yes| D[Clean skip]
C -->|No or parser error| E[Doctor warning boundary]
E --> F[Operator fixes and retries]
B --> G[Plugin state import]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +4, Tests +134, Docs +5. Total +143 across 3 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Make source absence a filesystem-read-only decision, leaving JSON and plugin-parser exceptions to the established Doctor warning boundaries. Do we have a high-confidence way to reproduce the issue? Yes, by source: a parser callback can throw an errno-shaped ENOENT within the proposed combined try block, which is then returned as a clean skip instead of reaching Doctor’s warning collector. Is this the best way to solve the issue? No. The proposed propagation is the right owner boundary, but the ENOENT branch must be scoped to Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against dd2d66c26f16. 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
|
|
Merged via squash.
|
…ly skipping migration (openclaw#130956) Preserve missing-source and intentional parser-null skips while forwarding other read and JSON parse errors to the existing Doctor warning boundaries. Keep plugin import, archive, and persistence behavior unchanged.
What Problem This Solves
The shared plugin migration helper
defineLegacyJsonStateMigration(src/plugin-sdk/runtime-doctor-migrations.ts:324-355) converted every read, JSON-parse, and plugin-parser exception intonull— includingEACCESand transient I/O errors. Detection then reported "no migration", and direct migration returned empty changes/warnings. The caller boundaries that already convert thrown detector failures into visible Doctor warnings (src/infra/state-migrations.doctor.ts:253-268,:951-973) never saw the error.Consequence (probed with injected EACCES pre-fix:
{"detected":null,"migrated":{"changes":[],"warnings":[]}}): an unreadable legacy Active Memorysession-toggles.jsonsilently vanishes fromdoctor --fix— no warning, no migration — and runtime treats the absent opt-outs as enabled (extensions/active-memory/session-policy.ts:31-43). Device Pair notification subscriptions share the helper. This is the silent-failure class: an action ends with neither a visible outcome nor a recorded non-outcome.The core sibling already does this right:
src/infra/state-migrations.runtime-state.ts:69-75reports both read and JSON-syntax failures.Why This Change Was Made
Minimal owner-level distinction instead of a new warning channel:
ENOENT(source legitimately absent) still yieldsnull/clean skip, and intentional parsernullstill skips migration — every other exception now propagates unchanged to the existing Doctor warning boundaries, which do their established job. Public signature, row selection, imports, archive, and persistence behavior are unchanged. The SDK migration doc gains the absence-vs-error distinction.User Impact
openclaw doctornow tells the operator when legacy plugin state exists but cannot be read or parsed, instead of silently pretending there is nothing to migrate — protecting Active Memory session opt-outs and Device Pair notification subscriptions from disappearing without a trace.Evidence
src/infra/state-migrations.legacy-json.test.ts, +134 lines): pre-fix 6 failed / 4 passed (EACCES, EIO, malformed JSON each silent in detection and direct migration; ENOENT and parser-null controls passed); post-fix 10 passed. Assertions exercise the real Doctor warning boundaries and verify source preservation with no archive.check-changed: all guards, formatting, SDK surface checks, dead-export scans, four typecheck stages green; one lint finding in the new test itself (no-base-to-string) fixed by using direct path equality; targeted lint re-run exit 0; remaining repo guards (import cycles, database-first, pairing, webhook order) all green.--mode uncommitted), both passes: no findings; reviewer confirmed absence/parser-null skips, both warning boundaries, and unchanged persistence/archive/signature behavior.src/plugins/doctor-state-migration-fs.ts:5-12suppresses stat errors inlegacyStateFileExists— separate audit scope.