openclaw - 💡(How to fix) Fix [Bug]: AGENTS.md bootstrap truncation may omit scoped instructions

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Oversized workspace AGENTS.md bootstrap files are truncated before injected context, so required scoped instructions in the omitted middle of the file may not reach subagents.

Root Cause

Oversized workspace AGENTS.md bootstrap files are truncated before injected context, so required scoped instructions in the omitted middle of the file may not reach subagents.

Fix Action

Fix / Workaround

Additional information

A focused regression test was added for a required scoped instruction in the middle of oversized AGENTS.md content. Local execution was blocked by Windows spawn EPERM and esbuild postinstall spawnSync ... node.exe EPERM; patch hygiene passed with git diff --check.

Code Example

Trace/proof:
- gateway-dev.log:3349
  "workspace bootstrap file AGENTS.md is 17198 chars (limit 12000); truncating in injected context (sessionKey=[redacted agent session key])"
- gateway-dev.log:3692
  "workspace bootstrap file AGENTS.md is 21498 chars (limit 12000); truncating in injected context (sessionKey=[redacted agent session key])"
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Oversized workspace AGENTS.md bootstrap files are truncated before injected context, so required scoped instructions in the omitted middle of the file may not reach subagents.

Steps to reproduce

  1. Run a subagent or embedded agent session with a workspace AGENTS.md larger than the default bootstrap injection cap.
  2. Put required scoped policy after the first 12,000 characters and before the final tail slice.
  3. Observe the bootstrap truncation warning in gateway logs and the injected context omitting that middle policy.

Expected behavior

Subagents should receive a compact representation of required AGENTS.md policy even when the raw file exceeds the injected-context character budget.

Actual behavior

The bootstrap builder caps each workspace bootstrap file and logs truncation. For AGENTS.md, middle policy can be omitted from injected context when the file exceeds the cap.

OpenClaw version

NOT_ENOUGH_INFO

Operating system

NOT_ENOUGH_INFO

Install method

pnpm dev

Model

NOT_ENOUGH_INFO

Provider / routing chain

OpenClaw embedded agent/subagent bootstrap context injection

Additional provider/model setup details

NOT_ENOUGH_INFO

Logs, screenshots, and evidence

Trace/proof:
- gateway-dev.log:3349
  "workspace bootstrap file AGENTS.md is 17198 chars (limit 12000); truncating in injected context (sessionKey=[redacted agent session key])"
- gateway-dev.log:3692
  "workspace bootstrap file AGENTS.md is 21498 chars (limit 12000); truncating in injected context (sessionKey=[redacted agent session key])"

Impact and severity

Affected: Subagents and embedded agent sessions that rely on workspace AGENTS.md bootstrap policy. Severity: Medium; incorrect reviews or fixes are possible when required scoped policy is omitted. Frequency: Observed 34 matching truncation log lines in the captured evidence. Consequence: Agents may act without required scoped instructions until they manually read the source file.

Additional information

A focused regression test was added for a required scoped instruction in the middle of oversized AGENTS.md content. Local execution was blocked by Windows spawn EPERM and esbuild postinstall spawnSync ... node.exe EPERM; patch hygiene passed with git diff --check.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Subagents should receive a compact representation of required AGENTS.md policy even when the raw file exceeds the injected-context character budget.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING