Conversation
Global `agent.effort` (e.g. "max") is shared across the main agent and
auxiliary models (`cron_model`, memU recall/memorize). Sonnet/Haiku tiers
only advertise {low, medium, high}; forwarding "max" triggers a 400 from
CLIProxyAPI tier validation (`internal/thinking/validate.go:125`):
thinking: validation failed | provider=claude model=claude-sonnet-4-6
error=level "max" not supported, valid levels: low, medium, high
Same shape on Opus 4.6 with "xhigh" (supports max but not xhigh), and on
any auxiliary model the user configures below their main Opus 4.7.
Add `_effective_effort(value, model)` — a small table of known Claude
models with their advertised effort levels, and a step-down lookup that
caps the requested effort to the highest level the target model supports.
Unknown models pass through unchanged (backward compatible).
Preserves "max" for Opus 4.7 main agent while letting Sonnet cron/memU
calls succeed with the tier-appropriate level.
Symmetric with existing `_parse_thinking_config(value, model)` which is
already model-aware.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
- `_MODEL_EFFORT_LEVELS` keys changed to substring form (`opus-4-7`, `opus-4-6`, `sonnet-4-6`) iterated against the full model name so dated Anthropic aliases like `claude-opus-4-7-20260416` resolve. Mirrors the MODEL_PRICING pattern in nerve/db/usage.py and `_model_supports_legacy_enabled_thinking` in the same file. - `_effective_effort(value, model=None)` — default matches the sibling `_parse_thinking_config(value, model=None)`. - `logger.debug` when capping happens so users can trace why a configured `effort: max` was forwarded as `high` to Sonnet. - Docstring trimmed to one line to match the sibling method style. - New `tests/test_engine.py` covering the cap table (incl. dated aliases, unknown models, None/empty model, invalid effort string). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Global
agent.effort(default"max") shared across main agent +cron_model/memory.recall_model/memory.memorize_model. Auxiliary models default toclaude-sonnet-4-6. Sonnet no advertisemax.Forward
maxto Sonnet → 400. CLIProxyAPI error:(validator:
internal/thinking/validate.go:125; source:internal/registry/models/models.json)Every cron source job + every memU recall/memorize call on
proxy.enabled: true→ 400. Stall inbox-processor + background work.Same shape on Opus 4.6 +
xhigh(4.6 supportsmaxnotxhigh). Any config wherecron_model/ memU model tier below mainmodel.Behavior
effortmaxclaude-opus-4-7maxmaxclaude-opus-4-6maxmaxclaude-sonnet-4-6high← fixxhighclaude-opus-4-7xhighxhighclaude-opus-4-6highxhighclaude-sonnet-4-6highlow/medium/highNoneNone(pre-PR behavior)Why table not proxy query
GET /v1/modelsat startup → couple to CLIProxyAPI, break direct-API users, need cache/refresh.Static table: simple, testable, explicit. Bump per new model. Few level-based Claude models today; bump = 1-line PR.
Entries track Anthropic capabilities + CLIProxyAPI
internal/registry/models/models.json. Unknown models (Haiku, legacy Sonnet/Opus on budget-tokens) pass through. Fully backward compatible.
Verification
Unit tests: 17 cases — opus 4.7, opus 4.6, sonnet 4.6, haiku, dated alias, unknown,
None, empty, invalid. All pass.Live proxy mode (
proxy.enabled: true), before:cron:inbox-processor→ 400level "max" not supportedevery tickAfter:
effort: max(verified via subprocess env / request inspection).effort: high. Proxy 200. Requests succeed.