Repository navigation
improve(doctor): updates scan retained transcripts once instead of twice - #177933
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: needs maintainer review before merge. What this changesThis PR carries clean transcript-label scan receipts between update-time Doctor passes so unchanged history is scanned once. Example: An update inspects six archived sessions containing 120 retained events.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Both prior tooling findings are fixed, and no remaining correctness or security defect was found; the exact-head CI gate remains red because of a separately observed UI timeout. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe updater invokes candidate Doctor before and after plugin convergence; Doctor inspects retained agent transcripts and returns optional scan receipts through its existing result channel. flowchart TD
A[Installed updater] --> B[Pre-plugin Doctor]
B --> C[Transcript label scanner]
C --> D[Existing database observations]
B --> E[Operation-local receipt]
E --> F[Post-plugin Doctor]
F --> D
F --> C
Technical reviewBest possible solution: Keep scan reuse within the existing update receipt lifecycle, preserving full scans whenever identity or write evidence differs. Do we have a high-confidence way to reproduce the issue? Current main invokes the same exhaustive label scanner in both Doctor passes without sharing its clean result; this read-only review ran no target code. Is this the best way to solve the issue? The patch follows the smallest complete ownership path: record the scanner's clean result, transport it through existing Doctor receipts, and reuse existing database observations instead of adding another fingerprint pass. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 38c85c2fe231. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +343, Tests +496, Other +1. Total +840 across 11 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 19, 2026, 11:05 PM ET / October 20, 2026, 03:05 UTC (Revision 2). |
|
Both findings are fixed on head
The remaining CI red, @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
The pre-plugin and post-plugin Doctor processes of one update both scanned every retained transcript for labels. A complete, clean scan now returns a receipt through the existing Doctor result channel; the installed driver keeps it for that operation only and passes it to the post-plugin Doctor. Reuse requires unchanged physical database generations, native write tokens and file-family observations. Any missing, stale, invalid or oversized receipt falls back to a full scan. The three legacy-cron substeps are now timed separately.
The backup inventory records canonical database paths, but Doctor can discover a database through a symlinked state directory, so a clean scan was never reused. Reuse now matches by the canonical owner, and the scan, its read connection and any repair use that admitted owner instead of the mutable alias. A scan whose alias changes while it runs is not certified. Routine missing, stale, empty or oversized hints rescan quietly; malformed hints still warn.
…rt checks update-doctor-result now imports the scan-receipt schema at module load. The PR wrapper's runtime inventory did not list that module, and the production restart fixture stubbed it, so its schema was not callable. Both now include the real module.
9d9e4a0 to
bd29e41
Compare
The cron readiness process test capped itself at 45s while Doctor, Gateway start, and status each run in sequence under their own 30s deadlines. On a loaded runner every child finished within its deadline and Vitest still killed the test 37ms past the cap. Derive the budget from the child deadlines through getCliProcessTestTimeout like the rest of the file.
|
Merged via squash.
|
…ice (openclaw#177933) * perf(doctor): reuse clean transcript-label scans within one update The pre-plugin and post-plugin Doctor processes of one update both scanned every retained transcript for labels. A complete, clean scan now returns a receipt through the existing Doctor result channel; the installed driver keeps it for that operation only and passes it to the post-plugin Doctor. Reuse requires unchanged physical database generations, native write tokens and file-family observations. Any missing, stale, invalid or oversized receipt falls back to a full scan. The three legacy-cron substeps are now timed separately. * fix(doctor): bind transcript-scan reuse to the canonical database owner The backup inventory records canonical database paths, but Doctor can discover a database through a symlinked state directory, so a clean scan was never reused. Reuse now matches by the canonical owner, and the scan, its read connection and any repair use that admitted owner instead of the mutable alias. A scan whose alias changes while it runs is not certified. Routine missing, stale, empty or oversized hints rescan quietly; malformed hints still warn. * test(update): load the Doctor scan-receipt owner in wrapper and restart checks update-doctor-result now imports the scan-receipt schema at module load. The PR wrapper's runtime inventory did not list that module, and the production restart fixture stubbed it, so its schema was not callable. Both now include the real module. * test(doctor): budget the cron readiness test for its child deadlines The cron readiness process test capped itself at 45s while Doctor, Gateway start, and status each run in sequence under their own 30s deadlines. On a loaded runner every child finished within its deadline and Vitest still killed the test 37ms past the cap. Derive the budget from the child deadlines through getCliProcessTestTimeout like the rest of the file.
Prune 70 stale max-lines entries (508 -> 438). Reconcile the counted OPENCLAW_* budget from 452 -> 461 and rename the internal agent FTS schema constant. Record FACTORY_GITHUB_PROOF, FACTORY_ACTOR_ID, FACTORY_SESSION_KEY (#173668), IMAGE_ACTIVATION_CAPTURE_MARKER (#173711), UPDATE_DOCTOR_HISTORICAL_SCANS (#177933), SESSION_WATCHDOG (#176915), PACKAGE_PERMISSIONS_REPAIRED (#175423), PLUGIN_NPM_ROOTS_FALLBACK (#176121), DISABLE_CRON_HOST_EXECUTION and DISABLE_GATEWAY_LOCAL_TERMINALS (#177855), and the removal of DEVICE_NAME_PREFIX (#178345). All names above use the OPENCLAW_ prefix. AGENT_FTS_SCHEMAS is an internal constant, not an environment variable.
* fix(ci): block baseline inventory drift in CI and keep shard size advisory The max-lines suppression inventory and the OPENCLAW_* budget used the limit severity policy, so GitHub Actions only annotated a tree that disagreed with its own inventory. Main absorbed moved suppressions, stale entries, and unrecorded env names with green CI, and every later local ratchet run failed on debt the branch did not create. Inventory/tree consistency (unlisted suppression, stale entry, name count different from the budget) now blocks everywhere, like the sibling shrink ratchets. Growth relative to the merge base keeps the limit policy so owner-approved growth still lands with a CI warning. The core tsgo shard root budget is a shared cost signal its contract marks advisory; routing it through the limit reporter made it locally fatal. It now warns everywhere. Proof: new ratchet and env-budget regressions fail on the base scripts and pass with the fix; the real boundary check on main's shard layout exits 0 with four advisory warnings instead of failing. * ci(tsgo): rebalance core test shards under the root budget agents-tools (722), gateway-root (725), infra (728), and plugins-platform (728) exceeded the advisory 720-root limit. Move whole test globs to shards with headroom: src/media to messaging, src/acp to gateway-other, src/security to config-cli, and root src/gateway/github* to gateway-methods. The largest shard is now 719 roots and exactly-once ownership holds. Messaging test-root selection of the shard guard now includes src/media. * ci(tsgo): move agents CLI backend tests into the commands shard Newer main tests pushed agents-root to 722 roots. Root-level src/agents/cli-*.test.ts files join the commands shard, which already owns src/agents/command and CLI program tests: agents-root 693, commands 516. * test(ui): split chat message rendering coverage Preserve current main coverage across grouping, markdown, tools, attachments, and images, sharing render lifecycle and attachment fixtures. Keep all 59 direct cases and eight parameterized declarations, expanding to the same 79 passing tests. The image disclosure case now waits for its lazy renderer instead of depending on an earlier image test. All seven files have line-cap headroom; UI types and scoped lint pass. Independent review found no actionable P0-P2 defects. * chore(ci): reconcile max-lines baseline and env budget with main Prune 70 stale max-lines entries (508 -> 438). Reconcile the counted OPENCLAW_* budget from 452 -> 461 and rename the internal agent FTS schema constant. Record FACTORY_GITHUB_PROOF, FACTORY_ACTOR_ID, FACTORY_SESSION_KEY (#173668), IMAGE_ACTIVATION_CAPTURE_MARKER (#173711), UPDATE_DOCTOR_HISTORICAL_SCANS (#177933), SESSION_WATCHDOG (#176915), PACKAGE_PERMISSIONS_REPAIRED (#175423), PLUGIN_NPM_ROOTS_FALLBACK (#176121), DISABLE_CRON_HOST_EXECUTION and DISABLE_GATEWAY_LOCAL_TERMINALS (#177855), and the removal of DEVICE_NAME_PREFIX (#178345). All names above use the OPENCLAW_ prefix. AGENT_FTS_SCHEMAS is an internal constant, not an environment variable.
…aw#179181) * fix(ci): block baseline inventory drift in CI and keep shard size advisory The max-lines suppression inventory and the OPENCLAW_* budget used the limit severity policy, so GitHub Actions only annotated a tree that disagreed with its own inventory. Main absorbed moved suppressions, stale entries, and unrecorded env names with green CI, and every later local ratchet run failed on debt the branch did not create. Inventory/tree consistency (unlisted suppression, stale entry, name count different from the budget) now blocks everywhere, like the sibling shrink ratchets. Growth relative to the merge base keeps the limit policy so owner-approved growth still lands with a CI warning. The core tsgo shard root budget is a shared cost signal its contract marks advisory; routing it through the limit reporter made it locally fatal. It now warns everywhere. Proof: new ratchet and env-budget regressions fail on the base scripts and pass with the fix; the real boundary check on main's shard layout exits 0 with four advisory warnings instead of failing. * ci(tsgo): rebalance core test shards under the root budget agents-tools (722), gateway-root (725), infra (728), and plugins-platform (728) exceeded the advisory 720-root limit. Move whole test globs to shards with headroom: src/media to messaging, src/acp to gateway-other, src/security to config-cli, and root src/gateway/github* to gateway-methods. The largest shard is now 719 roots and exactly-once ownership holds. Messaging test-root selection of the shard guard now includes src/media. * ci(tsgo): move agents CLI backend tests into the commands shard Newer main tests pushed agents-root to 722 roots. Root-level src/agents/cli-*.test.ts files join the commands shard, which already owns src/agents/command and CLI program tests: agents-root 693, commands 516. * test(ui): split chat message rendering coverage Preserve current main coverage across grouping, markdown, tools, attachments, and images, sharing render lifecycle and attachment fixtures. Keep all 59 direct cases and eight parameterized declarations, expanding to the same 79 passing tests. The image disclosure case now waits for its lazy renderer instead of depending on an earlier image test. All seven files have line-cap headroom; UI types and scoped lint pass. Independent review found no actionable P0-P2 defects. * chore(ci): reconcile max-lines baseline and env budget with main Prune 70 stale max-lines entries (508 -> 438). Reconcile the counted OPENCLAW_* budget from 452 -> 461 and rename the internal agent FTS schema constant. Record FACTORY_GITHUB_PROOF, FACTORY_ACTOR_ID, FACTORY_SESSION_KEY (openclaw#173668), IMAGE_ACTIVATION_CAPTURE_MARKER (openclaw#173711), UPDATE_DOCTOR_HISTORICAL_SCANS (openclaw#177933), SESSION_WATCHDOG (openclaw#176915), PACKAGE_PERMISSIONS_REPAIRED (openclaw#175423), PLUGIN_NPM_ROOTS_FALLBACK (openclaw#176121), DISABLE_CRON_HOST_EXECUTION and DISABLE_GATEWAY_LOCAL_TERMINALS (openclaw#177855), and the removal of DEVICE_NAME_PREFIX (openclaw#178345). All names above use the OPENCLAW_ prefix. AGENT_FTS_SCHEMAS is an internal constant, not an environment variable.
What Problem This Solves
Each
openclaw updatescans every retained session transcript for legacy labels twice, once in the pre-plugin Doctor pass and again in the post-plugin pass, which adds minutes on installations with large histories.User Impact
User impact: when the first Doctor pass completes a clean label scan and the databases have not changed, the second pass in the same update reuses it instead of reading every transcript again. Any change, doubt or missing information still produces a full scan, and real findings are reported both times. There is no new setting.
This needs the installed updater to carry the scan receipt between its two Doctor passes, so the saving starts with the update after this release is installed. An older installed updater simply rescans, with no warnings.
Why This Change Was Made
A complete, clean scan returns a receipt through the existing Doctor result channel. The installed driver keeps it for that update only and passes it to the post-plugin Doctor. Reuse requires unchanged physical database generations, native write tokens and file-family observations, matched by the canonical database path that the backup inventory uses. The scan, its read connection and any repair are bound to that admitted database, so a state directory reached through a symlink is reused correctly, and a scan whose symlink changes while it runs is never certified. Missing, stale, empty or oversized hints rescan quietly; a malformed hint keeps a warning. The three legacy-cron Doctor substeps are now timed separately.
Evidence
latestdriver (2026.10.5) updated to a candidate packed from an earlier revision of all six fixes together (commit3331e8d12be, before the latest rebase): update finished,readyz200, running version verified, durable and incognito session data unchanged.doctor-config-preflightcron readiness process test capped itself at 45s while Doctor, Gateway start and status run in sequence under their own 30s deadlines. On a loaded bun runner every child finished inside its deadline and Vitest still stopped the test at 45037ms; every test in that shard ran 2-3x slower than the earlier passing run, including ones that never reach the transcript scan. The budget now comes from the child deadlines through the file'sgetCliProcessTestTimeouthelper (whole file 27/27 locally; most of that diff is formatter re-indentation).update-doctor-resultnow imports the scan-receipt schema at load, so the PR wrapper inventory and the production restart-outcome fixture include that module (3 failing tooling tests before, 20/20 after).