Skip to content

fix(agent): name the real budget shortfall when compaction cannot fit - #1678

Merged
huichen merged 2 commits into
mainfrom
pr/huichen
Nov 23, 2026
Merged

huichen merged 2 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Compaction on a small context window could fail with advice the user cannot act on: "split large input material or use a new session". When the fixed context (system prompt, tool definitions and project context) already dominates the window, neither remedy changes anything. The budget error now names the three quantities that actually conflict, so the message points at the real cause.

Commits

  • fix(agent): name the real budget shortfall when compaction cannot fit

Verification

  • cargo fmt -p future-agent --check — pass
  • cargo clippy -p future-agent --all-targets -- -D warnings — pass
  • cargo test -p future-agent --lib — 3127 passed, 0 failed, 7 ignored

User-visible changes

  • Compaction budget error text: before, it advised splitting the input or starting a new session; after, it reports the fixed-context tokens, the remaining history budget, the required vs maximum target, and the summary budget. No behavior change beyond the message; rollback commit 8732bbede.

The refusal at small windows said "split large input material or use a new
session", but neither helps: `summary_budget` (`window/8`) is compared to
and clamped by nothing except `summary_cap`, so on a 40 960-token window
with ~26 K of fixed context (system prompt, tool definitions, project
context) the summary alone (5 120) exceeds a `maximum_target` derived from
the 4.7 K of history left (3 539). The conversation size is irrelevant.

Report the three quantities that actually conflict instead - fixed
context, remaining history, summary request - plus `required` and
`maximum_target`. No arithmetic changes: `summary_budget`,
`maximum_target`, `hard_limit` and the retained-original demotion are
untouched; only the `format!` content (and its comment) differs.

Pinned by `impossible_budget_error_names_the_window_shortfall_not_the_user_input`,
which fails on the old string (both remedies must be absent) and passes on
the new one.
@huichen
huichen enabled auto-merge (squash) November 23, 2026 17:20
@huichen
huichen merged commit c6d48e6 into main Nov 23, 2026
25 checks passed
@huichen
huichen deleted the pr/huichen branch November 23, 2026 17:44
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