Skip to content

hooks.json: PostToolUse hook never executes — relative script path is resolved against the workspace #33

Closed

Description

The PostToolUse hook in plugins/upgrade-agent/hooks.json cannot execute, because
its script paths are relative and get resolved against the user's workspace rather
than the plugin root.

Environment

  • Plugin: upgrade-agent 1.1.404 (commit a4f718e), installed at
    ~/.copilot/installed-plugins/upgrade-agent-plugins/upgrade-agent
  • Installed via the ms-dotnettools.upgrade-agent VS Code extension 1.1.290
  • Host: VS Code 1.133.0, Copilot Chat
  • OS: macOS 26.6 (25G72), arm64

Current declaration

{
  "version": 1,
  "hooks": {
    "PostToolUse": [{
      "type": "command",
      "bash": "bash hooks/scripts/track-telemetry.sh",
      "powershell": "powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File hooks/scripts/track-telemetry.ps1"
    }]
  }
}

The scripts ship correctly and are present on disk. They're simply not reachable from
the working directory the hook runs in.

Symptom

Every tool call surfaces "Warning from Post-Tool Use hook" in the chat UI:

bash: hooks/scripts/track-telemetry.sh: No such file or directory

Reproduction

With the working directory set to a workspace (as it is for hook execution):

$ echo '{}' | bash hooks/scripts/track-telemetry.sh
bash: hooks/scripts/track-telemetry.sh: No such file or directory
exit=127

$ echo '{}' | bash ~/.copilot/installed-plugins/upgrade-agent-plugins/upgrade-agent/hooks/scripts/track-telemetry.sh
{"continue":true}
exit=0

The script works perfectly; only the path resolution fails.

Impact

Because the working directory is never the plugin root, this hook has presumably
never functioned on any platform. The progressive skill-load telemetry it exists
to collect is not being recorded for anyone. This is silent — the script is designed
to never block the host tool call, so the only visible trace is the warning.

Suggested fix

Resolve the script path against the plugin root rather than the process working
directory — either via a plugin-root variable if the hooks runtime exposes one, or by
having the runner resolve hooks.json command paths relative to the plugin directory.

I could not find a documented convention for this: the repo has no hook schema or
CONTRIBUTING.md, and $COPILOT_HOME appears only in the dashboard extension README,
describing extension install paths rather than hook commands. Guidance welcome and I'm
happy to test a patch on macOS.

Related

See: #34

Activity

  1. lonitra commented on Sep 15, 2026

    @lonitra
    Member

    Thank you for reporting this issue, this should be fixed as of version 1.1.485. If you notice any other issues, please don't hesitate to file another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions