feat(config): per-entry reasoning_effort in fallback_model chain (#21256) - #42447
feat(config): per-entry reasoning_effort in fallback_model chain (#21256)#42447Kyzcreig wants to merge 1 commit into
Conversation
|
Positive verification — reviewed the per-entry
No issues found. |
fd15c71 to
b33a9e9
Compare
…sResearch#21256) reasoning_effort was a flat global (agent.reasoning_effort) with no way to set a different thinking depth per fallback tier. This adds an optional `reasoning_effort` key to each fallback_model entry, applied when that tier activates and reverted when the primary is restored — so e.g. a last-resort Codex tier can run at xhigh without raising effort on the primary model. - try_activate_fallback: read entry.reasoning_effort, parse via parse_reasoning_effort, override agent.reasoning_config (turn-scoped). Unknown level → warn + keep current; absent → unchanged. - _primary_runtime snapshot now captures reasoning_config; both restore paths (restore_primary_runtime + try_recover_primary_transport) revert it, guarded for older snapshots predating the key. - config validation: warn on an invalid per-entry reasoning_effort level. - tests: 5 new cases in test_primary_runtime_restore.py (override applied, restored on primary, absent-key unchanged, invalid-level ignored, none disables). 3 fail without the impl (gold-standard).
b33a9e9 to
e315dac
Compare
|
Thanks for the focused fallback override implementation. The feature is still absent on current main, but two paths need correction before this is safe to salvage. Problems
Suggested changes
Automated hermes-sweeper review. |
|
Closing as superseded by PR #64458 (merged) — with credit due: you were the earliest submitter against #21256, and your PR correctly identified both the gap and the fallback-activation site as the place a per-tier effort has to be applied. Thanks for that groundwork, @Kyzcreig. The merged design took a different config surface: a model-keyed agent:
reasoning_effort: "medium" # primary tier
reasoning_overrides:
"gpt-5.5": "xhigh" # last-resort tier thinks harder when it activates
fallback_model:
- provider: claude-api-proxy-f1
model: claude-opus-4-8
- provider: openai-codex
model: gpt-5.5One case the model-keyed design intentionally doesn't cover: two chain tiers using the same model with different efforts. If that's a real need for you, please open a focused issue — it would be an additive extension to the current resolution rather than a competing surface. |
Problem
reasoning_effortis a flat global (agent.reasoning_effort) — there's no way to set a different thinking depth per fallback tier. So a fallback chain like:runs every tier at the same global effort. You can't, e.g., keep the primary at
mediumbut run a last-resort Codex tier atxhigh. This is the gap described in #21256.Solution
Add an optional
reasoning_effortkey to eachfallback_modelentry. When that tier activates, its effort overrides the global; when the primary is restored, the original effort is reverted (turn-scoped, like the rest of the fallback runtime swap).Changes
agent/chat_completion_helpers.py—try_activate_fallbackreadsentry.reasoning_effort, parses via the existingparse_reasoning_effort, and overridesagent.reasoning_config. Unknown level → warn + keep current; absent/blank → unchanged.none→ reasoning disabled for that tier.agent/agent_runtime_helpers.py—_primary_runtimesnapshot now capturesreasoning_config; both restore paths (restore_primary_runtime+try_recover_primary_transport) revert it, guarded for older snapshots that predate the key.hermes_cli/config.py— config validation warns on an invalid per-entryreasoning_effort.Scope / non-goals
This implements the
fallback_model-chain case. The issue also mentions per-model defaults viacustom_providers; that's a larger surface and left for a follow-up. Levels accepted:none, minimal, low, medium, high, xhigh(same vocabulary asagent.reasoning_effort).Tests
5 new cases in
tests/run_agent/test_primary_runtime_restore.py::TestFallbackReasoningEffort:nonedisables reasoning on the tierGold-standard verified: 3 of the 5 fail without the implementation (they exercise the new path); all pass with it. Full file 36/36; config-validation 21/21; provider-fallback + credential-isolation + gemini-fallback sweeps green.
Closes #21256 (fallback_model portion).