fix(agent): rewrite deprecated VSCode tool names at Copilot deploy time (supersedes #2500, closes #2465) - #2519
fix(agent): rewrite deprecated VSCode tool names at Copilot deploy time (supersedes #2500, closes #2465)#2519Daniel Meppiel (danielmeppiel) wants to merge 6 commits into
Conversation
VSCode Copilot namespaced its built-in tool identifiers (e.g. 'askQuestions' -> 'vscode/askQuestions'). Any package that ships an agent with old unnamespaced tool names in its 'tools:' frontmatter triggers 'Tool or toolset has been renamed' warnings in the IDE after 'apm install --target copilot'. Fix: add GITHUB_AGENT_TOOL_RENAMES mapping and apply it at deploy time in _copy_github_agent(). The transform is wired into both the target-driven integrate_agents_for_target (github_agent format_id) and the legacy integrate_package_agents path. Source package files are never modified. Six renames applied automatically: askQuestions -> vscode/askQuestions runInTerminal -> execute/runInTerminal getTerminalOutput -> execute/getTerminalOutput createFile -> edit/createFile fetch -> web/fetch listDirectory -> search/listDirectory Added 12 regression tests covering the static helper, all six renames, edge cases (no frontmatter, null/non-list tools, unknown names, already-namespaced names), and both integration paths. Updated instructions-and-agents.md: copilot row in the transform table and a new 'Common pitfalls' entry for old tool names. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…_tool_renames - Preserve non-string YAML entries (mappings, sequences) as-is instead of coercing everything with str() when a rename occurs - Clarify docstring: 'semantically preserved' vs 'completely unchanged' to reflect that YAML roundtrip may alter formatting of unrelated keys Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… built-in tool identifiers to current namespaced form; no new normative APM behaviour, no spec extension Co-authored-by: sergio-sisternes-epam <sergio-sisternes-epam@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Addresses apm-review-panel CEO follow-ups FU-1, FU-2, FU-4 and
Copilot test-coverage finding TC-1:
FU-1 (CL-1/DX-1): _copy_github_agent now accepts diagnostics and
package_name params matching the signature of every other per-format
helper. When tool names are rewritten and diagnostics is supplied, an
info-level message names the file and count of rewrites -- preserving
diagnostic parity with _write_codex_agent and _warn_opencode_frontmatter.
Both call sites in integrate_agents_for_target and
integrate_package_agents are updated to pass the collector through.
FU-2 (DW-1/DW-2/DW-3): instructions-and-agents.md pitfall entry now
lists both the old names (askQuestions, runInTerminal, getTerminalOutput,
createFile, fetch, listDirectory) alongside the new namespaced forms so
authors can audit existing source files without reading the code. Bold
label shortened from 'Old unnamespaced VSCode built-in tool names' to
'Deprecated VSCode built-in tool names'. Table cell shortened from
twelve words to four ('tool names rewritten; otherwise verbatim').
Exact-match caveat added (e.g. fetchData is unaffected).
FU-4: CHANGELOG [Unreleased] Fixed entry added framing the change as a
user-facing IDE-warning fix, not an internal refactor.
TC-1: Added test_non_string_tool_entries_pass_through_unchanged to
TestGithubAgentToolRenames covering the isinstance(t, str) guard path
for mapping nodes in the tools list alongside renamed string entries.
Co-authored-by: sergio-sisternes-epam <sergio-sisternes-epam@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
GitHub merge-queue squash commits prepend '* ' to each cherry-picked commit message in the synthetic squash body. The Mode B detector's grep pattern '^apm-spec-waiver:' did not match the prefixed form '* apm-spec-waiver:', so the waiver set in commit 9e17395 was silently ignored during merge-queue CI runs, causing repeated Spec conformance failures even though the waiver was present. Fix: extend the git-log grep to '^(\* )?apm-spec-waiver:' and strip the optional '* ' prefix before extracting the rationale. The PR-body path (GH_PR_BODY env) is unaffected -- it only fires on plain PR triggers where the squash prefix cannot appear. Verified against the synthetic squash commit from the merge queue run gh-readonly-queue/main/pr-2500-3aa0365540e3d9ef4685740cea6a09094ff35377 (commit 0fc07a6): BASE_REF=FETCH_HEAD~1 mode_b_detector.sh exits 0 with the correct WAIVED message after this fix. Co-authored-by: sergio-sisternes-epam <sergio-sisternes-epam@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The _copy_github_agent method emits a diagnostics.info() call that is a new consumer of printable_ascii_text. Three fixes: 1. check_diagnostic_ascii_owner.py: add 'info' to the set of method names covered by _diagnostic_calls(), and add AgentIntegrator._copy_github_agent to AGENT_DIAGNOSTIC_FUNCTIONS (require_source=False, same as _warn_opencode_frontmatter) so the checker enforces the boundary on both package_name and source.name. 2. agent_integrator.py: wrap source.name with printable_ascii_text() in the info() message, matching the same pattern used by _warn_codex_unverified_scope and _warn_codex_tools_dropped. 3. test_check_diagnostic_ascii_owner.py: update test_opencode_wrapper_package_field_must_use_owner to target the second occurrence of the pattern (the first is now in _copy_github_agent), and add test_copy_github_agent_package_field_must_use_owner to cover the new consumer. Fixes Build & Test Shard 2 failure on supersede/pr-2500 CI. Co-authored-by: sergio-sisternes-epam <sergio-sisternes-epam@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a deploy-time compatibility shim for the copilot (github_agent) target by rewriting deprecated VSCode Copilot built-in tool identifiers (e.g., fetch) into their current namespaced forms (e.g., web/fetch) when deploying *.agent.md files, keeping existing package sources unchanged. It also updates the spec-waiver detector to recognize waiver trailers inside GitHub squash-commit bodies that prefix lines with * .
Changes:
- Add a
github_agent-specific frontmatter transform that renames deprecated VSCode Copilot tool identifiers during agent deployment, and wire it into both the current and deprecated deployment paths. - Emit an info diagnostic when a rewrite occurs, and add unit tests (including coverage for non-string
tools:entries). - Update documentation + changelog to describe the deploy-time rewrite, and harden the spec conformance waiver detector for merge-queue squash commits.
Show a summary per file
| File | Description |
|---|---|
| src/apm_cli/integration/agent_integrator.py | Adds the rename map + YAML-frontmatter rewrite and routes GitHub-agent deployment through the new copy helper with diagnostics. |
| tests/unit/integration/test_agent_integrator.py | Adds unit/integration coverage for the rename behavior and non-string tools: entries. |
| tests/spec_conformance/mode_b_detector.sh | Updates waiver detection to match * apm-spec-waiver: lines in squash commit bodies. |
| docs/src/content/docs/producer/author-primitives/instructions-and-agents.md | Documents that Copilot deployment rewrites deprecated tool names and lists the old/new identifiers. |
| CHANGELOG.md | Adds an Unreleased “Fixed” entry describing the deploy-time compatibility rewrite. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Lite
| if renamed is not content and diagnostics is not None: | ||
| count = sum(1 for old in GITHUB_AGENT_TOOL_RENAMES if old in content) | ||
| diagnostics.info( | ||
| message=( | ||
| f"{source.name}: rewrote {count} deprecated" | ||
| f" VSCode tool name(s) to namespaced form" | ||
| ), | ||
| package=printable_ascii_text(package_name), | ||
| ) |
| Package source files are never modified. Eliminates "Tool or toolset has | ||
| been renamed" IDE warnings without any source changes. (by | ||
| @sergio-sisternes-epam; closes #2465) (#2500) |
Shepherd summary (supersedes #2500)This PR was opened by the apm-review-panel shepherd loop after the original PR #2500 could not be updated (branch was locked in the merge queue whose Spec conformance gate was failing). Root causes identified and fixed in this PR:
Panel verdict: ship_now (no blocking findings, no security concerns, 82 tests passing) Folds from advisory panel:
Deferred:
CI on this PR: all 18 checks green at f590206.
Advisory comment on original PR: #2500 (comment) |
|
All shepherd folds (including copy_agent pre_transform unification from FU-3, mutation-break gates for all 3 regression traps, and full lint/CI evidence) have been pushed directly onto the original branch sergio-sisternes-epam-fix-agent-tools-frontmatter-rename-2465 via force-with-lease. PR #2500 is now the canonical landing target at head 8e169e5. Closing this superseding PR. |
|
Superseded by original PR #2500 which now carries the complete folded history. Closing. |
TL;DR
This PR rewrites deprecated VSCode Copilot built-in tool identifiers to their current namespaced form when APM deploys GitHub agents, so existing agent content keeps working without requiring source edits. This PR supersedes #2500 authored by Sergio Sisternes (@sergio-sisternes-epam). The original change is preserved with full commit authorship. Additional shepherd fold-ins are described below.
Closes #2465
supersedes #2500
apm-spec-waiver: deploy-time compat shim -- renames deprecated VSCode built-in tool identifiers to current namespaced form; no new normative APM behaviour, no spec extension
Problem (WHY)
apm-spec-waiver:inside GitHub squash commit bodies because GitHub prefixes each squashed commit message line with*.isinstance(t, str)guard would remain uncovered at the tool-list boundary.Approach (WHAT)
integrate_agents_for_targetand the deprecatedintegrate_package_agentsCopilot path through the GitHub-agent copy helper so both deployment paths normalize tool names._copy_github_agentto acceptdiagnosticsandpackage_name, then emit an info-level diagnostic when rewrites occur.instructions-and-agents.mdto list the old names explicitly, shorten the table cell, and call out the exact-match behavior.[Unreleased]Fixed entry describing the deploy-time compatibility shim.mode_b_detector.shso squash-commit bodies prefixed with*still matchapm-spec-waiver:and correctly waive the Spec conformance gate.Implementation (HOW)
src/apm_cli/integration/agent_integrator.pyGITHUB_AGENT_TOOL_RENAMES._apply_github_agent_tool_renames()._copy_github_agent(...), now withdiagnosticsandpackage_nameso rewrites are reported consistently.integrate_agents_for_targetand the deprecatedintegrate_package_agentsCopilot path.tests/unit/integration/test_agent_integrator.pyisinstance(t, str)guard throughtest_non_string_tool_entries_pass_through_unchanged.docs/src/content/docs/producer/author-primitives/instructions-and-agents.mdCHANGELOG.md[Unreleased]Fixed entry for the compatibility rewrite.tests/spec_conformance/mode_b_detector.sh*still satisfy the waiver grep.Trade-offs
integrate_package_agentspath still receives the fix so older call paths behave correctly, even though that keeps compatibility logic alive in a legacy surface.Validation
uv run --extra dev ruff check src/ tests/ && uv run --extra dev ruff format --check src/ tests/-> All checks passed, 1610 files already formatteduv run pytest tests/unit/integration/test_agent_integrator.py -q-> 82 passed in 1.66sBASE_REF=origin/main bash tests/spec_conformance/mode_b_detector.sh->[!] mode_b: WAIVED (89 substantive added lines)BASE_REF=FETCH_HEAD~1 GH_PR_BODY="" bash tests/spec_conformance/mode_b_detector.sh->[!] mode_b: WAIVEDHow to test
uv run pytest tests/unit/integration/test_agent_integrator.py -q.BASE_REF=origin/main bash tests/spec_conformance/mode_b_detector.shand then runBASE_REF=FETCH_HEAD~1 GH_PR_BODY="" bash tests/spec_conformance/mode_b_detector.shto verify waiver detection in both cases.Co-authored-by: sergio-sisternes-epam sergio-sisternes-epam@users.noreply.github.com
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com