Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
19788c0
feat(settings): dynamic thinking effort experimental toggle (DTE-1)
easonliang28 Sep 4, 2026
82358bd
feat(api): per-request thinking effort override and adaptive effort e…
easonliang28 Sep 4, 2026
4075c8a
feat(task): task-local runtime thinking effort state with per-request…
easonliang28 Sep 4, 2026
710bf61
feat(settings): dynamic thinking effort experimental toggle (DTE-1)
easonliang28 Sep 4, 2026
521e0e6
feat(settings): dynamic thinking effort experimental toggle (DTE-1)
easonliang28 Sep 4, 2026
e2f249a
Merge branch 'main' into feat/dte-v2-1-dynamic-thinking-effort
easonLiangWorldedtech Sep 4, 2026
53f22dc
Merge upstream main (0d937c05081) into feat/dte-v2-1-dynamic-thinking…
easonliang28 Sep 4, 2026
18f488f
Merge feat/dte-v2-1-dynamic-thinking-effort (53f22dc) into feat/dte-v…
easonliang28 Sep 4, 2026
39762bf
test(settings): assert false and unset dynamicThinkingEffort persiste…
easonliang28 Sep 4, 2026
f97f8d9
Merge U2 head (18f488fa5) into U3 (stack sync: U1 final CR fixes + U2…
easonliang28 Sep 4, 2026
efbd336
Merge U1 final head (39762bf81) into U2 (stack sync: U1 last CR fix —…
easonliang28 Sep 4, 2026
c5b48aa
Merge U2 head (efbd336e5) into U3 (stack sync: U1 final persistence t…
easonliang28 Sep 4, 2026
e89cced
Merge upstream main (0dbd5846f) into U1 (stack sync: main v3.82.0 - G…
easonliang28 Sep 5, 2026
069c34b
Merge U1 head (e89cceddd9a) into U2 (stack sync: U1 final head in - m…
easonliang28 Sep 5, 2026
e8c66cf
Merge U2 head (069c34b9a) into U3 (stack sync: main advances to 0dbd5…
easonliang28 Sep 5, 2026
1edd728
fix(task): clear DTE runtime-effort state on disposal and dispose abo…
easonliang28 Sep 5, 2026
1087fcb
fix(task): restore API configuration when clearing the DTE effort ove…
easonliang28 Sep 5, 2026
4f71c00
merge(upstream): take main into DTE unit 3
Oct 6, 2026
8fdade5
test(webview): drop two explicit-any casts the merge re-introduced
Oct 6, 2026
6aa3560
merge(upstream): redo the spec resolutions from the merge stages
Oct 6, 2026
72fd869
test(webview): close the test the conflict cut open
Oct 6, 2026
7c98c57
Merge upstream/main into feat/dte-v2-3-task-runtime-effort
Oct 7, 2026
d47e937
chore: re-run the e2e-mock restart scenario
Oct 7, 2026
22586f9
Merge upstream main into feat/dte-v2-3-task-runtime-effort
easonliang28 Oct 13, 2026
ea2577a
Drop the double blank line the merge left between describes
easonliang28 Oct 13, 2026
1bbdab8
fix(settings): keep task-local thinking effort out of the profile pro…
easonliang28 Oct 14, 2026
66861d9
test(settings): regenerate experimental-settings visual baselines in …
easonliang28 Oct 14, 2026
f6e6a1e
chore(task): drop Stryker suppression comments per maintainer directive
easonliang28 Oct 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/types/src/__tests__/experiment.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { experimentIds, experimentIdsSchema, experimentsSchema } from "../experiment.js"

describe("dynamicThinkingEffort experiment", () => {
it("is part of the experiment id enum", () => {
expect(experimentIds).toContain("dynamicThinkingEffort")
expect(experimentIdsSchema.safeParse("dynamicThinkingEffort").success).toBe(true)
})

it("parses enabled and disabled states", () => {
expect(experimentsSchema.parse({ dynamicThinkingEffort: true })).toEqual({ dynamicThinkingEffort: true })
expect(experimentsSchema.parse({ dynamicThinkingEffort: false })).toEqual({ dynamicThinkingEffort: false })
expect(experimentsSchema.parse({})).toEqual({})
})

it("rejects non-boolean values", () => {
expect(experimentsSchema.safeParse({ dynamicThinkingEffort: "yes" }).success).toBe(false)
expect(experimentIdsSchema.safeParse("dynamic-thinking-effort").success).toBe(false)
})
})
2 changes: 2 additions & 0 deletions packages/types/src/experiment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const experimentIds = [
"runSlashCommand",
"customTools",
"parallelToolExecution",
"dynamicThinkingEffort",
] as const

export const experimentIdsSchema = z.enum(experimentIds)
Expand All @@ -28,6 +29,7 @@ export const experimentsSchema = z.object({
runSlashCommand: z.boolean().optional(),
customTools: z.boolean().optional(),
parallelToolExecution: z.boolean().optional(),
dynamicThinkingEffort: z.boolean().optional(),
})

export type Experiments = z.infer<typeof experimentsSchema>
Expand Down
11 changes: 9 additions & 2 deletions scripts/stryker-diff.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,15 @@ export const PACKAGE_CONFIGS = [
root: "src",
sourceRoot: "src/",
vitestConfig: "vitest.config.ts",
vitestRelated: false,
discoverRelatedTests: true,

// Use plugin-side related-test discovery: with an explicit STRYKER_TEST_FILES
// list, stryker-js 10.0.0 plans static mutants with runtime activation
// (stryker-mutator/stryker-js#6144, #6209), which the vitest plugin can only
// apply after top-level code has run, producing false Survived results.
// Revert to vitestRelated: false / discoverRelatedTests: true once the
// upstream planner fix lands.
vitestRelated: true,
discoverRelatedTests: false,
// CI build/coverage tooling under src/scripts is excluded like the other build scripts:
// it is not shipped runtime code and is covered by src/scripts/__tests__/merge-lcov.spec.mjs.
excludedPaths: [
Expand Down
9 changes: 7 additions & 2 deletions scripts/stryker-diff.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,13 @@ describe("buildManifest", () => {
assert.equal(webview.runRoot, ".")
assert.equal(webview.discoverRelatedTests, true)
assert.equal(webview.vitestRelated, false)
assert.equal(extension.discoverRelatedTests, true)
assert.equal(extension.vitestRelated, false)

// The extension entry uses plugin-side related discovery while stryker-js 10.0.0
// plans static mutants with runtime activation when given explicit test files
// (stryker-mutator/stryker-js#6144, #6209); see the entry comment in stryker-diff.mjs.
assert.equal(extension.discoverRelatedTests, false)
assert.equal(extension.vitestRelated, true)

const types = manifest.packages.find(({ id }) => id === "types")
assert.equal(types.discoverRelatedTests, undefined)
assert.equal(types.vitestRelated, undefined)
Expand Down
9 changes: 9 additions & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
retiredProviderIdentifiers,
type ProviderSettings,
type ModelInfo,
type ReasoningEffortExtended,
type ModelRecord,
} from "@roo-code/types"

Expand Down Expand Up @@ -117,6 +118,14 @@ export interface ApiHandlerCreateMessageMetadata {
* when the user clicks stop, preventing wasted API tokens/compute on the provider side.
*/
abortSignal?: AbortSignal
/**
* Per-request thinking effort override (DTE series 2/5).
* When defined, takes precedence over the settings-derived `reasoningEffort`
* wherever the effective effort is resolved (see `resolveEffectiveReasoningEffort`).
* Task-scoped and transient: it applies to this request only (the next request
* after being set — no mid-stream effect) and is never persisted to settings.
*/
reasoningEffort?: ReasoningEffortExtended
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// npx vitest run src/api/transform/__tests__/dte-effective-reasoning-effort.spec.ts

import { ADAPTIVE_OUTPUT_CONFIG_EFFORTS, resolveEffectiveReasoningEffort } from "../reasoning"

describe("DTE series 2/5 — resolveEffectiveReasoningEffort", () => {
const settingsEffort = "high"
const modelDefault = "medium"

it("returns the per-request override when present (strongest precedence)", () => {
expect(
resolveEffectiveReasoningEffort({
override: "xhigh",
settingsReasoningEffort: settingsEffort,
modelDefaultEffort: modelDefault,
}),
).toBe("xhigh")
})

it("lets the override win even when it is out-of-range for the adaptive envelope", () => {
// "minimal" is a valid override value but outside the adaptive envelope set;
// resolution still returns it — envelope gating is the caller's concern.
expect(
resolveEffectiveReasoningEffort({
override: "minimal",
settingsReasoningEffort: settingsEffort,
modelDefaultEffort: modelDefault,
}),
).toBe("minimal")
})

it("falls back to the settings value when no override is present", () => {
expect(
resolveEffectiveReasoningEffort({ settingsReasoningEffort: "low", modelDefaultEffort: modelDefault }),
).toBe("low")
})

it("preserves the settings 'disable' sentinel when no override is present", () => {
expect(
resolveEffectiveReasoningEffort({ settingsReasoningEffort: "disable", modelDefaultEffort: modelDefault }),
).toBe("disable")
})

it("an explicit override wins over a settings 'disable' sentinel", () => {
expect(resolveEffectiveReasoningEffort({ override: "low", settingsReasoningEffort: "disable" })).toBe("low")
})

it("falls back to the model default when neither override nor settings is set", () => {
expect(resolveEffectiveReasoningEffort({ modelDefaultEffort: "low" })).toBe("low")
})

it("returns undefined when nothing is set", () => {
expect(resolveEffectiveReasoningEffort({})).toBeUndefined()
})

it("exposes exactly the in-range adaptive envelope efforts", () => {
expect([...ADAPTIVE_OUTPUT_CONFIG_EFFORTS]).toEqual(["low", "medium", "high", "xhigh", "max"])
})
})
45 changes: 45 additions & 0 deletions src/api/transform/reasoning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,51 @@ export type AnthropicProviderReasoningParams =

export type OpenAiReasoningParams = { reasoning_effort: OpenAI.Chat.ChatCompletionCreateParams["reasoning_effort"] }

/**
* DTE series 2/5 — effort levels accepted by the Claude 4.7+ adaptive-thinking
* `output_config.effort` envelope. Efforts outside this set (e.g. "none",
* "minimal", "disable") omit the envelope so the API applies its own default.
*/
export const ADAPTIVE_OUTPUT_CONFIG_EFFORTS: readonly ReasoningEffortExtended[] = [
"low",
"medium",
"high",
"xhigh",
"max",
]

/**
* DTE series 2/5 — resolves the effective thinking effort for a single request.
*
* Resolution order (strongest first):
* 1. `override` — the per-request task-local effort
* (`ApiHandlerCreateMessageMetadata.reasoningEffort`),
* 2. `settingsReasoningEffort` — the settings-derived value,
* 3. `modelDefaultEffort` — the model's default effort.
*
* This is the single shared resolution point for the per-request override:
* providers that resolve the effective effort through it inherit the override
* without duplicating precedence logic. The override is transient (next request
* only) and never persisted to settings.
*/
export const resolveEffectiveReasoningEffort = ({
override,
settingsReasoningEffort,
modelDefaultEffort,
}: {
override?: ReasoningEffortExtended
settingsReasoningEffort?: ReasoningEffortExtended | "disable"
modelDefaultEffort?: ReasoningEffortExtended
}): ReasoningEffortExtended | "disable" | undefined => {
if (override !== undefined) {
return override
}
if (settingsReasoningEffort !== undefined) {
return settingsReasoningEffort
}
return modelDefaultEffort
}

// Valid Gemini thinking levels for effort-based reasoning
const GEMINI_THINKING_LEVELS = ["minimal", "low", "medium", "high"] as const

Expand Down
Loading
Loading