Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

Recognize every request-body shape that turns reasoning off

Claude43c0452a976e
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index 279005c9b..e8a363e24 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -27226,19 +27226,32 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// Whether a second look may think: only a model planning tells not to
// think (/no_think). Reasoning turned off in the provider's settings or in
// its extra request body stays off (mergeProviderRequestBody merges both
- // under every request), and a model without a thinking mode (Qwen3
- // Instruct-2507, Qwen3 Coder) would only repeat its first answer.
+ // under every request), so the retry could not think and would only cost
+ // another request; a model without a thinking mode (Qwen3 Instruct-2507,
+ // Qwen3 Coder) would only repeat its first answer.
_plannerCanRethink(provider) {
if (!this._plannerPrefersNoThinkPrompt(provider)) return false;
const config = provider?.config && typeof provider.config === 'object' ? provider.config : {};
if (/instruct-2507|coder/i.test(String(provider?.model || config.model || ''))) return false;
- const extra = config.extraBody && typeof config.extraBody === 'object' ? config.extraBody : {};
- if (extra.chat_template_kwargs?.enable_thinking === false || extra.enable_thinking === false
- || extra.reasoning?.enabled === false || extra.thinking?.type === 'disabled') return false;
+ if (this._extraBodyDisablesReasoning(config.extraBody)) return false;
return normalizeProviderCompatibility({ ...config, providerName: config.providerName || provider?.name || '' })
.reasoningEffort !== 'off';
}
+ // The request-body shapes that turn reasoning off: Qwen and vLLM chat
+ // template switches (enable_thinking, thinking), DeepSeek's thinking type
+ // and its Responses effort, OpenRouter's reasoning object, and a top-level
+ // reasoning_effort of none or off.
+ _extraBodyDisablesReasoning(extraBody) {
+ const extra = extraBody && typeof extraBody === 'object' ? extraBody : {};
+ const kwargs = extra.chat_template_kwargs && typeof extra.chat_template_kwargs === 'object' ? extra.chat_template_kwargs : {};
+ const effortOff = value => typeof value === 'string' && ['none', 'off'].includes(value.trim().toLowerCase());
+ return kwargs.enable_thinking === false || kwargs.thinking === false || extra.enable_thinking === false
+ || extra.thinking === false || extra.thinking?.type === 'disabled'
+ || extra.reasoning === false || extra.reasoning?.enabled === false || effortOff(extra.reasoning?.effort)
+ || effortOff(extra.reasoning_effort);
+ }
+
// What a second look told not to re-ask may run, measured against what the
// user backed: the question they just answered, as the app stored it (a
// question keeps the people to address and the schedule of the task it
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index d01429a7b..a5264d558 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -24264,19 +24264,32 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// Whether a second look may think: only a model planning tells not to
// think (/no_think). Reasoning turned off in the provider's settings or in
// its extra request body stays off (mergeProviderRequestBody merges both
- // under every request), and a model without a thinking mode (Qwen3
- // Instruct-2507, Qwen3 Coder) would only repeat its first answer.
+ // under every request), so the retry could not think and would only cost
+ // another request; a model without a thinking mode (Qwen3 Instruct-2507,
+ // Qwen3 Coder) would only repeat its first answer.
_plannerCanRethink(provider) {
if (!this._plannerPrefersNoThinkPrompt(provider)) return false;
const config = provider?.config && typeof provider.config === 'object' ? provider.config : {};
if (/instruct-2507|coder/i.test(String(provider?.model || config.model || ''))) return false;
- const extra = config.extraBody && typeof config.extraBody === 'object' ? config.extraBody : {};
- if (extra.chat_template_kwargs?.enable_thinking === false || extra.enable_thinking === false
- || extra.reasoning?.enabled === false || extra.thinking?.type === 'disabled') return false;
+ if (this._extraBodyDisablesReasoning(config.extraBody)) return false;
return normalizeProviderCompatibility({ ...config, providerName: config.providerName || provider?.name || '' })
.reasoningEffort !== 'off';
}
+ // The request-body shapes that turn reasoning off: Qwen and vLLM chat
+ // template switches (enable_thinking, thinking), DeepSeek's thinking type
+ // and its Responses effort, OpenRouter's reasoning object, and a top-level
+ // reasoning_effort of none or off.
+ _extraBodyDisablesReasoning(extraBody) {
+ const extra = extraBody && typeof extraBody === 'object' ? extraBody : {};
+ const kwargs = extra.chat_template_kwargs && typeof extra.chat_template_kwargs === 'object' ? extra.chat_template_kwargs : {};
+ const effortOff = value => typeof value === 'string' && ['none', 'off'].includes(value.trim().toLowerCase());
+ return kwargs.enable_thinking === false || kwargs.thinking === false || extra.enable_thinking === false
+ || extra.thinking === false || extra.thinking?.type === 'disabled'
+ || extra.reasoning === false || extra.reasoning?.enabled === false || effortOff(extra.reasoning?.effort)
+ || effortOff(extra.reasoning_effort);
+ }
+
// What a second look told not to re-ask may run, measured against what the
// user backed: the question they just answered, as the app stored it (a
// question keeps the people to address and the schedule of the task it
diff --git a/test/planner-clarify-loop.mjs b/test/planner-clarify-loop.mjs
index e5488d22b..d5cd17934 100644
--- a/test/planner-clarify-loop.mjs
+++ b/test/planner-clarify-loop.mjs
@@ -388,6 +388,10 @@ for (const build of ['chrome', 'firefox']) {
const first = scriptedAgent({ provider, answers: [clarifyPlan()] });
await fullGate(first.agent);
assert.equal(first.calls.length, 1, 'no second look that could not think anyway');
+ const offInBody = { ...VLLM_QWEN, config: { ...VLLM_QWEN.config, extraBody: { reasoning: { effort: 'none' } } } };
+ const viaBody = scriptedAgent({ provider: offInBody, answers: [clarifyPlan()] });
+ await fullGate(viaBody.agent);
+ assert.equal(viaBody.calls.length, 1, 'nor when the extra request body turns it off');
const answered = scriptedAgent({ provider, answers: [clarifyPlan(), plannerPlan()] });
const result = await fullGate(answered.agent, { digest: ANSWERED_DIGEST, followUpContext: { answersPlannerQuestion: true } });
assert.equal(result.requestKind, 'execute');
@@ -559,6 +563,14 @@ for (const build of ['chrome', 'firefox']) {
assert.equal(agent._plannerCanRethink(withConfig({ compat: { reasoningEffort: 'off' } })), false);
assert.equal(agent._plannerCanRethink(withConfig({ extraBody: { chat_template_kwargs: { enable_thinking: false } } })), false);
assert.equal(agent._plannerCanRethink(withConfig({ extraBody: { reasoning: { enabled: false } } })), false);
+ for (const extraBody of [
+ { reasoning: { effort: 'none' } }, { reasoning: { effort: 'OFF' } }, { reasoning: false },
+ { reasoning_effort: 'none' }, { reasoning_effort: 'off' },
+ { chat_template_kwargs: { thinking: false } }, { thinking: { type: 'disabled' } }, { thinking: false }, { enable_thinking: false },
+ ]) assert.equal(agent._plannerCanRethink(withConfig({ extraBody })), false, `reasoning off: ${JSON.stringify(extraBody)}`);
+ for (const extraBody of [{ reasoning_effort: 'high' }, { reasoning: { effort: 'low' } }, { chat_template_kwargs: { enable_thinking: true } }]) {
+ assert.equal(agent._plannerCanRethink(withConfig({ extraBody })), true, `reasoning on: ${JSON.stringify(extraBody)}`);
+ }
assert.equal(agent._plannerCanRethink(withConfig({}, 'Qwen3-235B-A22B-Instruct-2507')), false, 'no thinking mode');
assert.equal(agent._plannerCanRethink(withConfig({}, 'qwen3-coder-30b-a3b')), false, 'no thinking mode');
assert.equal(agent._plannerCanRethink(withConfig({}, 'Qwen3-235B-A22B-Thinking-2507')), true);