Skip to content

feat(api): per-request thinking effort override and adaptive effort envelope (DTE series 2/5) - #37

Closed
easonLiangWorldedtech wants to merge 1 commit into
feat/dte-v2-1-dynamic-thinking-effortfrom
feat/dte-v2-2-per-request-effort
Closed

feat(api): per-request thinking effort override and adaptive effort envelope (DTE series 2/5)#37
easonLiangWorldedtech wants to merge 1 commit into
feat/dte-v2-1-dynamic-thinking-effortfrom
feat/dte-v2-2-per-request-effort

Conversation

@easonLiangWorldedtech

Copy link
Copy Markdown
Owner

Part of the DTE-v2 stack (≤400-line redo of Zoo-Code-Org#1338); this PR: adds per-request thinking-effort resolution (DTE-2) — the ADAPTIVE_OUTPUT_CONFIG_EFFORTS constant and the resolveEffectiveReasoningEffort precedence helper in src/api/transform/reasoning.ts, the transient reasoningEffort field on ApiHandlerCreateMessageMetadata in src/api/index.ts, and the accompanying spec.

Stack: base = feat/dte-v2-1-dynamic-thinking-effort (U1, PR #36, head 19788c03). Standalone diff vs that base:
113 additions + 1 deletion = 114 lines (≤400 budget). (measured with git diff --shortstat 19788c031667fc1e367511fb9026607652e0f9cb HEAD)

Related issue: #35 (DTE-v2 series tracking)

Amendments folded in (from plans/dte-gap-review.md): none for this unit.

Out of scope: the task-local runtime effort state and thinking-effort switch re-validation (U3), the persisted history / settings round-trip (U4), and the Anthropic adaptive output_config.effort envelope wiring that consumes these primitives (U5). This unit lands the resolution primitives and the API-surface metadata field only; no consumer reads metadata.reasoningEffort yet.

Pre-submission checklist:

  • CI locally: pnpm check-types (11/11), targeted vitest (dte-effective-reasoning-effort.spec.ts 8/8), eslint --prune-suppressions --max-warnings=0 (exit 0; the three files carry no suppressions, so src/eslint-suppressions.json is untouched by this PR)
  • i18n: not applicable — no locale files touched
  • Tests accompany all changed lines: the spec covers every precedence branch of resolveEffectiveReasoningEffort (override > settings > model default, the disable sentinel, out-of-envelope override passthrough, undefined) and pins ADAPTIVE_OUTPUT_CONFIG_EFFORTS to the exact adaptive envelope set (mutation-gate corollary for the array literal)
  • Visual baselines: none — no UI code in this unit
  • Line budget measured vs stack base (number above)

Binary files in this PR: none

Content fidelity note (union extraction):

  • Content source: union tree 27a2e97df (tag dte-legacy/union), legacy commit 6ea45b36a — "feat(task): task-local thinking effort state, per-request override, and adaptive effort envelope".
  • src/api/transform/reasoning.ts (+45) and the new spec (+58) are taken whole-file from the union; the per-file union history confirms no later DTE unit modified them.
  • src/api/index.ts is hunk-surgery: only the ReasoningEffortExtended import and the reasoningEffort metadata field (+9) are taken from the union. The union's removal of the case providerIdentifiers.geminiCli: fall-through line is a base-drift artifact (the union branch predates that upstream addition to main) and is deliberately not taken — the geminiCli case is preserved (the pre-commit prettier pass also normalized the indentation of that case's pre-existing comment by one tab — the PR's single deletion; the case line itself is unchanged).
  • src/shared/__tests__/experiments.spec.ts (the ledger's 4th file for the legacy DTE-2a commit) needs no change here: it already matches the union state in the U1 base (empty diff vs 27a2e97df), so that ledger line is already contained in PR feat(settings): dynamic thinking effort experimental toggle (DTE-1) #36.

Verification (local, worktree wt-dte-v2-2, base feat/dte-v2-1-dynamic-thinking-effort @ 19788c031667fc1e367511fb9026607652e0f9cb):

  • pnpm check-types → 11/11 green
  • vitest: pnpm --dir src exec vitest run api/transform/__tests__/dte-effective-reasoning-effort.spec.ts → 1 file / 8 tests passed
  • pnpm --dir src exec eslint --prune-suppressions --max-warnings=0 api/index.ts api/transform/reasoning.ts api/transform/__tests__/dte-effective-reasoning-effort.spec.ts → exit 0, no suppression entries in the three files
  • git diff --shortstat 19788c031667fc1e367511fb9026607652e0f9cb HEAD → 3 files, 113+ / 1− = 114 lines

@easonLiangWorldedtech

Copy link
Copy Markdown
Owner Author

Superseded by upstream PR Zoo-Code-Org#1522 (DTE-v2 stack moved upstream — CodeRabbit only runs there). Same head 82358bd, same content.

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