Repository navigation
fix(doctor): allow repair with retained deleted-agent sessions - #155752
Conversation
Use recorded deletion ownership during automatic session import and startup readiness. Retained owners remain part of shared-source ownership matching without demanding import receipts; live and unknown sources keep their existing integrity checks. Preserve orphaned SQLite families when shared history is missing, while admitting fresh file-only imports. Explicit selection and recovery behavior stays unchanged. Follow up on e99e75e.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 12:12 PM ET / 16:12 UTC (Revision 3). ClawSweeper reviewWhat this changesDoctor and startup readiness recognize retained deleted-agent session history, while automatic imports preserve orphaned SQLite files. Merge readiness✅ Ready for maintainer review This remains a useful repair: current main still rejects intentionally retained legacy sessions, and the reviewed patch has no identified blocking defects. Priority: P1 Review scores
Verification
How this fits togetherDoctor migrates legacy session files into OpenClaw’s SQLite stores, and startup checks whether that migration is complete. Recorded agent deletions distinguish intentionally retained history from live history that still requires verified import. flowchart TD
A[Legacy session files] --> C[Doctor target discovery]
B[Recorded deletions and owners] --> C
C --> D[Import live history]
C --> E[Preserve retained history]
D --> F[Readiness checks]
B --> F
F --> G[Complete repair or report refusal]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +51, Tests +241. Total +292 across 6 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Use the existing deletion owner consistently so retained history stays untouched and live history still requires verified migration. Do we have a high-confidence way to reproduce the issue? Yes, from source: retain a deleted agent’s legacy session files and reach Doctor’s final readiness check; current main still demands their import receipt. The body reports matching failing controls, but this review did not execute them. Is this the best way to solve the issue? Yes. Reusing the existing deletion classifier repairs the readiness mismatch without introducing a second retention policy or weakening live-source verification. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against dd0003ac5c52. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
* commit 'f3327bde3c6052a4ed6d487bb09fbe1e11c0cd35': (25 commits) fix(test): pass the fixture lifetime to launcher fixtures (#155825) fix(test): prepare history benchmark before child deadlines (#155780) refactor(config): derive tool contracts from schemas (#155484) chore(deps): update fs-safe to 0.18.1 (#155771) fix(doctor): allow repair with retained deleted-agent sessions (#155752) fix(setup): await inference probe cleanup (#155407) fix(mcp): recover expired SSE sessions and speed up parsing (#155497) fix(release): forward the stable soak waiver through the candidate helper (#155798) feat: calibrate Gateway plugin resources through retirement (#155792) fix: preserve the invoked launcher when restarting Node (#147621) fix(sessions): stop repeated failed worker exit cleanup (#154720) fix(ui): preserve active replies and tools after failed steering (#155746) fix(ci): retain missing-load-path baseline diagnostics (#154861) fix(gateway): keep session lists responsive during activity updates (#155767) fix: keep plugin queues bound to their selected session (#155714) chore(i18n): refresh native locales (#155571) fix(ci): wait for reset hook entry and join fixture cleanup (#155770) test: move subagent fixtures to module boundaries (#155727) fix(gateway): retain question requester authority through settlement (#155335) perf(gateway): move progress-card reads off the main thread (#153857) ...
…law#155752) * fix(doctor): allow repair with retained deleted-agent sessions Use recorded deletion ownership during automatic session import and startup readiness. Retained owners remain part of shared-source ownership matching without demanding import receipts; live and unknown sources keep their existing integrity checks. Preserve orphaned SQLite families when shared history is missing, while admitting fresh file-only imports. Explicit selection and recovery behavior stays unchanged. Follow up on 2a74f33. * chore: sync main after canonical memory fixture repair Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes Doctor and update finalization failing when a deleted agent intentionally retains legacy session files.
User Impact
Doctor can finish repair without importing or changing the deleted agent’s retained history. Live shared-store history still requires a verified import, and unknown ownership, changed sources, and empty shared indexes retain their existing refusal rules. Automatic imports also preserve orphaned SQLite history instead of treating it as a fresh installation.
Why This Change Was Made
The existing deletion classifier now guides both automatic session discovery and startup readiness. Held owners stay in shared-source ownership checks, while only positively recorded retained ownership can waive an import receipt. Whole-file exemptions require an authored per-agent path; explicit store, agent, restore, and recovery behavior stays unchanged. No schema or configuration migration is added.
Related: e99e75e.
Evidence
infraandcommands-doctortest type graphs, scoped lint, formatting, whitespace, and native-schema guard pass. Independent P0–P2 review is clean.--maxWorkers=1: targets 23.98 seconds (11 cases), retained-agent migration 37.48 seconds (8), deferred-plugin sources 74.40 seconds (35). Hosted CI reports the same four new cases at 2.799 seconds combined, including 2.702 seconds for the mixed-source import. These are reported case times, separate from command wall times.The required refreshed-package check also passed on
dbb4bad9(treed84ec7e0): the unmodified published 2026.9.5 updater ran first and completed in 47.717 seconds, then a fresh installed Doctor run exited successfully. Shared state reached schema 18, the active agent reached schema 23 with its session and two transcript events, and retained schema-21 database/legacy-file bytes, inodes, links, deletion journal, registry row, and sidecars remained unchanged. Comparing 12,694 package members confirmed that the canonical first-hop fixture changed only the three permitted version/inventory metadata members; product code and dependencies were unchanged. This covers the updater lifecycle changes inherited from main in isolated Linux/npm state, without a managed-service restart or model API calls.CI Follow-Up
Refreshed CI run 35748106310 passed on
dbb4bad9: 121 successful jobs, 16 skipped, no failures. The native review and exact-head ClawSweeper review are also clean.The original CI run on
788b819c(35735766610) finished with 120 successful jobs, 16 skipped jobs, two failing test shards, and the failed aggregate gate. Both failing tests and their production owners were inherited unchanged from the main commit used by that CI run.5c9d100c), which synchronizes with the retrieval worker and verifies both reads complete before releasing the pending repair. This branch incorporates that main commit without another memory patch.ConfigWritePostCommitError: the managed runtime environment generation changed during post-write validation, and the file was rolled back. One passive Linux/Node 24.19.0 observation replayed all 79 cases in the original order with unchanged assertions, deadlines, and production code. All passed in 213.79 seconds (217.14 seconds including the runner); the failing case took 2.231 seconds. Its trace showed no generation change before the write notification. This four-core replay does not reproduce the historical two-core CI failure or establish a fix. The writer's generation, approval, and rollback guards remain intact.