Add body_after_prefix auto-compact token limit scope#22870
Conversation
body_after_prefixbody_after_prefix auto-compact token limit scope
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 973806b1cb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f3b80c51e7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Why
model_auto_compact_token_limithas only been able to budget the full active context. That makes it hard to set a small "growth since compaction" budget for sessions that preserve a large carried window prefix: the preserved prefix can consume the whole budget and force immediate repeated compaction.This PR adds an opt-in
body_after_prefixscope so callers can applymodel_auto_compact_token_limitto sampled output and later growth after the current carried prefix, while still forcing compaction before the full model context window is exhausted.What changed
AutoCompactTokenLimitScopewith the existingtotalbehavior as the default and a newbody_after_prefixmode:config_types.rs.model_auto_compact_token_limit_scopethrough config loading,Config,core-api, and app-server v2 schema/TypeScript generation.body_after_prefixcompaction window and uses it as the baseline when deciding whether the scoped auto-compaction budget is exhausted:turn.rs.body_after_prefix, so scoped budgeting cannot let the active context overrun the usable window.Verification
Added compact-suite coverage for the two key behaviors:
body_after_prefixdoes not re-compact just because the carried prefix is larger than the scoped budget, and it still compacts when the total active context reaches the configured context window:compact.rs.