apply the compaction effort cap to requests naming no effort - #151
Merged
Merged
Conversation
The cap only lowered an effort that was already present: the guard read `resolved_effort.as_ref().is_some_and(|e| *e > cap)`, so a compaction request that named no effort at all skipped the cap and ran at the upstream default. That default is the effort level the cap exists to avoid, which is the case it was most needed for — Claude Code's own /compact request carries no effort of its own. `apply_compact_effort_cap` now resolves the two inputs together: a missing effort takes the cap, an explicit effort at or below it is preserved, anything above it is lowered, and a disabled cap leaves the request exactly as it asked. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Compaction requests that name no effort now take the configured cap, but `Effort::None` was still treated as reasoning enabled. A request that resolved to `none` carried `reasoning.summary: "auto"` and `include: ["reasoning.encrypted_content"]`, contradicting the documented behavior that compact `none` removes reasoning and asking upstream for a summary and encrypted continuation content it cannot use. Keep naming `effort: "none"` on the wire so the request still overrides the upstream default, and gate the summary and encrypted content on an effort other than `none`. This also stops a proxy-wide `none` override from requesting reasoning artifacts, since it flows through the same resolved effort. Add full-translation regression tests for omitted-effort compact requests under the default low cap, `none`, `off`, and effort override precedence. The tests isolate the process environment through the existing lock and guard pattern so they can mutate `CCP_COMPACT_EFFORT` and `CCP_CODEX_EFFORT` safely. PR: raine#151
Bring the branch onto current main (d27df1d) so the combined tree carries the certificate-root handling and codex transport test isolation from raine#143 alongside the compaction effort cap and its reasoning-none correction. The original PR head and the correction commit remain ancestors, so the contributor branch still fast-forwards.
Owner
|
Thanks for catching the missing-effort case! Merged. |
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.
Problem
src/providers/codex/translate/request.rs:is_some_andmeans the cap only ever lowers an effort that is already present. A compaction request naming no effort at all skips the cap entirely and runs at the upstream default — which is the effort level the cap exists to avoid.That is also the case it is most needed for: Claude Code's own
/compactrequest carries no effort of its own, so the fast path never applied to it.Fix
apply_compact_effort_capresolves the two inputs together:LowLowNoneLowNone(explicit, below cap)LowLowLowHighLowLow(lowered)The existing invariant holds: the cap never raises effort, and an explicitly lower effort is preserved. The doc comment on
compact_effort_capis updated to state that a missing effort now takes the cap too.Verification
compact_effort_cap_defaults_a_missing_effortcovers every row abovecompact_request_downgrades_effort_to_capandcompact_effort_cap_parses_env_valuesunchanged and passingcargo clippy --all-targets -- -D warningsclean,cargo fmt --checkclean, full suite green🤖 Generated with Claude Code