Skip to content

feat(dte): dynamic thinking effort — full series trial (PRs 1-5 + e2e addenda merged) - #29

Open
easonLiangWorldedtech wants to merge 49 commits into
mainfrom
feat/dte-trial-all
Open

feat(dte): dynamic thinking effort — full series trial (PRs 1-5 + e2e addenda merged)#29
easonLiangWorldedtech wants to merge 49 commits into
mainfrom
feat/dte-trial-all

Conversation

@easonLiangWorldedtech

Copy link
Copy Markdown
Owner

Trial branch: all DTE (dynamic thinking effort) branches composed into ONE

This branch merges the entire DTE 5-PR series + both e2e addenda so it can be tried out as a single build. It is NOT a submission PR - the real PRs are on Zoo-Code-Org/Zoo-Code:

PR Branch Status
Zoo-Code-Org#1336 PR-1 experiment + settings + i18n feat/dte-1-experiment open, bot-clean
Zoo-Code-Org#1338 PR-2 task state + per-request metadata + adaptive envelope feat/dte-2-task-state open, bot-clean
Zoo-Code-Org#1354 PR-3 set_thinking_effort native tool (+i18n) feat/dte-3-native-tool @ 19954d3 open, 19/19 green
Zoo-Code-Org#1359 PR-4 webview UI (chip + composer toggle + in-chat display) feat/dte-4-webview-ui @ ac84f5e open, 19/19 green
Zoo-Code-Org#1355 PR-5 orchestrator new_task effort pass-through feat/dte-5-orchestrator @ 3ea9f63 open, 17/17 green
Zoo-Code-Org#1361 e2e addendum PR-3 feat/dte-3-e2e @ e83af72 draft, CI running
Zoo-Code-Org#1356 e2e addendum PR-5 feat/dte-5-e2e @ 471490b open, 17/17 green

Merge history (all additive, no rebase)

19954d3 (dte-3 head) -> merge dte-4 (3ae54d1; 17 locale i18n conflicts resolved as union: dte-3 translations + dte-4 new keys) -> merge dte-5 (5b33232; 2 conflicts in vscode-extension-host.ts resolved keep-both) -> merge dte-5-e2e (ce0e90b) -> merge dte-3-e2e (f152b98).

Verified

  • pnpm run check-types: 11/11 packages green
  • find-missing-translations.js --area=webview: no missing keys (17 locales x full thinkingEffort section parity)

How to try it

  1. Load this branch (or the built VSIX artifact) in VS Code.
  2. Settings -> Experiments: enable Dynamic thinking effort (dynamicThinkingEffort).
  3. Pick a model whose catalog entry supports per-request reasoning effort (e.g. DeepSeek / OpenRouter reasoning models); the composer Brain toggle shows the model's supported levels.
  4. UI surfaces: composer Brain toggle (per-task, source you), header chip (effort + source), in-chat notification line when effort changes (user or model).
  5. Model-driven: with the experiment on, the model gets a set_thinking_effort tool it can call mid-task (clamped to the model capability array, 3-upward-change cap, oscillation refusal).
  6. new_task: when the model requests a new task it can pass thinking_effort; validated against the child model capability (invalid values are rejected and returned to the model).

Base: main @ 78c712a (same as upstream main at branch time).

…nd adaptive effort envelope

DTE series 2/5 (part of Zoo-Code-Org#1329).

- ApiHandlerCreateMessageMetadata.reasoningEffort: per-request override channel
- resolveEffectiveReasoningEffort: single shared resolution point (override > settings > model default)
- AnthropicHandler: adaptive output_config.effort envelope in both requestParams branches (in-range only)
- Task: setRuntimeThinkingEffort/getRuntimeThinkingEffort with in-memory apiConfiguration merge/restore, per-request metadata at all four createMessage sites, dispose() reset; never persisted
DTE series 2/5 — addresses the CodeRabbit review finding on Zoo-Code-Org#1338:
when a task-local thinking-effort override is active, updateApiConfiguration()
now re-captures the incoming profile's reasoningEffort as the restore value
and re-applies the override on top of the new in-memory copy, so clearing the
override restores the NEW profile value instead of the stale one. Additive:
activation and clearing semantics are otherwise unchanged.

Adds two regression tests (override active + profile switch restores new
value; inactive updateApiConfiguration unchanged behavior).
DTE series 2/5 — addresses the CodeRabbit docstring-coverage warning on Zoo-Code-Org#1338
(33.33% < 80% across the functions touched by the diff):
- AnthropicHandler.createMessage: documents the shared effective-effort
  resolution and the adaptive output_config.effort envelope (in-range only).
- Task.dispose: documents centralized teardown incl. the transient task-local
  override reset.
- Task.updateApiConfiguration: documents the override-preservation behavior
  (re-captured restore value + re-applied override on the new in-memory copy).

Comment-only change: 30/30 patch lines and 10/10 branches unchanged;
317/317 tests and tsc --noEmit re-verified green.
Add the set_thinking_effort native tool (DTE series 3/5): the model adjusts
its own per-turn thinking effort mid-task with no approval gate.

- Guardrails: one-line chat notification (success or refusal), escalation cap
  (max 3 upward changes per task), A->B->A oscillation refusal, hard clamp to
  the model capability array (ties toward the lower level).
- Gating: dynamicThinkingEffort experiment + model supportsReasoningEffort
  (non-empty array or true), evaluated at task start so the tool list stays
  stable within a task (prompt-cache safety).
- Display: webview ChatRow one-line row (applied / oscillation / escalation
  refusal), i18n keys in all 17 locales; partial streaming updates the same
  line.
- Tests: executor (clamp/cap/oscillation/no-op/no-approval/display), parser
  (partial + complete), dispatch, gating matrix, schema wiring, ChatRow
  display.

Stacked on DTE PR-1 (experiment flag) and PR-2 (task-local runtime effort
state). Closes Zoo-Code-Org#1330.
Address PR review feedback on set_thinking_effort (DTE series 3/5):

- Executor: seed the per-task guard history with the task's effective
  baseline so returning from a changed value to the original baseline is
  refused as oscillation (A -> B -> A); existing no-op behavior preserved.
- Parser: only build nativeArgs when effort AND reason are strings; a
  non-string payload now fails at parse time and cannot reach the executor.
- Gating: a supportsReasoningEffort array that only lists 'disable' no
  longer exposes the tool (it could apply no level).
- i18n: translate the new thinkingEffort chat strings into all 17
  non-English webview locales (placeholders preserved).
- Tests: regression tests for each change plus branch-coverage for the
  previously partial lines (non-string args, 'disable'-only capability,
  baseline oscillation, partial streaming without params, description
  fallback, capability robustness). All touched patch lines are now
  fully branch-covered (codecov patch partials resolved).

CodeRabbit: Zoo-Code-Org#1354
… post-mode-switch revalidation, ask prefill normalization)
…ent flag

The manual user-facing surfaces (composer bottom-bar toggle and task header
chip) are now normal features: they render whenever the selected model
advertises per-request reasoning effort support (supportsReasoningEffort
boolean-true or a non-empty level array), regardless of the
dynamicThinkingEffort experiment flag.

- computeThinkingEffortDisplay() no longer takes the experiment flag and
  returns null only when the model does not advertise per-request effort
  support.
- ThinkingEffortToggle and TaskHeader stop reading `experiments` from the
  extension state for this display.
- The dynamicThinkingEffort experiment now gates only the model-driven
  set_thinking_effort tool exposure. The rest of the extension-side pipeline
  (setTaskThinkingEffort handler, taskThinkingEffort state push,
  per-request effort envelope) was already ungated.
- Playwright CT fixture keeps its experiment-on initial state so the baselines
  render the identical component state (verified: 0 baseline drift).
Filter model capability entries to SETTABLE_EFFORTS plus disable before nearest-level selection so a capability array containing only unrecognized values (e.g. [weird]) is refused via the standard tool-error path instead of being applied as the runtime effort. Add unit coverage for all-garbage and mixed garbage capability arrays.
Replace the any-typed renderChatRow/sayToolMessage helpers with the ClineMessage type and a ThinkingEffortSayTool payload shape (thinkingEffort tool discriminator over ClineSayTool fields), preserving the existing fixture values.
Translate the DYNAMIC_THINKING_EFFORT name/description out of English in zh-CN, ja, ko, ru, de, ca, pt-BR, tr, vi, nl and pl, matching the terminology already used in each locale chat.json thinkingEffort strings. find-missing-translations --area=webview is clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants