Skip to content

fix(doctor): restore cold transcripts before session repair for renamed agents - #196079

Merged
roboclaw-bot merged 1 commit into
mainfrom
roboclaw/qj-196066-cold-renamed-agent
Nov 9, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
roboclaw/qj-196066-cold-renamed-agent

Conversation

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Fixes #196066

What Problem This Solves

openclaw doctor --fix blocks upgrades when a renamed agent's store contains cold transcripts keyed with the old agent ID and Gateway history cannot restore them.

User Impact

Doctor can complete canonical session repair while preserving those transcripts, without a manual restore. Missing or damaged archives still stop the affected repair to protect history.

Why This Change Was Made

Canonical generation preparation now restores affected cold generations through the existing archive owner before copying or archiving history. Restoration uses the physical store owner, runs under Doctor's offline maintenance custody, and retains the existing size/SHA-256 verification and transactional restore semantics. Gateway history ownership checks are unchanged.

This fix belongs in the candidate Doctor; it requires no installed-updater change, config alias, CLI/RPC addition, or schema change. The process-local 24-hour restore cooldown remains unchanged: a later Gateway process can re-archive eligible restored transcripts, but cannot interrupt this offline restore-and-repair step.

Evidence

  • Red on base f001243c254f: a real file-backed cold transcript in newname's per-agent store, keyed agent:oldname:conversation, fails Doctor's canonical repair with SessionTranscriptColdError / TRANSCRIPT_COLD.
  • Green: current and unreferenced historical generations retain the complete expected history; preview does not restore; a same-size damaged archive fails verification without losing its metadata or bytes, then recovers when the original archive is restored; repetition makes no further repairs.
  • All seven named files passed: 68 tests in 139.00 seconds, --maxWorkers=1, through the repository Node test wrapper. The changed test file's isolated run took 62.47 seconds including 38.24 seconds of initial worker compilation; CI seconds are pending.
  • Touched-file type-aware oxlint, oxfmt, commit hooks, and git diff --check passed.
  • pr-simplify: reuse the existing restore owner and remove the hot-only repair prerequisite; no new restoration machinery. Net growth is 23 production lines and 90 test lines. The separate 90-line regression allocation covers exactly these three storage-boundary cases; the shared baseline is unchanged.
  • Autoreview (Codex, branch mode, P0–P2): scoped-clean, no findings, base f001243c254fe09663c98881cf831f417a1ef388 → head 4b3d4efc0a8ad861173a08ef0525976066f46ab5.
Named test files
src/commands/doctor-session-canonical-keys.test.ts
src/commands/doctor-session-canonical-keys.address.test.ts
src/commands/doctor-session-canonical-keys.retention.test.ts
src/commands/doctor-session-transcripts.sqlite.test.ts
src/config/sessions/session-cold-storage.test.ts
src/config/sessions/legacy-main-session-migration.handoff.test.ts
src/commands/doctor-maintenance.session-workers.test.ts

Upgrade proof gap: the requested 2026.11.2 → branch CLI check did not run. Crabbox returned a lease immediately, but the Testbox remained hydrating; the command never dispatched and the task-owned lease was stopped and confirmed completed. Allocation run. Broad build/typecheck/package proof is left to PR CI under the production-host limits.

Reported by denvr-agents-admin[bot] on behalf of its operators. Thanks for the report and reproduction details.

Work sessions

Linked for team reference; these sessions aren’t public.

@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations size: S labels Nov 9, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Doctor restores affected cold transcript generations before canonical session-key repair, using the physical store owner.

Example: The newname store contains cold history for agent:oldname:conversation.

  • Before: Doctor throws TRANSCRIPT_COLD, and Gateway history routing cannot restore the mismatched agent key.
  • After: Doctor verifies and restores the archive before repairing the session while preserving its history.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported repair with meaningful storage regressions and no identified code defect; persisted-state upgrade validation remains incomplete.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Operators cannot complete an upgrade because Doctor requires restored history that Gateway agent routing cannot restore.
Reason: The maintainer-authored repair addresses a reported release failure without new configuration, protocol, schema, or relaxed runtime ownership.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR: it addresses a current upgrade-blocking defect through the existing storage owner, with no definite introduced code defect found.

Priority: P1
Reviewed head: 4b3d4efc0a8ad861173a08ef0525976066f46ab5

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: The PR owner must complete the disclosed v2026.11.2-to-branch Doctor CLI upgrade on isolated populated state, verifying retained settings and history, completed downstream repairs, and an idempotent rerun.
Agent review details

How this fits together

Doctor inventories session repair candidates, restores their archived payloads through the cold-storage owner, then copies or archives history through the existing canonical repair lifecycle.

flowchart TD
  A[Doctor fix] --> B[Offline maintenance custody]
  B --> C[Canonical repair inventory]
  C --> D[Physical store archive owner]
  D --> E[Verified transcript restoration]
  E --> F[Canonical session repair]
Loading

Technical review

Best possible solution:

Restore affected generations through the existing archive owner under Doctor custody, preserving verification, history, and Gateway ownership checks.

Do we have a high-confidence way to reproduce the issue?

Current main reaches the hot-transcript assertion for cold canonical-repair generations; the report supplies matching release errors and the PR reports a failing-base file-backed regression, but this review executed no target code.

Is this the best way to solve the issue?

This is the smallest complete repair: prepare affected cold generations through the existing restoration owner before reserving the writer, retaining the original copy, archival, and integrity contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 06ee40a8facc.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit cdac42a adds src/config/sessions/session-accessor.sqlite-canonical-repair.ts:181 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: cdac42a4630a; files: src/config/sessions/session-accessor.sqlite-canonical-repair.ts)

PR surface

Source +23, Tests +90, Docs +3, Other +2. Total +118 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 33 10 +23
Tests 1 91 1 +90
Docs 1 5 2 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 4 131 13 +118

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus regression growth Production +33/-10; tests +91/-1 Growth reuses restoration machinery and covers three distinct storage failure cases without adding a parallel owner.

Labels

Label changes:

  • add P1: The linked report and current source establish a blocked official-release upgrade with inaccessible cold-history restoration.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.

Label justifications:

  • P1: The linked report and current source establish a blocked official-release upgrade with inaccessible cold-history restoration.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete the published-release Doctor upgrade scenario identified in testingReview.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 9, 2026, 11:07 AM ET / 16:07 UTC.

@roboclaw-bot
roboclaw-bot merged commit 7010349 into main Nov 9, 2026
124 checks passed
@roboclaw-bot
roboclaw-bot deleted the roboclaw/qj-196066-cold-renamed-agent branch November 9, 2026 16:33
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
…ed agents (openclaw#196079)

Doctor's canonical session repair stopped with SessionTranscriptColdError when a renamed agent's store held cold transcripts keyed under the old agent id, and the Gateway history restore path refuses those keys, so upgrades to 2026.11.2 had no lossless way forward. The repair now restores the cold generations it needs through the existing cold-restore owner (size/SHA-256 verified, archive kept on failure), resolved by the physical store owner under Doctor's offline maintenance custody, before continuing the existing repair. No alias, flag, RPC or schema change; Gateway history ownership checks are unchanged.

Fixes openclaw#196066

Co-authored-by: steipete <[email protected]>
steipete added a commit that referenced this pull request Nov 10, 2026
… cell

The 47,500-entry budget check only ran in Package Acceptance, which main never
reached on a schedule (Update Migration is blocked at image prep), and the
hourly published-driver cell uses the latest published driver, which degrades
past the walk cap instead of refusing. So #196079 pushed main past the 50,000
entries that 2026.9.x updaters enforce without any CI going red.

Measure the tree the published driver actually installed and assert the same
release budget, so scheduled main validation goes red within the hour.

Refs #196079
roboclaw-bot added a commit that referenced this pull request Nov 11, 2026
…197153)

* fix(sessions): keep canonical row reads outside Doctor restoration

Separate the unchanged exact-row reader from the mutable Doctor repair graph introduced by #196079. Preserve cold restoration, malformed-row handling and all read callers; keep standalone transcript worker graph assertions unchanged.

Co-authored-by: steipete <[email protected]>
Co-authored-by: obviyus <[email protected]>

* fix(sessions): keep transcript workers outside Doctor repair imports

Worked on by:
- @obviyus
- @steipete

Co-authored-by: obviyus <[email protected]>
Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: a5810362-f6b3-86b4-b15f-fda48e461821

* style(sessions): remove extra canonical reader EOF line

Co-authored-by: steipete <[email protected]>
Co-authored-by: obviyus <[email protected]>

* fix(test): complete canonical reader caller cutover

Migrate three test imports outside the sessions directory and bind the existing database inventory operation to the extracted reader owner. Preserve all assertions.

Co-authored-by: steipete <[email protected]>
Co-authored-by: obviyus <[email protected]>

* fix(ci): give PostgreSQL 16 smoke its own execution budget

Keep all three PostgreSQL 17 conformance shards at 30 minutes and run the unchanged pinned PG16 Gateway target in an independently gated 15-minute job. Preserve reporter, aggregate, completion and hosted-cost accounting. Six net lines extend existing guard cases; allocate exactly six lines in pg16-independent-smoke.txt, with no new cases or shared scalar increase.

Co-authored-by: steipete <[email protected]>
Co-authored-by: obviyus <[email protected]>

* fix(ci): isolate PostgreSQL smoke without expanding workflow aliases

Keep independent PG16 admission and deadline in a fourth matrix row while restoring default YAML alias guard compatibility. Retain all PostgreSQL checks and aggregate gate ownership.

Co-authored-by: steipete <[email protected]>

Co-authored-by: obviyus <[email protected]>

* fix(ci): simplify PostgreSQL matrix display names

Restore the workflow byte guard without changing matrix admission, execution budgets or tests. The pg16-smoke row remains identifiable by its matrix label.

Co-authored-by: steipete <[email protected]>

Co-authored-by: obviyus <[email protected]>

* fix(test): model PostgreSQL matrix exclusions in hosted admission

Keep daily qualification at three shards and model PR matrix exclusions separately from Cartesian dimensions. Preserve actual jobs and guard thresholds; allocate twelve exact net guard lines.

Co-authored-by: steipete <[email protected]>

Co-authored-by: obviyus <[email protected]>

* fix(test): brace matrix exclusion control flow

Satisfy the existing curly lint rule without changing matrix behavior. Account for the two required brace lines in the exact scoped test allocation.

Co-authored-by: steipete <[email protected]>

Co-authored-by: obviyus <[email protected]>

---------

Co-authored-by: steipete <[email protected]>
Co-authored-by: obviyus <[email protected]>
rune-dandelion-cult pushed a commit to karmaterminal/openclaw that referenced this pull request Nov 11, 2026
…penclaw#197153)

* fix(sessions): keep canonical row reads outside Doctor restoration

Separate the unchanged exact-row reader from the mutable Doctor repair graph introduced by openclaw#196079. Preserve cold restoration, malformed-row handling and all read callers; keep standalone transcript worker graph assertions unchanged.

Co-authored-by: steipete <[email protected]>
Co-authored-by: obviyus <[email protected]>

* fix(sessions): keep transcript workers outside Doctor repair imports

Worked on by:
- @obviyus
- @steipete

Co-authored-by: obviyus <[email protected]>
Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: a5810362-f6b3-86b4-b15f-fda48e461821

* style(sessions): remove extra canonical reader EOF line

Co-authored-by: steipete <[email protected]>
Co-authored-by: obviyus <[email protected]>

* fix(test): complete canonical reader caller cutover

Migrate three test imports outside the sessions directory and bind the existing database inventory operation to the extracted reader owner. Preserve all assertions.

Co-authored-by: steipete <[email protected]>
Co-authored-by: obviyus <[email protected]>

* fix(ci): give PostgreSQL 16 smoke its own execution budget

Keep all three PostgreSQL 17 conformance shards at 30 minutes and run the unchanged pinned PG16 Gateway target in an independently gated 15-minute job. Preserve reporter, aggregate, completion and hosted-cost accounting. Six net lines extend existing guard cases; allocate exactly six lines in pg16-independent-smoke.txt, with no new cases or shared scalar increase.

Co-authored-by: steipete <[email protected]>
Co-authored-by: obviyus <[email protected]>

* fix(ci): isolate PostgreSQL smoke without expanding workflow aliases

Keep independent PG16 admission and deadline in a fourth matrix row while restoring default YAML alias guard compatibility. Retain all PostgreSQL checks and aggregate gate ownership.

Co-authored-by: steipete <[email protected]>

Co-authored-by: obviyus <[email protected]>

* fix(ci): simplify PostgreSQL matrix display names

Restore the workflow byte guard without changing matrix admission, execution budgets or tests. The pg16-smoke row remains identifiable by its matrix label.

Co-authored-by: steipete <[email protected]>

Co-authored-by: obviyus <[email protected]>

* fix(test): model PostgreSQL matrix exclusions in hosted admission

Keep daily qualification at three shards and model PR matrix exclusions separately from Cartesian dimensions. Preserve actual jobs and guard thresholds; allocate twelve exact net guard lines.

Co-authored-by: steipete <[email protected]>

Co-authored-by: obviyus <[email protected]>

* fix(test): brace matrix exclusion control flow

Satisfy the existing curly lint rule without changing matrix behavior. Account for the two required brace lines in the exact scoped test allocation.

Co-authored-by: steipete <[email protected]>

Co-authored-by: obviyus <[email protected]>

---------

Co-authored-by: steipete <[email protected]>
Co-authored-by: obviyus <[email protected]>
steipete added a commit that referenced this pull request Nov 11, 2026
…entry budget (#197269)

* ci(update): enforce the installed-tree budget in the published-driver cell

The 47,500-entry budget check only ran in Package Acceptance, which main never
reached on a schedule (Update Migration is blocked at image prep), and the
hourly published-driver cell uses the latest published driver, which degrades
past the walk cap instead of refusing. So #196079 pushed main past the 50,000
entries that 2026.9.x updaters enforce without any CI going red.

Measure the tree the published driver actually installed and assert the same
release budget, so scheduled main validation goes red within the hour.

Refs #196079

* test(sessions): bound the retirement-read worker build

#196079 let the transcript worker's private build reach Doctor's cold-restore
graph, which pushed the installed package past the 50,000 entries that
2026.9.x updaters accept; #197153 fixed the import edge. Build the
retirement-read worker with its real private config and require it to stay
small, so the edge cannot come back unnoticed: 5,408 emitted files before
#197153, 58 after.

Refs #196079
Refs #196418

* ci(update): mount the installed-tree budget module in the Docker harness

The published-driver cell imports scripts/check-openclaw-installed-package-budget.mts,
which the harness did not mount, so the cell would fail on import.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 12, 2026
…penclaw#197153)

* fix(sessions): keep canonical row reads outside Doctor restoration

Separate the unchanged exact-row reader from the mutable Doctor repair graph introduced by openclaw#196079. Preserve cold restoration, malformed-row handling and all read callers; keep standalone transcript worker graph assertions unchanged.

Co-authored-by: steipete <[email protected]>
Co-authored-by: obviyus <[email protected]>

* fix(sessions): keep transcript workers outside Doctor repair imports

Worked on by:
- @obviyus
- @steipete

Co-authored-by: obviyus <[email protected]>
Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: a5810362-f6b3-86b4-b15f-fda48e461821

* style(sessions): remove extra canonical reader EOF line

Co-authored-by: steipete <[email protected]>
Co-authored-by: obviyus <[email protected]>

* fix(test): complete canonical reader caller cutover

Migrate three test imports outside the sessions directory and bind the existing database inventory operation to the extracted reader owner. Preserve all assertions.

Co-authored-by: steipete <[email protected]>
Co-authored-by: obviyus <[email protected]>

* fix(ci): give PostgreSQL 16 smoke its own execution budget

Keep all three PostgreSQL 17 conformance shards at 30 minutes and run the unchanged pinned PG16 Gateway target in an independently gated 15-minute job. Preserve reporter, aggregate, completion and hosted-cost accounting. Six net lines extend existing guard cases; allocate exactly six lines in pg16-independent-smoke.txt, with no new cases or shared scalar increase.

Co-authored-by: steipete <[email protected]>
Co-authored-by: obviyus <[email protected]>

* fix(ci): isolate PostgreSQL smoke without expanding workflow aliases

Keep independent PG16 admission and deadline in a fourth matrix row while restoring default YAML alias guard compatibility. Retain all PostgreSQL checks and aggregate gate ownership.

Co-authored-by: steipete <[email protected]>

Co-authored-by: obviyus <[email protected]>

* fix(ci): simplify PostgreSQL matrix display names

Restore the workflow byte guard without changing matrix admission, execution budgets or tests. The pg16-smoke row remains identifiable by its matrix label.

Co-authored-by: steipete <[email protected]>

Co-authored-by: obviyus <[email protected]>

* fix(test): model PostgreSQL matrix exclusions in hosted admission

Keep daily qualification at three shards and model PR matrix exclusions separately from Cartesian dimensions. Preserve actual jobs and guard thresholds; allocate twelve exact net guard lines.

Co-authored-by: steipete <[email protected]>

Co-authored-by: obviyus <[email protected]>

* fix(test): brace matrix exclusion control flow

Satisfy the existing curly lint rule without changing matrix behavior. Account for the two required brace lines in the exact scoped test allocation.

Co-authored-by: steipete <[email protected]>

Co-authored-by: obviyus <[email protected]>

---------

Co-authored-by: steipete <[email protected]>
Co-authored-by: obviyus <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 12, 2026
…entry budget (openclaw#197269)

* ci(update): enforce the installed-tree budget in the published-driver cell

The 47,500-entry budget check only ran in Package Acceptance, which main never
reached on a schedule (Update Migration is blocked at image prep), and the
hourly published-driver cell uses the latest published driver, which degrades
past the walk cap instead of refusing. So openclaw#196079 pushed main past the 50,000
entries that 2026.9.x updaters enforce without any CI going red.

Measure the tree the published driver actually installed and assert the same
release budget, so scheduled main validation goes red within the hour.

Refs openclaw#196079

* test(sessions): bound the retirement-read worker build

openclaw#196079 let the transcript worker's private build reach Doctor's cold-restore
graph, which pushed the installed package past the 50,000 entries that
2026.9.x updaters accept; openclaw#197153 fixed the import edge. Build the
retirement-read worker with its real private config and require it to stay
small, so the edge cannot come back unnoticed: 5,408 emitted files before
openclaw#197153, 58 after.

Refs openclaw#196079
Refs openclaw#196418

* ci(update): mount the installed-tree budget module in the Docker harness

The published-driver cell imports scripts/check-openclaw-installed-package-budget.mts,
which the harness did not mount, so the cell would fail on import.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S

Projects

None yet

1 participant