Skip to content

[Bug]: AGENTS.md bootstrap truncation may omit scoped instructions #82920

@galiniliev

Description

@galiniliev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.maintainerMaintainer-authored PR

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions