Skip to content

Agent host: repo hooks silently skipped when workspace is opened via a symlinked path (/tmp) #347733

Closed

Description

Summary

In the Copilot harness (agent host), repository hooks in .github/hooks/*.json silently don't run when the workspace is opened through a symlinked path, for example /tmp/... on macOS, which resolves to /private/tmp/.... Hooks load and appear in the Customizations view, but none of their commands execute, and no warning is shown.

Impact

Anyone who opens a repo through a symlinked path (/tmp, a symlinked home or projects folder) gets no repo hooks, including security guards like PreToolUse deny hooks, with no indication anything is wrong.

Repro (macOS, VS Code Insiders 1.147.0, runtime 1.0.110-0)

  1. Create a git repo at /tmp/hook-probe with .github/hooks/hook.json:
    {"hooks":{"SessionStart":[{"type":"command","command":"echo ran >> /tmp/hook-marker.log"}],
              "UserPromptSubmit":[{"type":"command","command":"echo ran >> /tmp/hook-marker.log"}]}}
  2. code-insiders -n /tmp/hook-probe, pick the Copilot harness, send "Say hi".
  3. Expected: /tmp/hook-marker.log has two lines. Actual: the file is never created.
  4. Repeat with the same repo at ~/hook-probe (a non-symlinked path, also not in trustedFolders): both hooks run.

What I observed

  • agenthost.log: Granting the runtime 'session' trust for trusted working directory /tmp/hook-probe
  • The runtime session's cwd (session-state workspace.yaml) is /private/tmp/hook-probe.
  • The Customizations view lists the repo hooks as loaded.
  • Session events show only VS Code's SDK-callback hooks firing, not the repo file hooks.
  • The Copilot CLI with COPILOT_ALLOW_ALL=true in the same /tmp folder runs the hooks.

Likely cause (not confirmed in code)

VS Code grants trust for the unresolved path (/tmp/...) while the runtime tracks the resolved path (/private/tmp/...), so the trust doesn't match and repo hooks are skipped. VS Code side: src/vs/platform/agentHost/node/copilot/copilotSessionLauncher.ts (getCopilotWorkingDirectoryTrust).

Suggested fix

Canonicalize (realpath) the working directory before granting trust to the runtime. If repo hooks are skipped for trust reasons, show a warning in the session, as the CLI does ("Skipped repository hooks ... not trusted").

Activity

  1. added 4 commits that reference this issue on Nov 20, 2026
    219c51d
    301b1c2
    bd0b998
    b59bd58
  2. added a commit that references this issue on Nov 21, 2026
    d7919fd
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