fix: preserve AGENTS policy during bootstrap truncation#82921
Conversation
|
Codex review: needs real behavior proof before merge. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: yes. at source level: current main and v2026.5.18 use generic head/tail truncation for AGENTS.md, so a required policy line placed in the omitted middle can be absent from injected context. I did not run a test in this read-only review. PR rating Rank-up moves:
What the crustacean ranks mean
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. Real behavior proof Risk before merge
Maintainer options:
Next step before merge Security Review findings
Review detailsBest possible solution: Keep the AGENTS.md digest approach, preserve the per-file budget by reallocating unused digest capacity to raw head/tail or falling back to generic trimming, and land it with successful focused proof for the linked bug. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main and v2026.5.18 use generic head/tail truncation for AGENTS.md, so a required policy line placed in the omitted middle can be absent from injected context. I did not run a test in this read-only review. Is this the best way to solve the issue? No, not as written: the AGENTS.md digest is a maintainable direction, but the implementation should preserve the existing per-file budget by reallocating unused digest space or falling back to generic trimming before merge. Label changes:
Full review comments:
Overall correctness: patch is incorrect What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 0556ac0291a8. |
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
f6d54fe to
5984afe
Compare
|
Verification for landing head 5984afe: Behavior addressed: AGENTS.md bootstrap truncation now preserves high-priority policy content and surfaces a UX warning when AGENTS.md content is trimmed.
|
* fix(errors): dedupe identical messages when traversing error .cause chain (openclaw#84556) Merged via squash. Prepared head SHA: 46aa27f Co-authored-by: RomneyDa <6581799+RomneyDa@users.noreply.github.com> Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com> Reviewed-by: @altaywtf * fix(cli): gate exported subcli descriptors (openclaw#84519) Summary: - This PR filters exported sub-CLI descriptors through the private-QA gate, centralizes that filter, adds regr ... ge, and carries small validation repairs in workspace glob and tunnel-timeout tests plus a changelog entry. - Reproducibility: yes. Current-main source shows the raw SUB_CLI_DESCRIPTORS export can include qa while the helper surfaces filter it, and src/cli/argv.ts consumes that export for root command policy. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(cli): gate exported subcli descriptors - PR branch already contained follow-up commit before automerge: fix(clawsweeper): address review for automerge-openclaw-openclaw-8451… Validation: - ClawSweeper review passed for head ba197a6. - Required merge gates passed before the squash merge. Prepared head SHA: ba197a6 Review: openclaw#84519 (comment) Co-authored-by: Zhaocun <zhaocunsun@gmail.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com> * fix(doctor): migrate invalid thinking formats (openclaw#84626) * fix(cron-cli): bound loadCronJobForShow pagination (openclaw#83856) (openclaw#83989) Summary: - Adds a 50-page and advancing-`nextOffset` guard to `loadCronJobForShow`, exports that helper for regression tests, and adds an unreleased changelog entry. - Reproducibility: yes. Current main is source-reproducible because `loadCronJobForShow` loops while `hasMore` ... ed numeric `nextOffset`; the PR discussion also includes terminal before/after proof for the same CLI path. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 7828b4b. - Required merge gates passed before the squash merge. Prepared head SHA: 7828b4b Review: openclaw#83989 (comment) Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com> * fix(config): accept execApprovals.enabled="auto" in zod schema * fix: honour tool error suppression for mutating tools (openclaw#81561) Merged via squash. Prepared head SHA: 7462a86 Co-authored-by: moeedahmed <5780040+moeedahmed@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman * Add OpenRouter provider routing params (openclaw#84579) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com> * Preserve AGENTS.md policy during bootstrap truncation (openclaw#82921) Fixes openclaw#82920 * chore: regenerate base config schema Updated after MODEL_THINKING_FORMATS changed from z.union literals to z.enum, and session/session.agentToAgent gained detailed help text. * Revert "Add OpenRouter provider routing params (openclaw#84579)" This reverts commit 53254dc. --------- Co-authored-by: Dallin Romney <dallinromney@gmail.com> Co-authored-by: RomneyDa <6581799+RomneyDa@users.noreply.github.com> Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com> Co-authored-by: Zhaocun Sun <zhaocunsun@gmail.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com> Co-authored-by: Gio Della-Libera <giodl73@gmail.com> Co-authored-by: yaoyi1222 <yaoyi_1222@163.com> Co-authored-by: Sarah Fortune <sarah.fortune@gmail.com> Co-authored-by: Moeed Ahmed <drmoeedahmed@gmail.com> Co-authored-by: moeedahmed <5780040+moeedahmed@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Co-authored-by: Alex Knight <aknight@atlassian.com> Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com> Co-authored-by: Galin Iliev <iliev@galcho.com>
Summary
AGENTS.mdfiles can lose required scoped policy when bootstrap injection truncates the raw file.AGENTS.mdtruncation now injects a compact policy digest of markdown headings and high-priority instruction lines alongside the bounded head/tail content.AGENTS.mdbootstrap truncation keeps the existing head/tail behavior and size caps.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof (required for external PRs)
Behavior addressed: Oversized workspace
AGENTS.mdbootstrap context can omit scoped policy in the truncated middle of the file.Real environment tested: Local Windows OpenClaw worktree for patch hygiene and command execution. Focused Vitest/Testbox execution was attempted but blocked by local process-spawn and Crabbox CLI availability errors.
Exact steps or command run after this patch:
git diff --check HEAD~1..HEAD; attemptednode scripts/run-vitest.mjs src/agents/pi-embedded-helpers.buildbootstrapcontextfiles.test.ts; attempted directnode node_modules\vitest\vitest.mjs run src/agents/pi-embedded-helpers.buildbootstrapcontextfiles.test.ts --reporter=verbose; attemptedcodex review --uncommitted; attemptednode scripts/crabbox-wrapper.mjs --helpand a Blacksmith Testbox wrapper run.Evidence after fix: Terminal capture and copied console output:
Observed result after fix: Patch hygiene passes, and the committed regression test asserts that a required scoped
AGENTS.mdinstruction in oversized middle content is present in the injected policy digest while staying under the configured budget.What was not tested: Live/provider/session behavior was not run. Focused Vitest did not complete locally because Node child-process spawning failed with
EPERM; remote Testbox proof did not start because the local Crabbox wrapper could not pass its binary sanity check.Before evidence: Redacted source logs showed
workspace bootstrap file AGENTS.md is 17198 chars (limit 12000); truncating in injected context (sessionKey=[redacted agent session key])andworkspace bootstrap file AGENTS.md is 21498 chars (limit 12000); truncating in injected context (sessionKey=[redacted agent session key]).Root Cause (if applicable)
buildBootstrapContextFilesused a generic bounded head/tail truncation path for all bootstrap files, including policy-heavyAGENTS.mdfiles.AGENTS.mdcontent.AGENTS.mdinputs exceeded that size.Regression Test Plan (if applicable)
src/agents/pi-embedded-helpers.buildbootstrapcontextfiles.test.tsAGENTS.mdcontent remains visible through the policy digest after truncation.User-visible / Behavior Changes
Subagents receive a compact
AGENTS.mdpolicy digest when rawAGENTS.mdbootstrap content must be truncated.Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation: N/ARepro + Verification
Environment
Steps
AGENTS.mdcontent with a required scoped instruction in the middle.buildBootstrapContextFileswith a smallmaxCharsbudget.Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
git diff --check HEAD~1..HEAD.AGENTS.mdfiles continue using the existing truncation path; the new digest path remains bounded bymaxChars.Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations
AGENTS.mdfiles.