Skip to content

Agents: raise bootstrap total cap and warn on /context truncation#18229

Merged
gumadeiras merged 1 commit intomainfrom
codex/bootstrap-total-cap-150k-context-warning
Feb 16, 2026
Merged

Agents: raise bootstrap total cap and warn on /context truncation#18229
gumadeiras merged 1 commit intomainfrom
codex/bootstrap-total-cap-150k-context-warning

Conversation

@gumadeiras
Copy link
Member

@gumadeiras gumadeiras commented Feb 16, 2026

Summary

  • Raise the default total bootstrap injection cap from 24,000 to 150,000 chars while keeping the per-file cap at 20,000.
  • Keep strict per-file and total cap behavior when truncating injected bootstrap context.
  • Improve system prompt reporting to include bootstrapTotalMaxChars and detect truncation from injected-vs-raw chars.
  • Extend /context output to show both max/file and max/total, and add an explicit warning when bootstrap files are truncated due to configured limits.
  • Update docs/help/changelog to reflect the new total default and the improved context visibility.

Why

  • The previous default total cap was too tight for many real bootstrap setups and caused avoidable truncation.
  • Operators need clear visibility when truncation happens, including likely causes and how to adjust limits.

Scope

  • Agents bootstrap context limits and reporting
  • /context command output and warning UX
  • Config/docs/changelog alignment
  • Targeted tests for report and warning behavior

Verification

  • pnpm check
  • pnpm vitest run src/agents/system-prompt-report.test.ts
  • pnpm vitest run --config vitest.e2e.config.ts src/agents/pi-embedded-helpers.buildbootstrapcontextfiles.e2e.test.ts
  • pnpm vitest run src/auto-reply/reply/commands-context-report.test.ts

Greptile Summary

Raises the default bootstrapTotalMaxChars from 24,000 to 150,000 chars to reduce unintended truncation of bootstrap context files while keeping the per-file limit at 20,000 chars. Improves observability by:

  • Adding bootstrapTotalMaxChars to system prompt reports and /context command output
  • Detecting truncation by comparing injected vs raw character counts instead of just checking against per-file limit
  • Displaying explicit warnings in /context when bootstrap files are truncated, with clear causes (per-file overflow vs total overflow)

The implementation is consistent across:

  • Core bootstrap logic (src/agents/pi-embedded-helpers/bootstrap.ts:86)
  • System prompt reporting (src/agents/system-prompt-report.ts:59,121)
  • Context command output (src/auto-reply/reply/commands-context-report.ts:65,176,263-287)
  • All documentation (6 doc files updated with new default)
  • Test coverage for new behavior and warning display

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a well-scoped configuration default adjustment with comprehensive test coverage and documentation. All callers properly thread the new parameter through, truncation detection logic is improved to be more accurate, and the implementation maintains backward compatibility by making the parameter optional everywhere it's used.
  • No files require special attention

Last reviewed commit: 17d98ac

Copilot AI review requested due to automatic review settings February 16, 2026 16:43
@openclaw-barnacle openclaw-barnacle bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Feb 16, 2026
@gumadeiras gumadeiras changed the title Agents: raise bootstrap total cap to 150k and warn on /context truncation Agents: raise bootstrap total cap and warn on /context truncation Feb 16, 2026
@github-actions
Copy link
Contributor

⚠️ Formal models conformance drift detected

The formal models extracted constants (generated/*) do not match this openclaw PR.

This check is informational (not blocking merges yet).
See the formal-models-conformance-drift artifact for the diff.

If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR raises the default bootstrap total character limit from 24,000 to 150,000 to better accommodate real-world bootstrap setups. It improves visibility of truncation by enhancing the /context command to show both per-file and total limits, and adds explicit warnings when files are truncated.

Changes:

  • Increased default total bootstrap cap from 24k to 150k chars (per-file cap remains 20k)
  • Enhanced truncation detection to compare injected vs raw chars instead of checking against limits
  • Added bootstrap total limit display and truncation warnings to /context output

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/config/types.agent-defaults.ts Updated comment documenting new default (150000)
src/config/sessions/types.ts Added bootstrapTotalMaxChars field to system prompt report type
src/config/schema.help.ts Updated help text with new default value
src/auto-reply/reply/commands-context-report.ts Added total limit display and truncation warning logic to /context command
src/auto-reply/reply/commands-context-report.test.ts Added tests for truncation warning display
src/agents/system-prompt-report.ts Improved truncation detection and added bootstrapTotalMaxChars to report
src/agents/system-prompt-report.test.ts Added tests for improved truncation detection
src/agents/pi-embedded-runner/run/attempt.ts Added bootstrapTotalMaxChars to system prompt report building
src/agents/pi-embedded-helpers/bootstrap.ts Updated default constant to 150,000
src/agents/pi-embedded-helpers.buildbootstrapcontextfiles.e2e.test.ts Updated and added tests for new default and explicit total cap enforcement
docs/reference/token-use.md Updated documentation with new default value
docs/gateway/configuration-reference.md Updated configuration reference with new default and example
docs/concepts/system-prompt.md Updated documentation with new default value
docs/concepts/context.md Updated documentation with new default value
docs/concepts/agent-workspace.md Updated documentation to mention both limit configuration options
CHANGELOG.md Added entry describing the changes

@gumadeiras gumadeiras self-assigned this Feb 16, 2026
@gumadeiras gumadeiras force-pushed the codex/bootstrap-total-cap-150k-context-warning branch from 17d98ac to f662052 Compare February 16, 2026 16:58
@github-actions
Copy link
Contributor

⚠️ Formal models conformance drift detected

The formal models extracted constants (generated/*) do not match this openclaw PR.

This check is informational (not blocking merges yet).
See the formal-models-conformance-drift artifact for the diff.

If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there.

@gumadeiras gumadeiras merged commit 8a67016 into main Feb 16, 2026
24 checks passed
@gumadeiras gumadeiras deleted the codex/bootstrap-total-cap-150k-context-warning branch February 16, 2026 17:04
@gumadeiras
Copy link
Member Author

Merged via squash.

Thanks @gumadeiras!

archerhpagent pushed a commit to howardpark/openclaw that referenced this pull request Feb 18, 2026
…enclaw#18229)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: f662052
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…enclaw#18229)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: f662052
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants