Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(ai): keep the #7567 thinking-off rows to Sonnet 5.5 and Haiku 5.5

garrytan59226fd7ad5d
diff --git a/src/core/ai/thinking-off.ts b/src/core/ai/thinking-off.ts
index 5770ff49a7..e556158fe6 100644
--- a/src/core/ai/thinking-off.ts
+++ b/src/core/ai/thinking-off.ts
@@ -19,10 +19,10 @@
* a 400; between_tools at effort high or below is its off), reasoning off
* - Claude Haiku 5.5: `thinking: { type: 'disabled' }` (accepted only at
* effort high or below), reasoning off
- * - Claude Opus 5.5: `thinking: { type: 'adaptive' }`; it cannot turn
- * thinking off, only lower the effort, so it keeps reasoning and gets
- * the headroom below
* - older Claude: `thinking: { type: 'disabled' }`, reasoning off
+ * Claude Opus 5.5 cannot turn thinking off and still gets `disabled` here:
+ * pricing it with the thinking headroom puts the default fence-repair model
+ * over its default per-page cap, so that row waits on its own fix.
* Other routes whose option turns reasoning off keep the requested cap:
* - DeepSeek (`deepseek`; thinking is on by default for v4):
* `thinking: { type: 'disabled' }`
@@ -70,13 +70,13 @@ export interface ThinkingOffControl {
const THINKING_DISABLED: Record<string, unknown> = { thinking: { type: 'disabled' } };
-const CLAUDE_55_RE = /^claude-(sonnet|opus|haiku)-5-5(?:-\d{8})?$/;
-const CLAUDE_55_THINKING: Readonly<Record<string, string>> = { sonnet: 'between_tools', opus: 'adaptive', haiku: 'disabled' };
+const CLAUDE_55_RE = /^claude-(sonnet|haiku)-5-5(?:-\d{8})?$/;
+const CLAUDE_55_THINKING: Readonly<Record<string, string>> = { sonnet: 'between_tools', haiku: 'disabled' };
function anthropicControl(model: string): ThinkingOffControl {
const family = CLAUDE_55_RE.exec(model)?.[1];
if (!family) return { set: { namespace: 'anthropic', options: THINKING_DISABLED }, disables: true };
- return { set: { namespace: 'anthropic', options: { thinking: { type: CLAUDE_55_THINKING[family] }, effort: 'low' } }, disables: family !== 'opus' };
+ return { set: { namespace: 'anthropic', options: { thinking: { type: CLAUDE_55_THINKING[family] }, effort: 'low' } }, disables: true };
}
const GEMINI_ID_RE = /^gemini-(\d+(?:\.\d+)?)-(flash-lite|flash|pro)(?:-|$)/;
diff --git a/test/ai/anthropic-thinking-off-55.test.ts b/test/ai/anthropic-thinking-off-55.test.ts
index e2b4af9a8a..edbe858ac8 100644
--- a/test/ai/anthropic-thinking-off-55.test.ts
+++ b/test/ai/anthropic-thinking-off-55.test.ts
@@ -1,10 +1,10 @@
/**
* #7567: `thinking: 'off'` on a native Claude 5.5 route sends that model's
* lowest supported thinking setting with effort low, not the blanket
- * `{ type: 'disabled' }` (a 400 on Sonnet 5.5, ignored by Opus 5.5, valid on
- * Haiku 5.5 only at effort high or below). A configured budget or effort is
- * replaced and sibling options survive. Opus 5.5 still reasons, so its cap
- * and the preflight estimate get the thinking headroom. The wire check goes
+ * `{ type: 'disabled' }` (a 400 on Sonnet 5.5, valid on Haiku 5.5 only at
+ * effort high or below). A configured budget or effort is replaced and
+ * sibling options survive. Opus 5.5 keeps the older row until its pricing
+ * against the fence-repair caps is decided. The wire check goes
* through the real @ai-sdk/anthropic with a stub fetch: no network, no key.
*/
import { describe, expect, test } from 'bun:test';
@@ -19,8 +19,6 @@ const configured = () => ({ anthropic: { thinking: { type: 'enabled', budgetToke
const rows = [
{ model: 'claude-sonnet-5-5', thinking: 'between_tools', disables: true },
{ model: 'claude-sonnet-5-5-20261015', thinking: 'between_tools', disables: true },
- { model: 'claude-opus-5-5', thinking: 'adaptive', disables: false },
- { model: 'claude-opus-5-5-20261015', thinking: 'adaptive', disables: false },
{ model: 'claude-haiku-5-5', thinking: 'disabled', disables: true },
{ model: 'claude-haiku-5-5-20261015', thinking: 'disabled', disables: true },
];
@@ -47,7 +45,7 @@ describe('Claude 5.5 thinking-off controls (#7567)', () => {
const options = applyThinkingOff(configured(), route);
expect(options).toEqual({ anthropic: { thinking: { type: row.thinking }, effort: 'low', cacheControl: { type: 'ephemeral', ttl: '1h' } } });
const cap = thinkingOffMaxOutputTokens(route, REQUESTED, true, HEADROOM);
- expect(cap).toBe(row.disables ? REQUESTED : HEADROOM);
+ expect(cap).toBe(REQUESTED);
const { sent, warnings } = await sentBody(row.model, options, cap);
expect(warnings).toEqual([]);
expect(sent.thinking).toEqual({ type: row.thinking });
@@ -57,7 +55,7 @@ describe('Claude 5.5 thinking-off controls (#7567)', () => {
}
test('older Claude, DeepSeek and non-native Claude routes keep their behavior', () => {
- for (const route of ['anthropic:claude-opus-5', 'anthropic:claude-sonnet-4-6', 'anthropic:claude-haiku-4-5-20251001', 'anthropic:claude-sonnet-5-5-preview']) {
+ for (const route of ['anthropic:claude-opus-5-5', 'anthropic:claude-opus-5', 'anthropic:claude-sonnet-4-6', 'anthropic:claude-haiku-4-5-20251001', 'anthropic:claude-sonnet-5-5-preview']) {
expect(applyThinkingOff({}, route)).toEqual({ anthropic: { thinking: { type: 'disabled' } } });
expect(thinkingOffMaxOutputTokens(route, REQUESTED, true, HEADROOM)).toBe(REQUESTED);
}
diff --git a/test/fence-repair-llm.test.ts b/test/fence-repair-llm.test.ts
index bf86129fcc..1b716cdd5c 100644
--- a/test/fence-repair-llm.test.ts
+++ b/test/fence-repair-llm.test.ts
@@ -116,14 +116,6 @@ describe('Tier 3 requests and prompt', () => {
expect(tier3TokenBudget(req, 'claude-cli:claude-fable-5-1').maxOutputTokens).toBe(32000);
});
- test('Claude Opus 5.5, which cannot turn thinking off, is priced with the thinking headroom (#7567)', () => {
- const req = residualOf(rowLevel).requests[0]!;
- const table = tier3TokenBudget(req, 'anthropic:claude-opus-4-7').maxOutputTokens;
- expect(tier3TokenBudget(req, 'anthropic:claude-opus-5-5').maxOutputTokens).toBe(32000);
- expect(tier3TokenBudget(req, 'anthropic:claude-opus-5-5').maxOutputTokens).toBe(thinkingOffOutputCap('anthropic:claude-opus-5-5', table + TIER3_REASONING_TOKENS));
- expect(tier3TokenBudget(req, 'anthropic:claude-sonnet-5-5').maxOutputTokens).toBe(table + TIER3_REASONING_TOKENS);
- });
-
test('a fence with a stray text line inside is not eligible (rebuilding the table would drop it)', () => {
const stray = `${FB}\n| 1 | ${BROKEN} | fact | 0.9 | private | high | 2026-01-01 | | chat | ctx |\na stray note\n${FBE}\n`;
const out = residualOf(stray);