Skip to content

feat(compaction): add compaction_threshold_tokens and scale background threshold - #5085

Merged
rumpl merged 1 commit into
docker:mainfrom
rumpl:feat/compaction-threshold-tokens
Dec 1, 2026
Merged

rumpl merged 1 commit into
docker:mainfrom
rumpl:feat/compaction-threshold-tokens

Conversation

@rumpl

@rumpl rumpl commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Adds compaction_threshold_tokens to models.<name> and agents.<name> in pkg/config/latest, agent-schema.json, and the generated TypeScript SDK, letting users configure proactive auto-compaction by an absolute token count (capped at the model's context window) instead of a context-window fraction.
    • Must be > 0, mutually exclusive with compaction_threshold on the same model/agent, and cannot be combined with first_available.
    • Model-level threshold (compaction_threshold or compaction_threshold_tokens) takes precedence over agent-level threshold.
    • UI context gauges (TUI sidebar and lean TUI footer) scale against the effective fraction of compaction_threshold_tokens relative to the context limit.
  • Updates background_compaction_threshold (user settings, 1–99%, default 70) to be a percentage of the agent's effective blocking compaction threshold (compaction_threshold or compaction_threshold_tokens) rather than the raw model context window, ensuring background compaction always scales with and fires before blocking compaction.

@rumpl
rumpl requested a review from a team as a code owner December 1, 2026 12:09
Copilot AI balanced review requested due to automatic review settings December 1, 2026 12:09

This comment was marked as outdated.

…d threshold

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
@rumpl
rumpl force-pushed the feat/compaction-threshold-tokens branch from d18fc1a to fd55e48 Compare December 1, 2026 12:18
Copilot AI balanced review requested due to automatic review settings December 1, 2026 12:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues require changes before approval.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@aheritier aheritier added area/agent For work that has to do with the general agent loop/agentic features of the app area/config For configuration parsing, YAML, environment variables area/docs Documentation changes area/runtime Runtime engine, agent loop execution, tool dispatch, loop detection kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Dec 1, 2026
@rumpl
rumpl enabled auto-merge December 1, 2026 12:32
@rumpl
rumpl added this pull request to the merge queue Dec 1, 2026
Merged via the queue into docker:main with commit cfa9cbe Dec 1, 2026
23 checks passed
@rumpl
rumpl deleted the feat/compaction-threshold-tokens branch December 1, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent For work that has to do with the general agent loop/agentic features of the app area/config For configuration parsing, YAML, environment variables area/docs Documentation changes area/runtime Runtime engine, agent loop execution, tool dispatch, loop detection kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants