fix(prompt-preset): render the Haiku 5.5 search-grounding sentence for Anthropic-native search

Merged
SU
24d ago
+123-6

Fixes #2935

Problem

The Claude Haiku 5.5 preset renders its search-grounding sentence only when the builtin web_search tool is active. A Haiku 5.5 session that can search only through Anthropic-native web search never gets the training-data-cutoff reminder, even though the model can search.

Change

  • prompt-preset/index.ts: the preset extension now passes nativeSearchAvailable into the prompt builder on both before_agent_start and model_select, using the same two checks the anthropic-web-search extension uses at before_agent_start: supportsNativeAnthropicWebSearch(model) && isAnthropicWebSearchEnabled().
  • dynamic-prompt/build.ts: new optional nativeSearchAvailable on BuildDynamicSystemPromptOptions / DynamicPromptCoreContext, threaded into corePrompt.
  • prompt-preset/presets.ts: withDefaults preserves the flag.
  • prompt-preset/claude-haiku-5-5.ts: the grounding line renders when the builtin web_search tool is active OR native search is available. No other preset reads the flag, so the Sonnet 5.5 prompt is unchanged.

Defect proof

New regression tests in prompt-presets-claude-haiku-5-5.test.ts (senpi#2935):

  • Native-only (selectedTools: ["read"], nativeSearchAvailable: true): the sentence is present and no date enters the prompt. Failed before the fix (1 failed / 24 passed), passes after.
  • Neither (nativeSearchAvailable: false, no web_search): the sentence is absent.
  • prompt-presets-claude-sonnet-5-5.test.ts: the Sonnet prompt with native search available contains no grounding sentence.

Tests

  • bun run --cwd packages/coding-agent test test/suite/prompt-presets-claude-haiku-5-5.test.ts test/suite/prompt-presets-claude-sonnet-5-5.test.ts: 46 passed.
  • Neighboring preset suites (prompt-presets-extension/contract/public-builders/app-surface/generation/shared-sections, anthropic-web-search-extension, prompt-presets-gemini-4-argon, prompt-presets-model-switch) + test/dynamic-prompt: 493 passed.
  • bun run check: exit 0 (oxlint 0 warnings, tsc --noEmit clean on 8,912 + 3,218 files).

Summary by cubic

Fixes the Claude Haiku 5.5 preset so its training-data-cutoff reminder renders when Anthropic-native web search is available, not only when the builtin web_search tool is selected.

  • Threads a nativeSearchAvailable flag through the dynamic prompt builder, computed from the same checks the anthropic-web-search extension uses: supportsNativeAnthropicWebSearch(model) && isAnthropicWebSearchEnabled().
  • Renders the grounding sentence when either the builtin tool or native search is available; the Sonnet 5.5 preset ignores the flag, so its prompt is unchanged.
  • Adds regression tests covering native-only, neither-builtin-nor-native, and Sonnet-unchanged cases, plus a release change fragment.