Skip to content

agentHost: pin tool-search behavior in prompt snapshots - #333689

Draft
Bhavya U (bhavyaus) wants to merge 4 commits into
mainfrom
dev/bhavyau/tool-search-prompt-snapshot
Draft

agentHost: pin tool-search behavior in prompt snapshots#333689
Bhavya U (bhavyaus) wants to merge 4 commits into
mainfrom
dev/bhavyau/tool-search-prompt-snapshot

Conversation

@bhavyaus

@bhavyaus Bhavya U (bhavyaus) commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI balanced review requested due to automatic review settings August 31, 2026 23:36
@bhavyaus
Bhavya U (bhavyaus) marked this pull request as draft August 31, 2026 23:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

Review tier: Balanced
Findings: 2 Medium severity · 1 Low severity

New issues introduced by this change (3)
Severity Finding
Medium severity src/​vs/​platform/​agentHost/​test/​node/​e2e/​harness/​agentHostE2ETestHarness.ts — The E2E architecture requires this suite to remain external to the Agent Host and explicitly…
Medium severity src/​vs/​platform/​agentHost/​test/​node/​e2e/​providers/​copilotPromptsE2E.integrationTest.ts — These expectations come directly from the implementation under test, contrary to the E2E suite's…
Low severity src/​vs/​platform/​agentHost/​test/​node/​e2e/​providers/​copilotPromptsE2E.integrationTest.ts — The current predicate returns true for gpt-5.6-sol, gpt-5.6-luna, and gpt-5.6-terra, and…
What changed in this PR

Updates Agent Host prompt snapshots to exercise and pin tool-search gating.

Changes:

  • Adds reusable E2E helpers for root configuration and active-client tools.
  • Asserts tool-search guidance and carrier behavior.
  • Regenerates all 19 model prompt snapshots.
File Description
copilotCoverageSuite.ts Reuses canonical harness helpers.
copilotPromptsE2E.integrationTest.ts Enables and asserts tool-search behavior.
agentHostE2ETestHarness.ts Adds configuration and client-tool helpers.
toolInstructions.ts Exports the tool-search guidance text.
…gpt-5.prompt.md Adds canonical client tools.
…gpt-5-mini.prompt.md Adds canonical client tools.
…gpt-5-codex.prompt.md Adds canonical client tools.
…gpt-5_1.prompt.md Adds canonical client tools.
…gpt-5_1-codex.prompt.md Adds canonical client tools.
…gpt-5_1-codex-mini.prompt.md Adds canonical client tools.
…gpt-5_6-sol.prompt.md Adds client tools and guidance.
…gpt-5_6-luna.prompt.md Adds client tools and guidance.
…gpt-5_6-terra.prompt.md Adds client tools and guidance.
…gemini-2_0-flash.prompt.md Adds canonical client tools.
…claude-haiku-4_5.prompt.md Adds client tools and guidance.
…claude-sonnet-4_5.prompt.md Adds client tools and guidance.
…claude-sonnet-4_6.prompt.md Adds client tools and guidance.
…claude-sonnet-5.prompt.md Adds client tools and guidance.
…claude-opus-4_5.prompt.md Adds client tools and guidance.
…claude-opus-4_6.prompt.md Adds client tools and guidance.
…claude-opus-4_7.prompt.md Adds client tools and guidance.
…claude-opus-4_8.prompt.md Adds client tools and guidance.
…claude-opus-5.prompt.md Adds client tools and guidance.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

} from '../../../../common/state/sessionState.js';
import { SEMANTIC_SEARCH_TOOL_NAME } from '../../../../common/semanticSearchConstants.js';
import { CLIENT_TOOL_SEARCH_REFERENCE_NAME } from '../../../../common/toolSearchConstants.js';
import { NON_DEFERRED_CLIENT_TOOL_NAMES } from '../../../../node/copilot/toolSearchDeferral.js';
Comment on lines +40 to +41
import { agentHostModelSupportsToolSearch, RUNTIME_TOOL_SEARCH_TOOL_NAME } from '../../../../node/copilot/toolSearchDeferral.js';
import { COPILOT_AGENT_HOST_TOOL_SEARCH_TOOL_INSTRUCTION } from '../../../../node/copilot/prompts/toolInstructions.js';
// green. The CLI applies a further gate of its own before exposing
// `tool_search_tool` (unsatisfied under replay), so only the
// host-authored guidance line is pinned in both directions.
const supportsToolSearch = agentHostModelSupportsToolSearch(model);
The prompt snapshot suite never advertised the `toolSearch` client tool, so
`toolSearchActive` was always false and the snapshots pinned nothing about
tool search. Re-enabling GPT tool search in #333657 produced a zero-line
snapshot diff, which is what surfaced the gap.

Give sessions the harness's canonical client-tool profile so the host's
client-tool-gated launch path is actually exercised, and assert on the
host-authored guidance line in both directions using the production
`agentHostModelSupportsToolSearch` predicate rather than a hand-copied
model list.

The CLI applies a second gate before exposing `tool_search_tool` that is
unsatisfied under replay, so the carrier itself cannot be asserted here.
`toolSearchToolWithoutHostGate` still catches a carrier leaking onto a
model the host gate excludes.

Extracts `setRootConfigValues`, `canonicalClientTools` and
`registerCanonicalActiveClient` into the harness, de-duplicating the
inline active-client setup in the tool-search coverage tests.

Also hoists the tool-search guidance string in `prompts/toolInstructions.ts`
to an exported constant so the test asserts against it rather than
duplicating 318 characters of prompt text. The template literal had no
interpolation, so this is a pure extraction.

All 19 model snapshots regenerate. 12 gain the guidance line (9 Claude plus
gpt-5.6-sol/luna/terra, which `agentHostModelSupportsToolSearch` covers via
`isGpt56Model`); the other 7 gain only the canonical client tools.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bhavyaus
Bhavya U (bhavyaus) force-pushed the dev/bhavyau/tool-search-prompt-snapshot branch from 15a630a to ed8f780 Compare August 31, 2026 23:42
Bhavya U (bhavyaus) and others added 2 commits August 31, 2026 17:20
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the prompt harness focused on the VS Code Copilot extension's toolSearch AHP reference rather than asserting on the SDK runtime's native carrier. Remove the duplicated investigation note from the repository.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants