Repository navigation
fix(acp): Doctor drops retained ACP metadata after archiving legacy session stores - #169759
Conversation
|
🦞👀 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: blocked before merge. What this changesThis PR imports retained ACP metadata from verified archives while preserving canonical session binding and replay protection. Example: The plugin becomes available after Doctor archives sessions.json containing agent:main:retained-acp with runtimeSessionName legacy-runtime.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep this maintainer-authored PR open: current main still skips archived ACP metadata, and the introduced patch has no actionable code findings. Priority: P1 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherDoctor converts legacy session files into agent SQLite and ACP metadata into shared SQLite; import receipts identify preserved archives and prevent historical metadata from replacing current session state. flowchart TD
A[Doctor session migration] --> B[Canonical import receipt]
B --> C[Verified legacy archive]
C --> D[ACP metadata importer]
D --> E[Canonical binding and completion checks]
E --> F[Shared SQLite ACP metadata]
Technical reviewBest possible solution: Land the receipt-owned archive reader and retained canonical binding once existing-state compatibility is demonstrated. Do we have a high-confidence way to reproduce the issue? Current-main source shows the missing-index skip after core archival, and the body reports a matching pre-fix regression failure; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch restores archive reading through the existing receipt owner and preserves transactional binding and completion checks rather than replaying historical metadata unconditionally. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 80f170ea263a. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +38, Tests +53. Total +91 across 6 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 12, 2026, 5:20 AM ET / 09:20 UTC (Revision 2). |
Doctor's ACP legacy metadata migration skipped any session store whose legacy index no longer existed. Once the deferred plugin resolved, core session import archived and removed sessions.json, so retained ACP metadata was never imported (silent loss of ACP session bindings for upgraders). Resolve the verified archived index from the canonical import receipt (retired custody included) and read it as preserved input. Keep the canonical no-replay binding in the ACP import reader after source retirement so an archived source cannot first-import into a replaced session. Forward-ports release fixes from release/2026.10.1: - 16398dc fix(acp): migrate metadata from retained sessions (via 9686536) - eff7e0b fix(release): preserve archived import bindings The pre-agent shared-store target from 16398dc is omitted: main retired pre-agent session migration (acfd767), so core import never archives that store. Pure moves of captureDeferredPluginSessionSources and resolveLegacyAcpMetadataSessionStoreTargets keep both owners under the line cap. Co-Authored-By: Claude Opus 5.5 <[email protected]>
9a9dea6 to
446367e
Compare
|
Merged via squash auto-merge.
|
…169759) Doctor's ACP legacy metadata migration skipped any session store whose legacy index no longer existed. Once the deferred plugin resolved, core session import archived and removed sessions.json, so retained ACP metadata was never imported (silent loss of ACP session bindings for upgraders). Resolve the verified archived index from the canonical import receipt (retired custody included) and read it as preserved input. Keep the canonical no-replay binding in the ACP import reader after source retirement so an archived source cannot first-import into a replaced session. Forward-ports release fixes from release/2026.10.1: - 16398dc fix(acp): migrate metadata from retained sessions (via 9686536) - eff7e0b fix(release): preserve archived import bindings The pre-agent shared-store target from 16398dc is omitted: main retired pre-agent session migration (acfd767), so core import never archives that store. Pure moves of captureDeferredPluginSessionSources and resolveLegacyAcpMetadataSessionStoreTargets keep both owners under the line cap. (cherry picked from commit 25f739c)
…penclaw#169759) Doctor's ACP legacy metadata migration skipped any session store whose legacy index no longer existed. Once the deferred plugin resolved, core session import archived and removed sessions.json, so retained ACP metadata was never imported (silent loss of ACP session bindings for upgraders). Resolve the verified archived index from the canonical import receipt (retired custody included) and read it as preserved input. Keep the canonical no-replay binding in the ACP import reader after source retirement so an archived source cannot first-import into a replaced session. Forward-ports release fixes from release/2026.10.1: - 16398dc fix(acp): migrate metadata from retained sessions (via 9686536) - eff7e0b fix(release): preserve archived import bindings The pre-agent shared-store target from 16398dc is omitted: main retired pre-agent session migration (0719b87), so core import never archives that store. Pure moves of captureDeferredPluginSessionSources and resolveLegacyAcpMetadataSessionStoreTargets keep both owners under the line cap.
Related: forward-port of
16398dcb4a(via9686536ceb) andeff7e0b4a2fromrelease/2026.10.1(shipped in stable 2026.10.1).What Problem This Solves
Fixes:
openclaw doctor --fixsilently drops legacy ACP session metadata when core session import has already archived the legacysessions.json(for example, the ACP-owning plugin is installed after the first core import).User Impact
User impact: upgraders whose ACP metadata was retained for a not-yet-installed plugin get it imported into shared SQLite once the plugin resolves, even after Doctor archived the original session store. The archived file is never rewritten, and an archived source still cannot be replayed into a session that was replaced since the core import. This matches shipped stable 2026.10.1 behavior.
Why This Change Was Made
migrateLegacyAcpSessionMetadataskipped any target whosestorePathwas missing. Core import removes the store as soon as the deferred plugin resolves, so the retained metadata had no reader.resolveDeferredPluginSessionStoreSource(src/infra/deferred-plugin-session-sources.ts) reads the canonical import receipt, including retired custody. It returns the hash-verified live or archived index through the existingresolveVerifiedSessionSource. The ACP migration reads that file as preserved input: completion is recorded and the file is never rewritten.eff7e0b4a2):prepareDeferredPluginSessionImportReaderpreviously dropped the import binding oncereceipt.removedSourcewas set. That returnedabsent, which skips the canonical session binding check. Once archived sources become readable, an archived source would first-import into a replaced session. Retired custody now keeps the binding.16398dcb4a. Main retired pre-agent session migration (acfd767f15), so core import never archives that store.readDeferredPluginSessionImportsemantics. Only the new resolver reads retired receipts, so plugin-doctor identity evidence for a recreated store is unchanged.captureDeferredPluginSessionSourcesmoves todeferred-plugin-session-verification.tsandresolveLegacyAcpMetadataSessionStoreTargetsmoves tostate-migrations.session-store-paths.ts. Both moves keep their owners under the line-cap ratchet, matching the release layout.Evidence
imports retained ACP metadata after core session sources are archivedfails on pre-fix main:expected undefined to deeply equal { backend: 'fixture-backend', … }. It passes with the fix, and the archives stay byte-identical.archivedvariants ofdoes not first-import ACP after the canonical sessionId/lifecycleRevision was replacedfail when only the binding change is reverted (expected { count: 1 } to deeply equal { count: 0 }). They pass with the full fix.pnpm test src/acp/runtime/session-meta.legacy-migration.test.ts: 13/13 pass.src/infra/state-migrations.acp-session-metadata.test.ts,src/infra/state-migrations.test.ts, and thesrc/commands/doctor-session-sqlite.{shared-orphan,receipt-retirement,retained-source-verification,stale-receipt,indexless}.test.tssuites, plusdoctor-state-integrityandlegacy-runtime-session-migration.node scripts/check-changed.mjs: typecheck, lint, import-cycle, and line-cap lanes are green. The dead-export scan fails on main-only exports this PR does not touch (src/auto-reply/reply/memory-flush.ts:resolveEffectivePromptTokens,ui/src/pages/chat/components/chat-pane-versions-menu.tsx:ChatPaneVersionsMenu, and others).scoped-clean(0.84).