Repository navigation
fix(doctor): preserve legacy Claude conversations during migration - #143347
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. Reviewed September 9, 2026, 4:12 PM ET / 20:12 UTC (Revision 3). ClawSweeper reviewWhat this changesDoctor migrates legacy Claude conversation IDs into provider-keyed session bindings, preserves locked conversations, prevents stale conversations from returning, and retires legacy runtime reads and writes. Merge readiness⛔ Blocked before merge - 4 items remain The migration remains useful and the earlier locked-session defect is addressed. No new blocking code defect was established; the remaining blocker is confirming the accepted upgrade contract for retiring the shipped legacy reader. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw stores native Claude conversation bindings alongside local session state. Doctor repairs those persisted bindings, which agent execution, history import, and manual compaction then use to locate the existing conversation. flowchart TD
A[Stored session records] --> B[Doctor route cleanup]
B --> C[Legacy binding migration]
C --> D{Safe conversation identity?}
D -->|Yes| E[Provider-keyed binding]
D -->|Ambiguous| F[Preserved record and warning]
E --> G[Resume and history lookup]
Decision needed
Why: The implementation and documentation consistently make this intentional change, but the linked staging discussion does not establish the specific accepted persistent-contract decision. Before merge
Agent review detailsSecurityNone. PR surfaceSource +43, Tests +319, Docs +1. Total +363 across 13 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep Doctor as the canonical migration owner, with preserved conversation identity and an explicitly accepted upgrade prerequisite before retiring legacy lookup. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main leaves the Claude-only field outside canonical bindings, while the patch's migration tests provide concrete legacy-only and locked-row fixtures. No target code was executed during this read-only review. Is this the best way to solve the issue? Yes for the migration: it repairs the existing persistence owner and preserves binding precedence. Coordinated reader retirement is maintainable once its Doctor-first upgrade contract is explicitly accepted. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 43adb0b0084c. LabelsLabel 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
History |
|
Landed as 227e2f4. Proof: The compiled public Doctor flow repaired 10 synthetic sessions across two agents, listed them, reopened both databases, and repeated repair without changing the resulting binding state. Independent acceptance passed all six stored-state clauses. Exact-head local review passed with proof A, overall B, no findings, and no security concerns. Required CI passed, including ordinary/locked Doctor-to-history, binding save/fork, and stale-cleanup cases.
Run |
…penclaw#143347) Related: openclaw#136257 ## What Problem This Solves Fixes an issue where Doctor leaves old Claude conversation IDs outside the canonical binding, while runtime lookup and normal saves still depend on the retired field. The upgrade must preserve locked-session continuity and prevent deliberately cleared stale conversations from returning. ## Why This Change Was Made This follows the approved Doctor migration and reader-retirement scope from openclaw#136257. Doctor copies safe legacy IDs before removing the old field, and runtime lookup and normal saves change together. Existing canonical bindings, provider-keyed IDs, and resume metadata take precedence. Locked rows change only their binding representation; identity, ownership, route, and recency remain intact. Ambiguous records stay saved with reconciliation warnings. The existing stale-route repair also clears the old migration source when it clears a Claude binding. A later migration step therefore cannot restore an obsolete conversation. Historical-field cleanup and protected plugin-slot handling remain available for unresolved old records. ## User Impact Run `openclaw doctor --fix` after upgrading and before resuming sessions that only have the old field. Configured and locked conversations keep their IDs and resume metadata. Stale conversations stay cleared. Normal saves no longer recreate the retired field. ## Evidence The initial main regression failed because the canonical binding was missing after Doctor repair. The first candidate passed 74 focused tests. Public Doctor proof and the first source review then exposed two connected gaps: stale-state resurrection and locked-session continuity. Both are repaired in this revision, with the earlier failures retained. The compiled runtime built from this head passes public `doctor --fix --non-interactive`, `sessions --all-agents --json`, and repeated Doctor repair on 10 synthetic sessions across two agents. Saved state was checked after reopening both databases. Configured legacy IDs, canonical metadata, provider-keyed IDs, and locked ownership are preserved; ambiguous and empty records retain warnings; stale Claude state stays cleared. Every checked record is stable on repeat. The normal native pre-commit hook passed on the revised source. [Required CI](https://github.com/openclaw/openclaw/actions/runs/34397549548) covers type checks and the updated migration, save, fork, and Doctor-to-history cases. Runtime artifact build `41b019c889c4403b33993ee39d7eb04269b73316` is the CI test merge containing head `96e5877b0f15dffe7baa9fd934cbdea07ccb694e`; those identities are kept separate in the proof. No live provider conversation, credential operation, or schema change is claimed. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #144392 Supersedes #145788 by @Marvinthebored. Thanks to @EnotionZ for the issue report. The original commit and authorship are preserved. ## What Problem This Solves Canceling a reply makes the next turn forget the conversation, even though earlier messages still appear in history. ## User Impact Stopping a reply keeps the established conversation available for the next turn. Invalid sessions and account boundaries still receive their existing checks. ## Why This Change Was Made Retain established native bindings on cancellation. Clear unfinished replacements on both thrown errors and returned partial-output interruptions. An incomplete fork claim is restored by current-owner cleanup even when the signal is aborted. New claims, successor publication, and recovery arming retain their abort guards; all writes retain session, lifecycle, writer, and source-binding checks. This preserves partial-output reporting from #126883 while removing cancellation-only binding invalidation. No schema, migration, configuration, protocol, or dependency change. ## Final-head evidence Head `b068bf05618ddcd3e1b28894c68ad734e0eac997` includes a one-line test-type correction that passes the existing defined session entry; the command still reloads persisted state before choosing the next native binding. All 157 tests in that file, targeted lint, and formatting pass. Production source is unchanged from `2c163fd9eb57100ae3a2eec38cb6038e5f752851`. The complete affected owner suites passed on fresh merge `4b66a1a18209c21b5e92986452b2b98b95ae6fa1`, with parents `2c163fd9eb57100ae3a2eec38cb6038e5f752851` and main `9542320aa5cdcc4af53e3b05ad75160992a34407`. All **28 complete canonical groups exited 0**: 46,971 labeled passes and 88 skips. Three cases are unlabelled in the native support summary; no status is inferred. This includes both fork-restoration cases and all four abort/timeout × established/replacement command cases. Complete current group membership, exact commands, numeric exits, and raw logs are retained. ```sh env -u NO_COLOR -u FORCE_COLOR node --import tsx scripts/ci-run-node-test-shard.mts ``` Hosted [CI run 34774482283, attempt 1](https://github.com/openclaw/openclaw/actions/runs/34774482283) passed except `checks-node-compact-small-32` and its aggregate gate. Its QA-profile routing assertion is **base-red**: the same test fails on plain main `28887b564210326174413d0d8ade72b38268d5f3` and fresh candidate/main merge `7ea7374fcf62570c9b3fa631cf17072ef5eda2d6`, both exit 1. #143968 (`07b96d9b4122e1afdd0efbb662b2335eb716dfec`) added `qa-profile-run-status.test.ts` as a sixth workflow reader without updating the five-target expectation. This PR changes none of those routing inputs. ```sh OPENCLAW_E2E_USE_PREBUILT_DIST=1 node scripts/run-vitest.mjs run \ test/scripts/test-projects.test.ts -t 'routes QA Profile Evidence' ``` ## Fork-claim correction Candidate `2c163fd9eb57100ae3a2eec38cb6038e5f752851` restores a committed fork claim after cancellation before a successor appears. Previously, restoration rejected the aborted signal, lost the fork marker, and let the next command resume the source directly. Cleanup now uses the existing current-owner settlement assertion. Stale session, lifecycle, writer, placement, and source-binding checks remain enforced. The regression fails on `e2ca5b29bfa09810aaa20eca8a1d0e85ced913c8`: the marker is absent and the next command receives `forkCliSessionOnResume=false`. After correction, both the recovery-error control and actual-signal cancellation pass; stored/cache markers and the source checkpoint remain, and the next command receives `forkCliSessionOnResume=true`. ```sh env -u NO_COLOR -u FORCE_COLOR node scripts/run-vitest.mjs run \ --config test/vitest/vitest.agents.config.ts \ src/agents/command/attempt-execution.cli.test.ts --maxWorkers=1 \ -t 'preserves a restored fork marker before a successor' ``` Fresh merge `54a5c90a8b4585f72842e380365b95263b05983d` has first parent candidate `2c163fd9eb57100ae3a2eec38cb6038e5f752851` and second parent main `adb6e518a44218650883f3daec4bd319165e0017`. All **436 tests in seven complete focused files passed**, including command successor/flag cleanup, aborted pre-successor restoration, stale-store guards, returned interruption, thrown cancellation, auto-reply, and fork-runner siblings. This bounded rerun supplements the earlier complete suites. Both real Gateway cancellation shapes also passed on that merge: before output (zero assistant events) and after first output. Both next turns resumed the same native binding, logged `historyPrompt=none`, and recalled `PEBBLE-7429`. Both drivers exited 0. The new catalog regression uses the real command/store entry point with a mocked native runner; it proves next-turn fork routing, not a new live source-transcript isolation capture. Targeted lint passed, including max-lines: ```sh pnpm exec oxlint --config .oxlintrc.json \ src/agents/command/attempt-execution.ts \ src/agents/command/attempt-execution.cli.test.ts ``` Original red evidence remains intact. Exact commands, merge identities, numeric exits, and complete captures are retained. The complete affected-suite rerun and final-head CI classification are recorded above. ## Earlier evidence Validated corrected candidate `4fd555e5957f86289cf981ce4cf4b0bb1122c679` on temporary merge `d5f41d1cd6c9b603db32deec1d60c1ba93e7e04d`. Its parents are that candidate and main `a0cce74d389d737d6dcf21de7344af10cf862f72`. All 28 complete canonical CI groups for the affected agent, reply, scheduled-run, and fast test suites exited 0 on that merge. Reporters label **46,859 tests passed and 88 skipped**. The full command persistence matrix passed, including unfinished-successor and temporary-flag cleanup for abort and timeout, plus established-binding resume. Each complete group ran through the CI command, with its canonical configuration, include list and environment preserved: ```sh node --import tsx scripts/ci-run-node-test-shard.mts ``` These are the complete affected test suites on the recorded merge. Final-head CI and its reproduced base-red exception are recorded above. Initial host setup failures were retained, then resolved by removing conflicting color settings and making GNU timeout available without replacing existing command resolution. No source assertions or timeouts were relaxed. One native summary leaves three cases unlabeled; the raw count line is retained without assigning them a status. The real Gateway was also rerun from the merge with isolated state, workspace and port: ```sh OPENCLAW_CONFIG_PATH="$PROOF/openclaw.json" OPENCLAW_STATE_DIR="$PROOF/state" \ pnpm openclaw gateway --port 21978 --bind loopback ``` `chat.send` remembered a synthetic code, a second request started a long reply, `chat.abort` canceled it, and the next `chat.send` requested the code without repeating it. | Cancellation | Recorded main | Corrected merge | | --- | --- | --- | | Before output | Fresh native session; `UNKNOWN` | Same native binding; `PEBBLE-7429` | | After first output | Fresh native session; `UNKNOWN` | Same native binding; `PEBBLE-7429` | Both drivers exited 0. Both continuations logged `useResume=true` with the same native fingerprint and `historyPrompt=none`. The pre-output run had zero assistant events before cancellation. Original red captures, merge parents, selection, exact commands, numeric exits and complete logs are preserved. Final-head CI and its reproduced base-red exception are recorded above. ## Compatibility and prior behavior This deliberately changes the cancellation-only binding invalidation retained by #126883 and #128131. Partial output remains visible, interrupted turns remain unsuccessful, and successful authentication settlement remains suppressed. Expired-session recovery from #115513 and the retired-field migration from #143347 remain unchanged. There is no schema, migration, configuration, protocol, dependency, or permission change. ## Consumers Command attempts, auto-reply turns, and scheduled turns consume the binding result. History import, session freshness, catalog continuation, export, runtime selection, and detached-media continuation read the retained binding or its explicit absence. Catalog adoption seeds a binding with `forceReuse` and a one-shot fork marker. The command path claims that marker before execution and can persist a successor before final settlement. These writes require the current session, lifecycle, writer, and expected source binding. Successful settlement removes the temporary reuse flag; interrupted replacement cleanup removes the successor and flag together. An established binding remains available after cancellation. Cancellation before a fork successor appears restores the one-shot marker, so the next command must still fork from the source. Cache updates occur at the successful commit, and scheduled continuation publication follows base-session persistence. ## Evidence limits The real Gateway sequences cover cancellation before output and after the first output. Both failed on main `fe3b2891fdeaa1a891d54cb2b306e975fc5408cf` and passed at `f9c5b148cf4d92de5211315a4e8c374bef279d9d`. The next turn resumed the same native binding without replaying local history and recalled the seeded code. The initial 272 focused tests include command persistence and next-turn routing, auto-reply retention, failed-flush cleanup, and scheduled-run settlement. They ran on the branch based on `f85a9945daaebc61d041db27b4d3175d17082e37`. The later fresh merge `d5f41d1cd6c9b603db32deec1d60c1ba93e7e04d`, recorded above, passed all 28 complete affected test groups and both real Gateway cancellation shapes. No browser-click or platform-specific UI claim is made. The two test suites that failed on the contributor head pass when applied to the refreshed main base and after correction. The original hosted failures were not reproduced in their original shard order, so their cause remains unclassified. No assertion or timeout was relaxed for this repair. ## Test ledger clarification - The ordinary-abort policy and command assertions now require retention instead of unconditional deletion. Command coverage also checks the subsequent resume. - The contributor-only interrupted-flush helper matrix was removed before the final diff because command persistence coverage supersedes it. - The retained interrupted-partial-output fixture now names an established reusable session. Its unchanged clear assertion independently protects failed transcript flush; its partial-output, unsuccessful-hook, timeout, and authentication assertions remain. - The new composition cases invoke `runAgentAttempt`, claim a fork, persist its successor, abort the actual signal, consume the production settlement result, reopen stored state, and check the next attempt. The channel regression invokes `executeAgentTurn`; the failed-flush regression invokes `runPreparedCliAgent`. Direct policy-unit assertions supplement these entry-point checks. The earlier head `e2ca5b29bfa09810aaa20eca8a1d0e85ced913c8` only replaces a retained unflushed ID with the equivalent condition at its two consumers. Review accepted that behavior-preserving delta. CI run [34769866871](https://github.com/openclaw/openclaw/actions/runs/34769866871) passed at attempt 2 on this exact head. Attempt 1 had one test failure in an unrelated QA binary-admission case; it passed on the retry without a code or timeout change and is recorded as a flake. Co-authored-by: Marvinthebored <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Related: openclaw#144392 Supersedes openclaw#145788 by @Marvinthebored. Thanks to @EnotionZ for the issue report. The original commit and authorship are preserved. ## What Problem This Solves Canceling a reply makes the next turn forget the conversation, even though earlier messages still appear in history. ## User Impact Stopping a reply keeps the established conversation available for the next turn. Invalid sessions and account boundaries still receive their existing checks. ## Why This Change Was Made Retain established native bindings on cancellation. Clear unfinished replacements on both thrown errors and returned partial-output interruptions. An incomplete fork claim is restored by current-owner cleanup even when the signal is aborted. New claims, successor publication, and recovery arming retain their abort guards; all writes retain session, lifecycle, writer, and source-binding checks. This preserves partial-output reporting from openclaw#126883 while removing cancellation-only binding invalidation. No schema, migration, configuration, protocol, or dependency change. ## Final-head evidence Head `b068bf05618ddcd3e1b28894c68ad734e0eac997` includes a one-line test-type correction that passes the existing defined session entry; the command still reloads persisted state before choosing the next native binding. All 157 tests in that file, targeted lint, and formatting pass. Production source is unchanged from `2c163fd9eb57100ae3a2eec38cb6038e5f752851`. The complete affected owner suites passed on fresh merge `4b66a1a18209c21b5e92986452b2b98b95ae6fa1`, with parents `2c163fd9eb57100ae3a2eec38cb6038e5f752851` and main `a9a9a16114bea90d6eac90486356697df2462cb9`. All **28 complete canonical groups exited 0**: 46,971 labeled passes and 88 skips. Three cases are unlabelled in the native support summary; no status is inferred. This includes both fork-restoration cases and all four abort/timeout × established/replacement command cases. Complete current group membership, exact commands, numeric exits, and raw logs are retained. ```sh env -u NO_COLOR -u FORCE_COLOR node --import tsx scripts/ci-run-node-test-shard.mts ``` Hosted [CI run 34774482283, attempt 1](https://github.com/openclaw/openclaw/actions/runs/34774482283) passed except `checks-node-compact-small-32` and its aggregate gate. Its QA-profile routing assertion is **base-red**: the same test fails on plain main `a1105f105a093f768914a29c24b70d6ba406cad8` and fresh candidate/main merge `7ea7374fcf62570c9b3fa631cf17072ef5eda2d6`, both exit 1. openclaw#143968 (`41aebf15de48524e80c95f05e0c1212f2dfd29c6`) added `qa-profile-run-status.test.ts` as a sixth workflow reader without updating the five-target expectation. This PR changes none of those routing inputs. ```sh OPENCLAW_E2E_USE_PREBUILT_DIST=1 node scripts/run-vitest.mjs run \ test/scripts/test-projects.test.ts -t 'routes QA Profile Evidence' ``` ## Fork-claim correction Candidate `2c163fd9eb57100ae3a2eec38cb6038e5f752851` restores a committed fork claim after cancellation before a successor appears. Previously, restoration rejected the aborted signal, lost the fork marker, and let the next command resume the source directly. Cleanup now uses the existing current-owner settlement assertion. Stale session, lifecycle, writer, placement, and source-binding checks remain enforced. The regression fails on `e2ca5b29bfa09810aaa20eca8a1d0e85ced913c8`: the marker is absent and the next command receives `forkCliSessionOnResume=false`. After correction, both the recovery-error control and actual-signal cancellation pass; stored/cache markers and the source checkpoint remain, and the next command receives `forkCliSessionOnResume=true`. ```sh env -u NO_COLOR -u FORCE_COLOR node scripts/run-vitest.mjs run \ --config test/vitest/vitest.agents.config.ts \ src/agents/command/attempt-execution.cli.test.ts --maxWorkers=1 \ -t 'preserves a restored fork marker before a successor' ``` Fresh merge `54a5c90a8b4585f72842e380365b95263b05983d` has first parent candidate `2c163fd9eb57100ae3a2eec38cb6038e5f752851` and second parent main `e08263bdd3341031c219bb147638f23a1f4c3c03`. All **436 tests in seven complete focused files passed**, including command successor/flag cleanup, aborted pre-successor restoration, stale-store guards, returned interruption, thrown cancellation, auto-reply, and fork-runner siblings. This bounded rerun supplements the earlier complete suites. Both real Gateway cancellation shapes also passed on that merge: before output (zero assistant events) and after first output. Both next turns resumed the same native binding, logged `historyPrompt=none`, and recalled `PEBBLE-7429`. Both drivers exited 0. The new catalog regression uses the real command/store entry point with a mocked native runner; it proves next-turn fork routing, not a new live source-transcript isolation capture. Targeted lint passed, including max-lines: ```sh pnpm exec oxlint --config .oxlintrc.json \ src/agents/command/attempt-execution.ts \ src/agents/command/attempt-execution.cli.test.ts ``` Original red evidence remains intact. Exact commands, merge identities, numeric exits, and complete captures are retained. The complete affected-suite rerun and final-head CI classification are recorded above. ## Earlier evidence Validated corrected candidate `4fd555e5957f86289cf981ce4cf4b0bb1122c679` on temporary merge `d5f41d1cd6c9b603db32deec1d60c1ba93e7e04d`. Its parents are that candidate and main `e0ad90d2bc2effce521cbde79cec2be56cece725`. All 28 complete canonical CI groups for the affected agent, reply, scheduled-run, and fast test suites exited 0 on that merge. Reporters label **46,859 tests passed and 88 skipped**. The full command persistence matrix passed, including unfinished-successor and temporary-flag cleanup for abort and timeout, plus established-binding resume. Each complete group ran through the CI command, with its canonical configuration, include list and environment preserved: ```sh node --import tsx scripts/ci-run-node-test-shard.mts ``` These are the complete affected test suites on the recorded merge. Final-head CI and its reproduced base-red exception are recorded above. Initial host setup failures were retained, then resolved by removing conflicting color settings and making GNU timeout available without replacing existing command resolution. No source assertions or timeouts were relaxed. One native summary leaves three cases unlabeled; the raw count line is retained without assigning them a status. The real Gateway was also rerun from the merge with isolated state, workspace and port: ```sh OPENCLAW_CONFIG_PATH="$PROOF/openclaw.json" OPENCLAW_STATE_DIR="$PROOF/state" \ pnpm openclaw gateway --port 21978 --bind loopback ``` `chat.send` remembered a synthetic code, a second request started a long reply, `chat.abort` canceled it, and the next `chat.send` requested the code without repeating it. | Cancellation | Recorded main | Corrected merge | | --- | --- | --- | | Before output | Fresh native session; `UNKNOWN` | Same native binding; `PEBBLE-7429` | | After first output | Fresh native session; `UNKNOWN` | Same native binding; `PEBBLE-7429` | Both drivers exited 0. Both continuations logged `useResume=true` with the same native fingerprint and `historyPrompt=none`. The pre-output run had zero assistant events before cancellation. Original red captures, merge parents, selection, exact commands, numeric exits and complete logs are preserved. Final-head CI and its reproduced base-red exception are recorded above. ## Compatibility and prior behavior This deliberately changes the cancellation-only binding invalidation retained by openclaw#126883 and openclaw#128131. Partial output remains visible, interrupted turns remain unsuccessful, and successful authentication settlement remains suppressed. Expired-session recovery from openclaw#115513 and the retired-field migration from openclaw#143347 remain unchanged. There is no schema, migration, configuration, protocol, dependency, or permission change. ## Consumers Command attempts, auto-reply turns, and scheduled turns consume the binding result. History import, session freshness, catalog continuation, export, runtime selection, and detached-media continuation read the retained binding or its explicit absence. Catalog adoption seeds a binding with `forceReuse` and a one-shot fork marker. The command path claims that marker before execution and can persist a successor before final settlement. These writes require the current session, lifecycle, writer, and expected source binding. Successful settlement removes the temporary reuse flag; interrupted replacement cleanup removes the successor and flag together. An established binding remains available after cancellation. Cancellation before a fork successor appears restores the one-shot marker, so the next command must still fork from the source. Cache updates occur at the successful commit, and scheduled continuation publication follows base-session persistence. ## Evidence limits The real Gateway sequences cover cancellation before output and after the first output. Both failed on main `0c664785f82d3af6c2101efb53d7269d30261f4c` and passed at `f9c5b148cf4d92de5211315a4e8c374bef279d9d`. The next turn resumed the same native binding without replaying local history and recalled the seeded code. The initial 272 focused tests include command persistence and next-turn routing, auto-reply retention, failed-flush cleanup, and scheduled-run settlement. They ran on the branch based on `329bc5bf9694af38477f9fd45ebe47ad86b538a9`. The later fresh merge `d5f41d1cd6c9b603db32deec1d60c1ba93e7e04d`, recorded above, passed all 28 complete affected test groups and both real Gateway cancellation shapes. No browser-click or platform-specific UI claim is made. The two test suites that failed on the contributor head pass when applied to the refreshed main base and after correction. The original hosted failures were not reproduced in their original shard order, so their cause remains unclassified. No assertion or timeout was relaxed for this repair. ## Test ledger clarification - The ordinary-abort policy and command assertions now require retention instead of unconditional deletion. Command coverage also checks the subsequent resume. - The contributor-only interrupted-flush helper matrix was removed before the final diff because command persistence coverage supersedes it. - The retained interrupted-partial-output fixture now names an established reusable session. Its unchanged clear assertion independently protects failed transcript flush; its partial-output, unsuccessful-hook, timeout, and authentication assertions remain. - The new composition cases invoke `runAgentAttempt`, claim a fork, persist its successor, abort the actual signal, consume the production settlement result, reopen stored state, and check the next attempt. The channel regression invokes `executeAgentTurn`; the failed-flush regression invokes `runPreparedCliAgent`. Direct policy-unit assertions supplement these entry-point checks. The earlier head `e2ca5b29bfa09810aaa20eca8a1d0e85ced913c8` only replaces a retained unflushed ID with the equivalent condition at its two consumers. Review accepted that behavior-preserving delta. CI run [34769866871](https://github.com/openclaw/openclaw/actions/runs/34769866871) passed at attempt 2 on this exact head. Attempt 1 had one test failure in an unrelated QA binary-admission case; it passed on the retry without a code or timeout change and is recorded as a flake. Co-authored-by: Marvinthebored <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #136257.
What Problem This Solves
Doctor left legacy conversation IDs outside canonical bindings while runtime reads and saves still used the retired field. Repair could also restore a deliberately cleared stale conversation or disrupt a locked session.
Why This Change Was Made
Doctor copies safe legacy IDs before removing the old field, and runtime reads and saves change together. Canonical bindings and resume metadata retain precedence. Locked rows change only their binding representation. Stale-route cleanup also clears the legacy source so later migration cannot restore it; ambiguous records retain warnings.
User Impact
Run openclaw doctor --fix after upgrading and before resuming sessions that have only the old field. Configured and locked conversations retain their IDs and metadata. Stale conversations remain cleared, and normal saves no longer recreate the retired field.
Consumers: Doctor migration, runtime conversation lookup, normal saves, and stale-route repair now use canonical bindings consistently.
Evidence
The original regression missed the canonical binding after repair. Public Doctor repair, session listing, and repeated repair passed on ten synthetic sessions across two agents. Reopened databases preserved IDs, metadata, and locked ownership; stale state stayed cleared on repeat. Native checks passed; continuous integration covers migration, save, fork, and Doctor-to-history cases. No live conversation or credential operation was tested.