Skip to content

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

Draft
Bhavya U (bhavyaus) wants to merge 8 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 8 commits into
mainfrom
dev/bhavyau/tool-search-prompt-snapshot

Conversation

@bhavyaus

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

Copy link
Copy Markdown
Collaborator

Summary

  • publish the canonical VS Code client-tool profile in Copilot Agent Host prompt snapshot tests
  • enable tool search through root configuration before each model turn
  • pin the resulting complete request bodies for 19 model families
  • reuse the same AHP fixture helpers in record-only tool-search coverage tests
  • make shared config/client synchronization reject stale or rejected action echoes
  • migrate the remaining inline root-config writers to the shared helper

The client profile models the Copilot extension boundary: its tool-search implementation is published over AHP by the toolSearch reference name. The snapshots then verify the downstream Agent Host prompt contribution.

Runtime dependency

Blocked on github/copilot-agent-runtime#18448, which restores SDK override behavior lost in Rust-port PR #13629. The currently pinned 1.0.83 runtime advertises and executes its regex search tool instead of the extension's natural-language client override.

The locally verified target snapshots are committed here. After #18448 releases, this PR must bump @github/copilot to the containing build so normal CI reproduces them:

  • 9 Claude families: natural-language tool_search_tool with { query } and 18 total defer_loading: true markers
  • 3 GPT 5.6 families: { type: "tool_search", execution: "client" } with { query }; deferred tools omitted initially
  • 7 unsupported GPT/Gemini families: no search declaration and eager representative tools
  • 0 regex tool-search definitions

The shared helper uses the same structural equality as the server's no-op check, so reordered object-valued config cannot dispatch a suppressed no-op and hang. Record-only tool-search coverage also fails unexpected client tools instead of returning a fabricated success.

Validation

  • npm run transpile-client
  • ./scripts/test-integration.sh --run src/vs/platform/agentHost/test/node/e2e/providers/copilotPromptsE2E.integrationTest.ts
  • prompt snapshots: 22 passing
  • patched runtime local override: full update and normal runs both pass all 22 tests
  • structural-equality regression: passes with the fix and reproduces the 30-second timeout under the old comparison
  • targeted Copilot, management, and Codex helper callers: passing

Review

A full adversarial review traced the rebased PR and the subsequent helper-hardening changes. The confirmed branch-review findings are addressed; no blocking issues remain.

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.

Comment thread src/vs/platform/agentHost/test/node/e2e/harness/agentHostE2ETestHarness.ts Outdated
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Base: 93c19157 Current: 9c61d9f9

No screenshot changes.

Bhavya U (bhavyaus) and others added 5 commits September 1, 2026 11:27
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>
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>
Describe the root-config seam now used by the Copilot prompt snapshot suite so maintainers know config-gated contributors can be covered end to end.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Match action echoes by channel, sequence, and server ordering; surface rejections; and use structural equality so server-suppressed no-op patches cannot hang tests. Reuse the helper across remaining root-config writers and reject unexpected tool calls in record-only coverage.

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 d480c1a to 1c1726e Compare September 1, 2026 18:27
Bhavya U (bhavyaus) and others added 3 commits September 1, 2026 14:10
Assert and snapshot the Copilot extension natural-language tool-search override across Claude and GPT Responses transports. Claude keeps deferred tools marked in place; GPT client search withholds them until discovery. Document the temporary dependency on runtime PR #18448.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove imports left unused after centralizing root-config updates so compile and hygiene checks pass.

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