fix(prompt-preset): render the Haiku 5.5 search-grounding sentence for Anthropic-native search
Merged
SU
24d ago+123+123+012345678901234567890123456789-6-6-0123456789
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 passesnativeSearchAvailableinto the prompt builder on bothbefore_agent_startandmodel_select, using the same two checks theanthropic-web-searchextension uses atbefore_agent_start:supportsNativeAnthropicWebSearch(model) && isAnthropicWebSearchEnabled().dynamic-prompt/build.ts: new optionalnativeSearchAvailableonBuildDynamicSystemPromptOptions/DynamicPromptCoreContext, threaded intocorePrompt.prompt-preset/presets.ts:withDefaultspreserves the flag.prompt-preset/claude-haiku-5-5.ts: the grounding line renders when the builtinweb_searchtool 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, noweb_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 --noEmitclean 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
nativeSearchAvailableflag through the dynamic prompt builder, computed from the same checks theanthropic-web-searchextension 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.