Skip to content

fix(agent): admit summaries by projection budget and report fallback outcomes - #718

Merged
huichen merged 1 commit into
mainfrom
fix/compaction-budget-outcome
Sep 18, 2026
Merged

huichen merged 1 commit into
mainfrom
fix/compaction-budget-outcome

Conversation

@huichen

@huichen huichen commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Scope

Only the two requested compaction fixes: budget-based summary acceptance and explicit outcome reporting. No summary-prompt changes, history selection/cropping changes, additional provider retries, or client UI redesign.

Changes

  • Keep the requested 4096-token summary target and the existing output/reasoning allowance. Admit the unmodified summary against the existing full projected-history/request limits instead of discarding it solely for exceeding the text target.
  • If the complete summarized projection exceeds its budget (or makes no automatic progress), fall back to the same protected originals, evidence and tail. Do not truncate the summary or shrink evidence.
  • Persist an optional summary_outcome with generated / evidence_only, the fallback reason and final usage per provider attempt. Expose it on committed/reused compaction events and as summaryOutcome in manual/durable results. Existing accounting callbacks still run exactly once per observed attempt.
  • Keep identical-input/policy receipt replay (including fallback replay) model-call-free. Version the changed admission policy so receipts from the former text-only rejection policy are not treated as identical.
  • Update English/Chinese developer docs. Additive JSON diagnostics; no protobuf changes. Older clients can ignore the new field.

Validation

On pinned Rust 1.97.0:

  • cargo fmt -p future-agent --check
  • cargo clippy -p future-agent --all-targets -- -D warnings
  • cargo test -p future-agent: 1787 library tests passed (1 existing ignored), all enabled integration tests passed.
  • python3 scripts/test-check-docs.py: 21 passed.
  • New deterministic regression: 4111-token normal-stop summary is retained intact; an over-budget projection and provider Length fall back; existing empty-response retries and per-attempt billing are unchanged.
  • Extended runtime tests cover automatic fallback diagnostics, manual success/fallback events, persistence, restart/replay and charged retry usage.
  • Offline replay of the previously captured real 4111-token response against its original full input/request shape: now retained intact, 434763 -> 24688 estimated input tokens. No new paid model call and no private session fixture committed.

@huichen
huichen enabled auto-merge (squash) September 18, 2026 03:33
@huichen
huichen merged commit 841d96f into main Sep 18, 2026
12 checks passed
@huichen
huichen deleted the fix/compaction-budget-outcome branch September 18, 2026 03:37
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