Skip to content

fix(agent): raise combined system prompt cap to 1 MiB#1252

Open
joahg wants to merge 1 commit into
block:mainfrom
joahg:fix/raise-system-prompt-limit-1mib
Open

fix(agent): raise combined system prompt cap to 1 MiB#1252
joahg wants to merge 1 commit into
block:mainfrom
joahg:fix/raise-system-prompt-limit-1mib

Conversation

@joahg

@joahg joahg commented Jun 24, 2026

Copy link
Copy Markdown
Member

Problem

buzz-agent's session/new handler rejects any combined system prompt (harness prompt + persona + discovered AGENTS.md/skill hints) larger than MAX_SYSTEM_PROMPT_BYTES (512 KiB). The hints builder in crates/buzz-agent/src/hints.rs inlines the full body of every SKILL.md it discovers under ~/.agents/skills (plus .goose/skills, .claude/skills, and AGENTS.md layers).

On a machine with a large personal skill library this overflows the cap. A user with ~76 skills (~517 KiB of SKILL.md bodies) hits:

session/new: combined system prompt exceeds 512KB limit (533647 bytes)

and the agent (e.g. Fizz on the Block staging relay) can't start a session at all.

Change

Raise MAX_SYSTEM_PROMPT_BYTES from 512 KiB to 1 MiB, matching the sibling MAX_PROMPT_BYTES constant in the same file.

This cap guards the buzz-acpbuzz-agent stdio (ACP) boundary; it is not the relay frame size (BUZZ_MAX_FRAME_BYTES / DEFAULT_MAX_FRAME_BYTES), so wire limits are unaffected.

Tests

Updated session_new_rejects_oversized_system_prompt in crates/buzz-agent/tests/fake_llm.rs to use a 1100 KiB payload and assert the new 1024KB limit message. cargo test -p buzz-agent passes (21 unit + integration tests).

Notes

  • This raises the guardrail; it does not address the underlying behavior that the full skill bodies are inlined into every session/new. A follow-up could summarize/elide skill bodies or make the cap env-tunable (like BUZZ_AGENT_MAX_TOOL_RESULT_TEXT_BYTES), but that's out of scope here.

The session/new handler rejects combined system prompts (harness prompt
+ persona + discovered AGENTS.md/skill hints) over MAX_SYSTEM_PROMPT_BYTES.
At 512 KiB this falsely rejects sessions when a machine has a large
skill library: buzz-agent inlines the full body of every SKILL.md found
under ~/.agents/skills (and .goose/.claude skills + AGENTS.md), so a
user with ~76 skills hits 'combined system prompt exceeds 512KB limit
(533647 bytes)' and the agent cannot start a session.

Raise MAX_SYSTEM_PROMPT_BYTES from 512 KiB to 1 MiB, matching the
sibling MAX_PROMPT_BYTES. The cap is local to the buzz-acp<->buzz-agent
stdio boundary, not the relay frame size, so this does not affect wire
limits. Update the oversized-prompt integration test accordingly.

Amp-Thread-ID: https://ampcode.com/threads/T-019efb67-0076-766e-be17-f563c0e12e01
Co-authored-by: Amp <amp@ampcode.com>
@joahg joahg marked this pull request as draft June 24, 2026 22:20
@joahg joahg marked this pull request as ready for review June 25, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant