microsoft / microsoft/vscode

Race condition between large PreToolUse hook and cmd output.

Open
#334,999 4 comments 0 reactions 1 assignee Claimed by @Giuspepe View on GitHub
stale triage-needed
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

- Copilot Chat Extension Version: Latest as of 2026-09-07
- VS Code Version: Latest as of 2026-09-07
- OS Version: macOS 26
- Feature (e.g. agent/edit/ask mode):
- Selected model (e.g. GPT 4.1, Claude 3.7 Sonnet): All

In the following setup:
- LLM makes bash cmd tool call generating large output (e.g. reading log)
- A custom PreToolUse hook script itself also produces large output

Both outputs get redirected to file `content.txt`, rather than inlined in conversation.
But there seems to be a race condition, and these writes step on each other.
In many cases, the write from hook output wins, and LLM agent will say "tool output polluted by hook" after reading `context.txt`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.