Repository navigation
fix(doctor): count selected bootstrap hook files - #137351
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 6, 2026, 9:17 AM ET / 13:17 UTC. ClawSweeper reviewWhat this changesDoctor includes selected bundled bootstrap-hook files in its size warnings and counts each file by its source path before sandbox paths are remapped. Merge readiness⛔ Blocked before merge - 1 item remains This remains a useful, well-supported fix absent from current main and the latest release. No blocking introduced defect was found. The previous migration-proof warning does not apply: the patch changes diagnostic accounting without changing a stored format or migration contract. Priority: P2 Review scores
Verification
How this fits togetherBootstrap preparation loads workspace instructions, applies hooks, and limits the context sent to an agent. Doctor estimates those limits so operators can identify truncated or omitted files before running an agent. flowchart TD
A[Agent workspace and configuration] --> B[Fresh startup hook selection]
B --> C[Bundled extra file declarations]
A --> D[Standard bootstrap files]
C --> E[Shared filters and character budgets]
D --> E
E --> F[Source path accounting]
F --> G[Doctor warnings]
F --> H[Agent prompt path remapping]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +82, Tests +289, Docs +3, Other -1. Total +373 across 19 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Use the shared declarative loader and existing bootstrap pipeline to keep Doctor totals accurate while preserving custom-hook execution boundaries. Do we have a high-confidence way to reproduce the issue? Yes. Enable the bundled extra-files hook with an oversized nested instruction file and compare standalone Doctor with a real turn; current-main source explains the omission, and supplied before/after observations demonstrate it. This review did not execute target code. Is this the best way to solve the issue? Yes. Sharing declaration loading and selection avoids running arbitrary hooks in Doctor, while accounting before path remapping removes the ambiguous basename fallback without changing the injected content. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 71480cc6509c. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (14 earlier review cycles; latest 8 shown)
|
|
Note on the automated review pass for revision The The first revision ( |
|
Revision The PR body's Evidence section now carries the import-walk comparison, the focused test / |
3e2ae93 to
9955395
Compare
|
Revision The body carries the item-by-item response, the pre-fix failure output, test runs, |
buildBootstrapInjectionStats fell back from an unmatched source path to the first injected file sharing the bootstrap file's name, then its basename. With the doctor now projecting bootstrap-extra-files additions, a nested AGENTS.md that the total budget dropped inherited the root AGENTS.md bytes: the doctor reported it as fully injected, doubled the total, and emitted no truncation warning in either the note or the health-check surface. Injected content is now matched only by the source path both sides resolved from. The one caller whose injected paths diverge from that identity is the embedded runner's sandbox workspace remap, which now builds its stats before rewriting the paths rather than relying on the fallback to find them again.
…ction Doctor resolved hook precedence over the best-effort inspection set, which drops handlerless candidates first, so a higher-precedence replacement that lost its handler stopped shadowing the bundled bootstrap-extra-files hook and doctor projected its files. A live Gateway keeps that source: its atomic reload resolves precedence over invalid candidates, throws, and stays on the previous generation, so the bundled handler never becomes active. Resolve doctor's selection over the same candidate set the atomic loader uses and keep the loadability filter after it, so a shadowed bundled hook projects nothing. Best-effort startup discovery is unchanged.
…iles.test.ts Main's agents-root core test shard sits at the 720 test-root limit enforced by scripts/check-tsgo-core-boundary.mts, so the new diagnostics test file pushed it to 721 and failed check-additional-boundaries. Move the cases into the existing bootstrap-files test file; no production change. Co-Authored-By: Claude Fable 5.1 <[email protected]>
7e7fb55 to
a47a94d
Compare
…size report Doctor runs without the internal hook runtime, so the bundled bootstrap-extra-files additions never reached its "Bootstrap file size" report or the core/doctor/bootstrap-size finding. Share the hook's declarative config resolver and resolve doctor's bootstrap context through a diagnostics mode that appends those files to the canonical pipeline without loading hook code. Closes openclaw#137308
…ds them Managed and plugin hooks may replace the bundled bootstrap-extra-files hook by name. Share the loader's discovery-plus-eligibility selection as resolveLoadableHookEntries and let doctor's diagnostics project the bundled additions only when that selection would register the bundled handler, so doctor never describes files a replacement does not add.
bootstrap-files.ts statically imported declared-files, which pulls hook workspace discovery, plugin hook discovery, and plugin metadata into every run and preparation bootstrap resolution even though only doctor needs it. Keep that chain behind src/agents/bootstrap-files-diagnostics.ts; the runtime module only accepts already-projected hook files.
buildBootstrapInjectionStats fell back from an unmatched source path to the first injected file sharing the bootstrap file's name, then its basename. With the doctor now projecting bootstrap-extra-files additions, a nested AGENTS.md that the total budget dropped inherited the root AGENTS.md bytes: the doctor reported it as fully injected, doubled the total, and emitted no truncation warning in either the note or the health-check surface. Injected content is now matched only by the source path both sides resolved from. The one caller whose injected paths diverge from that identity is the embedded runner's sandbox workspace remap, which now builds its stats before rewriting the paths rather than relying on the fallback to find them again.
…ction Doctor resolved hook precedence over the best-effort inspection set, which drops handlerless candidates first, so a higher-precedence replacement that lost its handler stopped shadowing the bundled bootstrap-extra-files hook and doctor projected its files. A live Gateway keeps that source: its atomic reload resolves precedence over invalid candidates, throws, and stays on the previous generation, so the bundled handler never becomes active. Resolve doctor's selection over the same candidate set the atomic loader uses and keep the loadability filter after it, so a shadowed bundled hook projects nothing. Best-effort startup discovery is unchanged.
…iles.test.ts Main's agents-root core test shard sits at the 720 test-root limit enforced by scripts/check-tsgo-core-boundary.mts, so the new diagnostics test file pushed it to 721 and failed check-additional-boundaries. Move the cases into the existing bootstrap-files test file; no production change. Co-Authored-By: Claude Fable 5.1 <[email protected]>
a47a94d to
2fd5bd8
Compare
Keep the refreshed contributor series and the verified Doctor repair in the branch ancestry. Specify the source bootstrap workspace explicitly in remap coverage.
|
The repair at CI is blocked by the shared preflight output-size failure: run 34025293221 stopped before tests could start. Replaying the captured manifest with #140036 reduces the Node matrix from 1,022,576 to 982,474 UTF-16 bytes while preserving all 107 rows, 260 groups, and consumed test inputs. The Doctor patch itself adds no bytes under the matched planner inputs. Waiting for that maintainer-owned CI repair, then this PR still needs a fresh successful CI run before landing. |
|
Thanks for the landing review. On the preflight boundary: #140018 (opened earlier today) is the companion fix from the other side of #140036. It gzip+base64-packs each Node row's Either way, I will re-run CI here as soon as the CI repair is on |
|
#140018 is on |
|
Thanks @ylcn91! Landed in 5900431. Proof: 17 independent controls passed through the shipped Doctor and Gateway, with 18 real agent turns and 34 Doctor commands. The final head passed CI and exact-head review.
Gateway selection and reload policy stay intact. Doctor predicts a fresh start; it does not inspect a handler generation retained after failed reload. Sandbox proof covers remapped prompt accounting, not remote command execution or write-denial enforcement. CI run succeeded with 141 jobs passed and 15 skipped. The shared preflight output issue was resolved by #140018; no failing-CI exception was used. |
Count declarative bootstrap-extra-files content using the Gateway's fresh-start selection and existing per-agent filters and limits. Keep custom hook execution out of Doctor and account injected content by source path before sandbox remapping. Fixes openclaw#137308. Co-authored-by: Ayaan Zaidi <[email protected]>

Closes #137308.
What Problem This Solves
Fixes an issue where operators running Doctor with the bundled
bootstrap-extra-fileshook enabled received lower bootstrap totals than a real agent turn. Hook-added files could exceed the per-file limit or be dropped by the total budget without appearing in Doctor's warnings.Why This Change Was Made
Doctor now projects the selected bundled declaration through the normal per-agent bootstrap filters and budgets, using the Gateway's existing fresh-start discovery and eligibility rules without importing or executing custom hook handlers. Accounting matches canonical source paths before sandbox prompt paths are remapped, so a dropped nested
AGENTS.mdcannot inherit another file's count.User Impact
Doctor reports the selected extra files, exact raw and injected counts, percentages, and limit causes for each configured agent. Gateway hook selection and reload behavior remain unchanged. The report predicts a fresh Gateway start; it does not inspect a prior hook generation retained after failed reload.
Evidence
AGENTS.mddropped by the total budget reports 0 injected characters. A real sandboxed turn under SSH configuration keeps distinct source-path counts while delivering remapped prompt paths. This tests prompt accounting, not remote command execution or write-denial enforcement.f6c4b2159e59passed its normal build, four affected tests, remaining lint and guards, budget regression red/green, and fresh code-aware review.24547784c7basucceeded with 141 jobs passed and 15 skipped; an exact-head review gates landing.Preserves the original contribution by @ylcn91.