Skip to content

refactor(config): share TTS migration traversal - #130708

Merged
steipete merged 1 commit into
mainfrom
codex/cleanup20k-tts-migration-traversal-20260826
Aug 27, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/cleanup20k-tts-migration-traversal-20260826

Conversation

@steipete

@steipete steipete commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Related: #130637 (separate migration-persistence follow-up; not fixed by this cleanup).

What Problem This Solves

Doctor's TTS migration previews and repairs maintained separate copies of the same location and speaker/persona walks. Keeping those copies aligned made future maintenance unnecessarily error-prone.

Why This Change Was Made

Share the existing private traversal between detection and repair, retaining lazy preview termination and the supported-location exclusions. All four migration IDs, their order, messages, collision precedence, blocked-key handling, and public config behavior remain unchanged. Production is net −116 lines; tests add 98 lines. No files moved, generated output, dependencies, SDK, schema, defaults, or persistence changes.

User Impact

No intended user-visible change. Root and voice-call provider aliases retain their existing scope; speaker/enabled migrations retain their existing legacy-agent and supported channel locations. Unsupported agent defaults/keyed entries, Discord root/account-root TTS, and unknown plugins are not newly migrated.

During end-to-end verification, a preexisting Doctor persistence problem was independently reproduced on the unchanged base: legacy per-agent TTS repairs can be announced but not saved. Investigation of that repair also exposed authored environment-reference preservation requirements. The larger authored-migration-owner repair remains tracked in #130637; this PR does not claim to resolve it or alter its behavior.

Evidence

  • Exact-source differential: 57 fixtures compare detection metadata/matches, complete mutation output, ordered messages, and repeated application against the frozen base; all pass.
  • 30 focused tests and changed-file type-aware lint pass locally; the same 30 tests pass on pinned Linux Node 24/Vitest 4.1.11.
  • Complete pinned Linux changed gate passes, including production/core-test type-checking, lint, and all guards. Full build and all seven existing migration E2E tests pass.
  • Built CLI preview/fix/validate/repeat passes across eight processes for root migration with a current roster and for already-current config. Preview leaves config bytes untouched; repair preserves canonical agent TTS and the original owner-only backup; repeated repair makes no TTS changes. No provider credentials or running Gateway were used; isolated Gateway-unavailable diagnostics were expected.
  • The unchanged public per-agent defect probe reproduces the same result on both the frozen base and cleanup tree; this is regression-boundary evidence, not a claim that [Bug]: Doctor reports agent TTS repairs without saving them after roster normalization #130637 is fixed.
  • Complete precommit and distinct published-head Codex reviews pass with no actionable findings. Ordinary CI 33041664114, attempt 1, completed successfully at 0f51ba4269b9ac8706eb39ff24c053b5370eda23; no retries.
  • Actual hosted merge-candidate execution completed full builds and verified 48 built control-plane modules/Doctor closures. The final changed-config shard passed 2,967 tests across 212 files. These hosted results supplement, not replace, the focused TTS and eight-process CLI proof above.

This cleanup was AI-assisted and independently reviewed with Codex. The latest ClawSweeper comment was inspected before native preparation; it is still a review-start placeholder, with no published findings or Rank-up moves. No passing ClawSweeper verdict is claimed.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: M maintainer Maintainer-authored PR labels Aug 27, 2026
@steipete steipete self-assigned this Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 1:15 AM ET / 05:15 UTC.

ClawSweeper review

What this changes

The PR makes Doctor’s legacy-TTS detection and repair share one lazy traversal of supported configuration locations, and adds table-driven scope coverage.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: this is a member-authored, maintainer-labeled PR, so it is not eligible for automated cleanup. The reviewed source shows a coherent behavior-preserving consolidation; exact-head CI is still pending.

Priority: P3
Reviewed head: 0f51ba4269b9ac8706eb39ff24c053b5370eda23

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The implementation consolidates the correct owner boundary with useful scope and outcome coverage; only normal exact-head CI remains.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored refactor is exempt from the external-contributor proof gate; the PR body additionally describes built-CLI validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored refactor is exempt from the external-contributor proof gate; the PR body additionally describes built-CLI validation.
Evidence reviewed 7 items Shared traversal owner: The new generator enumerates root TTS, legacy agent-list, supported channel/account/voice locations, and the voice-call plugin while retaining blocked-key and Discord-root exclusions.
Detection and repair callers: Provider migration uses the intentionally narrower root/plugin input, while speaker and enabled migration both consume the shared full-location traversal.
Supported-location tests: The added table covers root, legacy list, supported channels and accounts, Discord exclusions, blocked keys, voice-call, unknown plugins, and malformed scopes; existing tests assert resulting migration messages and values.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs src/commands/doctor/shared/legacy-config-migrate.provider-shapes.test.ts

Result: PASS (completed)

[test] starting test/vitest/vitest.unit-fast.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130708-zIBdIS/target

 ✓  unit-fast  src/commands/doctor/shared/legacy-config-migrate.provider-shapes.test.ts (27 tests) 17ms

 Test Files  1 passed (1)
      Tests  27 passed (27)
   Start at  05:16:30
   Duration  565ms (transform 269ms, setup 110ms, import 269ms, tests 17ms, environment 0ms)

[test] passed 1 Vitest shard in 13.06s

Assertions:

  • NOT OBSERVED expect_output: previews only supported migrations — command exited successfully; expected output was not observed in the captured pane

How this fits together

Doctor inspects legacy configuration, reports migrations that can be safely repaired, then applies those repairs before writing config. This change centralizes the location walk used by TTS migration detection and mutation.

flowchart LR
A[Legacy configuration] --> B[Doctor issue detection]
B --> C[Shared TTS location traversal]
C --> D[Migration repairs]
D --> E[Validated configuration]
C --> F[Preview messages]
Loading

Before merge

  • Resolve merge risk (P1) - Required exact-head CI checks are still queued or running; merge should wait for their completion and green result.
  • Complete next step (P2) - This member-authored PR has no concrete repair finding; complete normal exact-head CI and merge review.
Agent review details

Security

None.

PR surface

Source -116, Tests +98. Total -18 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 75 191 -116
Tests 1 98 0 +98
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 173 191 -18

Review metrics

Metric Value Why it matters
Production versus test LOC production −116, tests +98 The branch removes duplicated migration traversal while adding focused scope coverage.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor/shared/legacy-config-migrate.provider-shapes.test.ts, migration/backfill/repair: src/commands/doctor/shared/legacy-config-migrations.runtime.tts.ts, unknown-data-model-change: src/commands/doctor/shared/legacy-config-migrate.provider-shapes.test.ts, unknown-data-model-change: src/commands/doctor/shared/legacy-config-migrations.runtime.tts.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the single shared lazy traversal and land it after exact-head CI confirms the preserved migration contract.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the single shared lazy traversal and land it after exact-head CI confirms the preserved migration contract.

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

Not applicable: this PR refactors existing migration traversal rather than reporting a new failure.

Is this the best way to solve the issue?

Yes: a shared traversal is the narrowest way to keep preview detection and repair scope aligned while preserving the deliberately narrower provider-alias scope.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 036e635c71cb.

Labels

Label changes:

  • add P3: This is a behavior-preserving Doctor refactor with no intended user-visible change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Label justifications:

  • P3: This is a behavior-preserving Doctor refactor with no intended user-visible change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Evidence

What I checked:

Likely related people:

  • steipete: Current-head history identifies this author as responsible for the consolidation and for recent related config work. (role: recent area contributor; confidence: high; commits: 0f51ba4269b9, 430c293ee04e; files: src/commands/doctor/shared/legacy-config-migrations.runtime.tts.ts, src/commands/doctor/shared/legacy-config-migrate.provider-shapes.test.ts)
  • Vincent Koc: History attributes the original TTS traversal and supported-path refactors to this contributor. (role: prior feature contributor; confidence: high; commits: 24fc2e9a88e7, daa382611f63, 1d0e9a907e6d; files: src/commands/doctor/shared/legacy-config-migrations.runtime.tts.ts)

Rank-up moves

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

  • Wait for all required exact-head checks to complete successfully before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for 0f51ba4269b9ac8706eb39ff24c053b5370eda23.

This AI-assisted private traversal cleanup removes 116 production lines and adds 98 behavioral test lines. It preserves the four migration IDs/order, supported-location exclusions, blocked-key handling, collision precedence, ordered messages and repeat no-op behavior. No config/schema/default/persistence/API change is included.

Verified commands and evidence:

  • Actual-source differential: node --import tsx /tmp/cleanup20k-tts-traversal-differential.mjs — 57 frozen-base/candidate fixtures agree on metadata, detection, output, messages/order and repeat behavior.
  • node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/commands/doctor/shared/legacy-config-migrate.provider-shapes.test.ts src/commands/doctor/shared/legacy-config-migrations.runtime.tts.ts; node scripts/run-tsgo.mjs -b test/tsconfig/tsconfig.core.test.commands.json --builders 1; the two focused provider-shapes/validation suites — pinned Linux proof passed, 30 tests.
  • OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 node scripts/check-changed.mjs --base 43be187b6727a47030dbbba4256eaad89937bded --staged — complete changed gate passed on the frozen two-file tree.
  • node --import tsx scripts/build-all.mts; OPENCLAW_E2E_USE_PREBUILT_DIST=1 OPENCLAW_VITEST_MAX_WORKERS=3 node scripts/run-vitest.mjs src/commands/doctor/shared/legacy-config-migrate.e2e.test.ts — full build and all seven existing migration E2E tests passed. Clean-machine proof: Testbox run 33039215609, owned lease stopped after source/artifact cleanup.
  • Eight real built CLI processes exercised doctor --non-interactive --no-workspace-suggestions, doctor --fix, config validate and repeated repair for root-legacy/current-roster and fully current config. Preview preserved config bytes; repairs preserved canonical root/agent TTS and an owner-only original backup; repeated repair made no TTS changes.
  • Complete precommit and separate published-head Codex reviews passed with no actionable findings. Ordinary CI 33041664114, attempt 1, completed successfully on the exact head, without retry. Hosted logs show merge candidate 281efaf2 integrating this head into a678ed6565c209023ceb962d849972fc962497f6: build-artifacts job 98416543446 actually built and verified 48 native control-plane/Doctor modules; job 98416550742 completed a full build and 2,967 tests in 212 files.

Known boundary: #130637 remains open and unfixed. The unchanged public diagnostic reproduces the same legacy per-agent persistence loss on both baseline and candidate. No provider credentials or running Gateway were used; isolated Gateway-unavailable diagnostics were expected. This is not live-provider proof.

The latest ClawSweeper comment (5434667301) was read in full before preparation and remains a review-start placeholder; there are no published findings or Rank-up moves to disposition. No passing bot verdict is inferred from the placeholder. Native preparation/merge will enforce the exact head and required CI gate.

@steipete
steipete merged commit dd7e0ea into main Aug 27, 2026
208 checks passed
@steipete
steipete deleted the codex/cleanup20k-tts-migration-traversal-20260826 branch August 27, 2026 05:33
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant