Skip to content

feat(tools): set_thinking_effort native tool — model-driven per-turn thinking effort, no approval (DTE series 3/5) #1330

Description

@easonLiangWorldedtech

What

Add the native tool set_thinking_effort(effort, reason) so the model can adjust its own thinking effort mid-task, with an in-chat one-line display. No approval gate (non-destructive, clamped to the model's capability, instantly undoable); guardrails replace approval: always notify, escalation cap (max 3 upward changes per task), oscillation detection, hard clamp.

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 3/5 — stacked on PR 1 (experiment flag) + PR 2 (task state).

Design

  • Tool exposed only when the dynamicThinkingEffort experiment is on and the model supports per-request effort (gating precedents: generate_image / run_slash_command experiments). Tool list stays stable within a task (prompt-cache safety).
  • Schema: effort (enum = the model's supportsReasoningEffort capability array) + reason (required, surfaced in the UI display).
  • Executor: clamp vs capability -> guardrails (escalation cap, oscillation) -> task.setRuntimeThinkingEffort(effort, "model") -> one-line chat display following the switch_mode display pattern (including partial streaming).
  • Dispatch wiring: presentAssistantMessage + NativeToolCallParser cases.

Acceptance criteria

  • Model can switch effort mid-task; display shows new effort + reason; the next request carries the new value (verifiable in logs)
  • Escalation cap + oscillation notify work; effort is always clamped to the capability array
  • No approval gate; experiment off => tool absent; task tool list stable
  • Tests: executor (cap, oscillation, clamp, no-approval), gating, dispatch/parsing; 100% patch coverage; <= 1000 diff lines

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions