fix(agent): raise combined system prompt cap to 1 MiB#1252
Draft
joahg wants to merge 1 commit into
Draft
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
buzz-agent'ssession/newhandler rejects any combined system prompt (harness prompt + persona + discoveredAGENTS.md/skill hints) larger thanMAX_SYSTEM_PROMPT_BYTES(512 KiB). The hints builder incrates/buzz-agent/src/hints.rsinlines the full body of everySKILL.mdit discovers under~/.agents/skills(plus.goose/skills,.claude/skills, andAGENTS.mdlayers).On a machine with a large personal skill library this overflows the cap. A user with ~76 skills (~517 KiB of
SKILL.mdbodies) hits:and the agent (e.g. Fizz on the Block staging relay) can't start a session at all.
Change
Raise
MAX_SYSTEM_PROMPT_BYTESfrom 512 KiB to 1 MiB, matching the siblingMAX_PROMPT_BYTESconstant in the same file.This cap guards the
buzz-acp↔buzz-agentstdio (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_promptincrates/buzz-agent/tests/fake_llm.rsto use a 1100 KiB payload and assert the new1024KB limitmessage.cargo test -p buzz-agentpasses (21 unit + integration tests).Notes
session/new. A follow-up could summarize/elide skill bodies or make the cap env-tunable (likeBUZZ_AGENT_MAX_TOOL_RESULT_TEXT_BYTES), but that's out of scope here.