What
Introduce a task-local runtimeThinkingEffort override for reasoning effort, resolved per API request (next-request semantics), passed through metadata.reasoningEffort, and emitted as the adaptive-model effort envelope (output_config.effort) where applicable. This is the state + plumbing PR.
Part of the Dynamic Thinking Effort series (5 PRs). Master design issue: easonLiangWorldedtech#28.
PR protocol (all series PRs): draft PR until CI is fully green -> switch to ready -> CodeRabbit bot review addressed in full -> 100% test coverage on patch lines. Each PR <= 1000 diff lines, based on latest upstream main (stacked on preceding series PRs where noted; rebased to pure main once dependencies merge).
Stacking: PR 2/5 — standalone, based on main.
Design
Resolution order (strongest first):
task.runtimeThinkingEffort (task-local; written by the model tool in PR 3 and the user control in PR 4)
- settings
reasoningEffort
- model default
- Task-local state is discarded at task end and never written to Settings.
setRuntimeThinkingEffort(effort, source) is the single write path (source: model tool / user).
ApiHandlerCreateMessageMetadata.reasoningEffort? — per-request override channel, same pattern as the abort signal (metadata read at request build time) and the existing Bedrock metadata.thinking precedent.
- Adaptive Anthropic class (
supportsReasoningBinary models): when the effective effort resolves, the request carries output_config: { effort } clamped to [low, medium, high, xhigh, max] (soft-guidance envelope). The Bedrock handler already sends a hardcoded xhigh envelope — left unchanged (documented follow-up).
Acceptance criteria
What
Introduce a task-local
runtimeThinkingEffortoverride for reasoning effort, resolved per API request (next-request semantics), passed throughmetadata.reasoningEffort, and emitted as the adaptive-model effort envelope (output_config.effort) where applicable. This is the state + plumbing PR.Part of the Dynamic Thinking Effort series (5 PRs). Master design issue: easonLiangWorldedtech#28.
PR protocol (all series PRs): draft PR until CI is fully green -> switch to ready -> CodeRabbit bot review addressed in full -> 100% test coverage on patch lines. Each PR <= 1000 diff lines, based on latest upstream main (stacked on preceding series PRs where noted; rebased to pure main once dependencies merge).
Stacking: PR 2/5 — standalone, based on main.
Design
Resolution order (strongest first):
task.runtimeThinkingEffort(task-local; written by the model tool in PR 3 and the user control in PR 4)reasoningEffortsetRuntimeThinkingEffort(effort, source)is the single write path (source: model tool / user).ApiHandlerCreateMessageMetadata.reasoningEffort?— per-request override channel, same pattern as the abort signal (metadata read at request build time) and the existing Bedrockmetadata.thinkingprecedent.supportsReasoningBinarymodels): when the effective effort resolves, the request carriesoutput_config: { effort }clamped to[low, medium, high, xhigh, max](soft-guidance envelope). The Bedrock handler already sends a hardcoded xhigh envelope — left unchanged (documented follow-up).Acceptance criteria
output_config.effortwhen effort resolves; omitted otherwise (no 400s)