Skip to content

fix(hooks): map Copilot task/web_search in COPILOT_TOOL_MAP - #792

Open
ZxlDragonDoctor wants to merge 1 commit into
FailproofAI:mainfrom
ZxlDragonDoctor:fix/copilot-tool-map-task-web-search
Open

fix(hooks): map Copilot task/web_search in COPILOT_TOOL_MAP#792
ZxlDragonDoctor wants to merge 1 commit into
FailproofAI:mainfrom
ZxlDragonDoctor:fix/copilot-tool-map-task-web-search

Conversation

@ZxlDragonDoctor

@ZxlDragonDoctor ZxlDragonDoctor commented Sep 10, 2026

Copy link
Copy Markdown

Problem

COPILOT_TOOL_MAP in src/hooks/types.ts is missing documented Copilot tools task and web_search. Unmapped names pass through uncanonicalised, so a policy matching toolName === "Task" (or "WebSearch") silently never fires on Copilot.

Solution

  • Add task: "Task" and web_search: "WebSearch" next to the existing web_fetch: "WebFetch" entry.
  • Leave ask_user unmapped on purpose: it has no filesystem or shell reach, so it is not a guardrail surface. (Issue asked for a reasoned call either way.)
  • Extend the existing COPILOT_TOOL_MAP cases table in __tests__/hooks/handler.test.ts so a Copilot task payload canonicalises to Task (and web_searchWebSearch).

Issue alignment

Testing

  • Command: node node_modules/vitest/vitest.mjs run __tests__/hooks/handler.test.ts
  • Result: 59 passed (includes canonicalizes every Copilot tool name in COPILOT_TOOL_MAP covering task/web_search)
  • Also ran __tests__/hooks/copilot-canonicalize.test.ts: 8 passed

Agent dimension

tool-retrieval — tool-name canonicalisation so policy routing matches the Claude-canonical tool surface across CLIs.

Core value

Copilot users who believe Task policies are protecting them were never protected — this closes that silent gap.

Fixes #690

Summary by CodeRabbit

  • New Features
    • Added support for recognizing Copilot task and web_search tools using their canonical names.
    • Built-in policies can now apply to these tools during Copilot sessions.

Without these entries a policy matching toolName === Task or
WebSearch silently never fires on Copilot sessions. ask_user is
left unmapped (no filesystem or shell reach).

Fixes FailproofAI#690
@github-actions

Copy link
Copy Markdown
Contributor

Thanks @ZxlDragonDoctor for your contribution to Failproof AI! 🙌

We'd love to discuss your PR and welcome you to our community.

Discord: https://discord.befailproof.ai/
Reddit: https://www.reddit.com/r/failproofai/

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 5c377a52-e4b0-4e00-8024-5e542d74c133

📥 Commits

Reviewing files that changed from the base of the PR and between 7b88046 and 078b599.

📒 Files selected for processing (2)
  • __tests__/hooks/handler.test.ts
  • src/hooks/types.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The Copilot tool map now canonicalizes task to Task and web_search to WebSearch. Handler tests cover both mappings. ask_user remains unmapped.

Changes

Copilot tool canonicalization

Layer / File(s) Summary
Add Copilot mappings and handler coverage
src/hooks/types.ts, __tests__/hooks/handler.test.ts
COPILOT_TOOL_MAP adds task and web_search mappings. Handler tests verify the canonical names. ask_user remains unmapped.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 078b5

Copilot task and web_search tools now canonicalize to Task and WebSearch for policy matching, with targeted handler coverage passing. No merge-blocking correctness, security, or availability risk is evidenced.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: adding Copilot mappings for task and web_search.
Description check ✅ Passed The description explains the problem, solution, ask_user decision, issue alignment, and test results. It does not use the template headings or complete the Type of Change and checklist sections, but i…
Linked Issues check ✅ Passed The changes satisfy issue #690. COPILOT_TOOL_MAP now includes task: "Task" and web_search: "WebSearch", tests cover both mappings, and the PR documents the reasoned decision to leave ask_user unmapped…
Out of Scope Changes check ✅ Passed The changes are limited to the requested Copilot tool mappings and focused hook test coverage. No unrelated code changes are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

__tests__/hooks/handler.test.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

src/hooks/types.ts

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the tool-name trail
Task and WebSearch now prevail
The tests hop twice across the map
No silent gaps remain to trap
ask_user rests outside the lap

Comment @coderabbitai help to get the list of available commands.

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.

COPILOT_TOOL_MAP is missing task and web_searchTask policies silently never fire on Copilot

1 participant