Repository navigation
feat(compression): config-driven per-model threshold - #25
Merged
Merged
Conversation
Surface the existing per-model compression-threshold override as a config knob. New optional compression.per_model_threshold map (model-id -> fraction in (0,1]) takes precedence over the built-in _compression_threshold_for_model default and the global compression.threshold. Resolution order (first hit wins): 1. compression.per_model_threshold[model] (config map, new) 2. _compression_threshold_for_model(model) (built-in family default) 3. compression.threshold (global config) 4. 0.50 (hardcoded default) New _resolve_per_model_threshold() helper: exact then case-insensitive match, accepts (0,1] only, ignores out-of-range/non-numeric with a warning so resolution falls through safely. The absolute trigger stays model-aware (context_length * threshold, re-derived on every model switch). 28 new tests; ruff clean.
🔎 Lint report:
|
| Rule | Count |
|---|---|
unresolved-import |
1 |
First entries
tests/agent/test_per_model_compression_threshold.py:17: [unresolved-import] unresolved-import: Cannot resolve imported module `pytest`
✅ Fixed issues: none
Unchanged: 5158 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
Kyzcreig
pushed a commit
that referenced
this pull request
Sep 28, 2026
ang-fleet-workers Bot
pushed a commit
that referenced
this pull request
Oct 4, 2026
Moves the floor `uses:` pin to debd27598fa6 (fleet-floor-workflows#26 merge commit). #26 keys the floor concurrency group per-ref and cancels only on pull_request; every other event (push:main backstop) gets a per-run group, so a newer push no longer cancels or replaces it. Diff old pin -> debd275 for the called workflow file: concurrency block + a caller-paths comment only. Inputs and defaults unchanged; the scanner is embedded in the workflow, so scanner bytes are identical. The other files changed since the old pin (#22-#25: python-ci/js-ci inputs, steps-mode actions, README, tests) are not called by this workflow. Card t_ca5322d9.
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.
What
Surfaces the already-wired per-model compression-threshold override as a config knob. Adds an optional
compression.per_model_thresholdmap so a model's compression trigger fraction can be tuned inconfig.yamlwithout editing Python.Why
The per-model override path already existed (
_compression_threshold_for_modelinauxiliary_client.py, applied inagent_init.py) but was hardcoded — onlyarcee-trinity-thinking → 0.75. Threshold is a direct cost lever (higher = bigger/costlier requests, fewer summarization calls; lower = cheaper turns, more summarization passes), so it should be config-tunable per model.Resolution order (first hit wins)
compression.per_model_threshold[model]— config map (new)_compression_threshold_for_model(model)— built-in family defaultcompression.threshold— global config0.50— hardcoded defaultThe absolute trigger stays model-aware regardless:
threshold_tokens = context_length × threshold, re-derived on every/modelswitch inContextCompressor.update_model.Implementation
_resolve_per_model_threshold(per_model, model)helper inagent/agent_init.py: exact-match then case-insensitive; accepts(0, 1]only; ignores out-of-range / non-numeric / non-dict / bad-model input (returnsNone+ warns) so resolution falls through safely.Tests
28 new tests in
tests/agent/test_per_model_compression_threshold.py(exact/case-insensitive match, boundary values, out-of-range, non-numeric, numeric-string coercion, empty/non-dict map, invalid model, non-string keys). 45/45 pass with the existing arcee override suite; ruff clean.Notes
per_model_thresholdis set.