Skip to content

fix(doctor): count selected bootstrap hook files - #137351

Merged
obviyus merged 17 commits into
openclaw:mainfrom
ylcn91:fix/doctor-bootstrap-extra-files
Sep 6, 2026
Merged

obviyus merged 17 commits into
openclaw:mainfrom
ylcn91:fix/doctor-bootstrap-extra-files

Conversation

@ylcn91

@ylcn91 ylcn91 commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes #137308.

What Problem This Solves

Fixes an issue where operators running Doctor with the bundled bootstrap-extra-files hook 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.md cannot 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

  • Original fixture: Doctor reported 9,001 raw / 9,001 injected characters while the real turn received 34,003 raw / 19,000 injected from existing files. The repaired Doctor matches 34,003 / 19,000 and reports the extra file's per-file truncation.
  • A nested AGENTS.md dropped 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.
  • Preserved pre-integration repair: 173 focused checks passed, plus core and test typechecks. The built repair at f6c4b2159e59 passed its normal build, four affected tests, remaining lint and guards, budget regression red/green, and fresh code-aware review.
  • Independent acceptance on that build passed all 17 controls, with 18 real agent turns, complete provider-request captures, and 34 standalone Doctor commands. It preserved six completed cases after a resource stop and ran only the interrupted and unrun controls on the unchanged final build.
  • Real Doctor and Gateway/provider-request captures cover per-file and total limits, replacement selection, disabled hooks, unreadable files, multiple agents, and custom-hook non-execution in diagnostics.
  • Ordinary bootstrap's static relative import graph remains unchanged; the bundled handler adds only the shared declarative loader. No new configuration, schema, persistence, or Gateway selection/reload policy is introduced. The contributor’s conflict-free main merge preserves the repair and its behavior evidence. CI on 24547784c7ba succeeded with 141 jobs passed and 15 skipped; an exact-head review gates landing.

Preserves the original contribution by @ylcn91.

@clawsweeper

clawsweeper Bot commented Sep 3, 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 commands Command implementations agents Agent runtime and tooling labels Sep 3, 2026
@ylcn91
ylcn91 marked this pull request as ready for review September 3, 2026 14:30
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 6, 2026, 9:17 AM ET / 13:17 UTC.

ClawSweeper review

What this changes

Doctor 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
Reviewed head: 24547784c7ba8aeea7c435fc20d2890c6b1d72c8

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused owner-level repair with concrete before/after observations, meaningful regression coverage, and no remaining actionable finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The captured standalone Doctor and real Gateway/provider-request observations exercise the changed diagnostic resolver and source-path accounting: totals match at 34,003 raw/19,000 injected, dropped files count zero, and sandbox prompt paths remain remapped. Relevant production blobs match the previously proven head.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured standalone Doctor and real Gateway/provider-request observations exercise the changed diagnostic resolver and source-path accounting: totals match at 34,003 raw/19,000 injected, dropped files count zero, and sandbox prompt paths remain remapped. Relevant production blobs match the previously proven head.
Evidence reviewed 9 items Current main still needs the repair: Doctor still calls resolveBootstrapContextForRun, which depends on registered runtime hooks rather than projecting the selected bundled declaration.
Latest release retains the affected path: The supplied latest release, v2026.9.2, also uses the runtime bootstrap resolver in Doctor; the reviewed repair is not present in that release.
Shared selection with a diagnostic-only entrypoint: The new diagnostic resolver checks the bundled winner using existing discovery and eligibility rules, then loads declarations without importing custom handlers. Gateway loader changes extract equivalent predicates rather than alter publication or reload policy.
Findings None None.
Security None None.

How this fits together

Bootstrap 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]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +82, Tests +289, Docs +3, Other -1. Total +373 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 10 164 82 +82
Tests 7 314 25 +289
Docs 1 3 0 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 19 481 108 +373

Review metrics

Metric Value Why it matters
Production and regression coverage Production +82 net lines; tests +289 net lines Production growth provides the diagnostic-only entrypoint and shared declaration loader; regression coverage protects selection, dropped-file accounting, and sandbox remapping.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/flows/doctor-core-checks.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #137308
Summary: This PR is the explicit candidate repair for the reported Doctor undercount.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best 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.

Labels

Label justifications:

  • P2: Incorrect bootstrap diagnostics hide truncation and budget exhaustion for operators using bundled extra files, with a bounded affected surface.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured standalone Doctor and real Gateway/provider-request observations exercise the changed diagnostic resolver and source-path accounting: totals match at 34,003 raw/19,000 injected, dropped files count zero, and sandbox prompt paths remain remapped. Relevant production blobs match the previously proven head.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured standalone Doctor and real Gateway/provider-request observations exercise the changed diagnostic resolver and source-path accounting: totals match at 34,003 raw/19,000 injected, dropped files count zero, and sandbox prompt paths remain remapped. Relevant production blobs match the previously proven head.

Evidence

What I checked:

  • Current main still needs the repair: Doctor still calls resolveBootstrapContextForRun, which depends on registered runtime hooks rather than projecting the selected bundled declaration. (src/commands/doctor-bootstrap-size.ts:59, 71480cc6509c)
  • Latest release retains the affected path: The supplied latest release, v2026.9.2, also uses the runtime bootstrap resolver in Doctor; the reviewed repair is not present in that release. (src/commands/doctor-bootstrap-size.ts:59, 3928bad9badf)
  • Shared selection with a diagnostic-only entrypoint: The new diagnostic resolver checks the bundled winner using existing discovery and eligibility rules, then loads declarations without importing custom handlers. Gateway loader changes extract equivalent predicates rather than alter publication or reload policy. (src/agents/bootstrap-files-diagnostics.ts:10, 24547784c7ba)
  • Fresh startup and retained reload state are distinct: Best-effort discovery removes handlerless candidates before precedence resolution; atomic reload can retain obligations from previous sources. The patch deliberately predicts fresh startup, documents that limit, and tests valid, invalid-export, import-failing, and handlerless replacements. The historical request to preserve invalid replacement shadowing is therefore not an outstanding defect under this documented scope. (src/hooks/workspace.ts:283, 24547784c7ba)
  • Accounting repair preserves runtime callers: Injection statistics now match source paths exactly, preventing a budget-dropped nested file from borrowing a sibling's count. Embedded preparation computes statistics before remapping; the CLI and context-report callers already retain matching source paths. The projected diagnostic path reuses existing filters and budgets with readOnlyState enabled. (src/agents/embedded-agent-runner/run/attempt-bootstrap-prepare.ts:142, 24547784c7ba)
  • Captured real behavior evidence: The supplied PR body at context revision 3cc19631a39c8a2af2690f524a81ea834e8791df8e93077e6b8d6abaafd90910 reports standalone Doctor changing from 9,001 raw/9,001 injected to 34,003 raw/19,000 injected, matching real agent input. It also reports zero injection for a dropped nested AGENTS.md, sandbox remapping, and 17 acceptance controls covering 18 real turns and 34 Doctor commands. The completion is corroborated at fix(doctor): count selected bootstrap hook files #137351 (comment). These are supplied observations, not executions performed during this review. (f6c4b2159e59)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

History

Review history (14 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-04T18:50:47.220Z sha 8506162cd634c958c6543abf2bc3f25b978b6a6d :: blocked before merge. :: [P2] Preserve invalid replacement shadowing in diagnostics
  • reviewed 2026-09-04T20:51:53.727Z sha 1fd41cd449ca437a5f63457b9e51ae2269e1e060 :: blocked before merge. :: none
  • reviewed 2026-09-05T14:16:48.490Z sha 8e1cf35450c80c329f976541ceb34834cbf16965 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-05T14:54:47.634Z sha a405451b7ff5cc865e9c05afd08b507ef66e3694 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-05T16:53:49.763Z sha 7e7fb5536c07ac786fe55913e36db30efe6aefc8 :: needs changes before merge. :: none
  • reviewed 2026-09-05T18:41:46.798Z sha a47a94d :: needs maintainer review before merge. :: none
  • reviewed 2026-09-06T07:41:59.989Z sha 2fd5bd8 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-06T09:54:31.350Z sha f6c4b21 :: blocked before merge. :: none

@ylcn91

ylcn91 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Note on the automated review pass for revision f0bcbf7.

The autoreview rerun for this revision could not complete because the Codex backend is returning HTTP 404 on every request (chatgpt.com/backend-api/codex/models and /responses, two attempts, five reconnects each). That matches the active OpenAI incident "Elevated errors across ChatGPT and Codex" (status.openai.com, investigating at the time of this comment):

OpenAI status page showing the active ChatGPT and Codex incident

The first revision (c0870d9) was reviewed clean by Codex before the incident. For this revision the evidence stays what the PR body lists: focused tests including the managed-replacement regression, pnpm check:changed, pnpm build, and the real openclaw doctor output from an isolated state dir. I will rerun autoreview once the incident clears and update the body with its result.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 3, 2026
@ylcn91

ylcn91 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Revision f84b683 addresses the review finding: the bundled-hook projection moved out of src/agents/bootstrap-files.ts into the leaf module src/agents/bootstrap-files-diagnostics.ts, so ordinary run and preparation bootstrap keep main's module graph (static-import walk: 1,254 modules on main and on f84b683, 1,264 on f0bcbf7; the ten extra were the hook workspace/plugin-hook/declared-files chain). 3e2ae93 on top is a JSDoc-only note in declared-files.ts recording why hook discovery resolves the Gateway-owned workspace rather than the analyzed one.

The PR body's Evidence section now carries the import-walk comparison, the focused test / check:changed / build results, and a Codex autoreview of the full candidate (--mode local --base 2d17bbaf88a, P1 threshold): scoped-clean. The earlier autoreview gap on f0bcbf7 was the OpenAI Codex incident and is superseded by that pass.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 3, 2026
@ylcn91
ylcn91 force-pushed the fix/doctor-bootstrap-extra-files branch from 3e2ae93 to 9955395 Compare September 4, 2026 07:43
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 4, 2026
@ylcn91

ylcn91 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Revision dbe6efe addresses the P2 finding. buildBootstrapInjectionStats now matches injected content only by source path; the name and basename fallbacks are gone, so a file the total budget dropped reports 0 injected chars and its truncation warning in both Doctor modes. The one caller that relied on the basename hop, the embedded runner's sandbox workspace remap, now builds its stats before remapping paths (the remap rewrites only path), and a guard test pins that ordering. The exhaustion regression (root AGENTS.md 1,000 chars, packages/core/AGENTS.md 500 chars, bootstrapTotalMaxChars: 1000) fails on 9955395 at the owner, in Doctor note mode, and in health-check mode, and passes now. Production delta of the revision is −2 lines; the branch is rebased onto main at 0d2169f.

The body carries the item-by-item response, the pre-fix failure output, test runs, check:changed, the autoreview outcome, and three named follow-ups (the Codex plugin's copy of this accounting, same-basename rows in Doctor note mode, and the silent drop in buildBootstrapContextFiles).

ylcn91 and others added 3 commits September 5, 2026 18:34
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]>
@ylcn91
ylcn91 force-pushed the fix/doctor-bootstrap-extra-files branch from 7e7fb55 to a47a94d Compare September 5, 2026 18:35
@obviyus obviyus self-assigned this Sep 6, 2026
obviyus and others added 8 commits September 6, 2026 09:03
…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]>
@ylcn91
ylcn91 force-pushed the fix/doctor-bootstrap-extra-files branch from a47a94d to 2fd5bd8 Compare September 6, 2026 07:35
Keep the refreshed contributor series and the verified Doctor repair in the branch ancestry. Specify the source bootstrap workspace explicitly in remap coverage.
@obviyus obviyus changed the title fix(doctor): bootstrap size report omits files added by the bootstrap-extra-files hook fix(doctor): count selected bootstrap hook files Sep 6, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 6, 2026
@obviyus

obviyus commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

The repair at f6c4b2159e59 has passed all 17 independent behavior controls and the exact-head landing review.

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.

@ylcn91

ylcn91 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

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 groups at the job-output boundary so the ~383K characters of includePatterns stop counting against the budget, which leaves real headroom after #140036's trim lands. Details in a comment on #140036.

Either way, I will re-run CI here as soon as the CI repair is on main.

@ylcn91

ylcn91 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

#140018 is on main, so this is the fresh CI run: merged main (427abe8) into the branch as 2454778. No force-push; da29d02 and f6c4b21 are kept as they are, and the merge has no conflicts and no code changes. The bootstrap/doctor test files on the branch (bootstrap-budget, bootstrap-files, attempt-bootstrap-prepare, system-prompt-report, doctor-bootstrap-size, doctor-core-bootstrap-size-check) pass locally.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime labels Sep 6, 2026
@obviyus
obviyus merged commit 5900431 into openclaw:main Sep 6, 2026
219 checks passed
@obviyus

obviyus commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

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.

  • Bug: standalone Doctor omitted selected bootstrap-extra-files content from its totals and warnings.
  • Fix: Doctor projects fresh-start selection without executing custom hooks and uses canonical source paths for exact injection counts before prompt-path remapping.
Before After
Doctor reported 9,001 raw / 9,001 injected characters while the turn received 34,003 raw / 19,000 injected. Doctor matches 34,003 raw / 19,000 injected and reports the extra file's truncation.
A dropped same-name file could inherit another file's count. The dropped file reports zero injected characters.

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.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

openclaw doctor bootstrap budget excludes hook-injected files, under-reporting the total that silently drops files

2 participants