[BUG] Tool permission stream closes intermittently in VS Code extension (still occurring on 2.1.241) — related to #44157
Environment
- Claude Code version: 2.1.241 (cc_version=2.1.241.da2)
- Platform: VS Code extension (claude-vscode)
- OS: Windows 11 Pro 10.0.26200
What's Wrong?
Over an extended session, tool permission responses intermittently fail to reach
the extension, making the session appear frozen. The user had to repeatedly
prompt/re-confirm before the session would proceed.
Extension logs (Claude VSCode.log) show two related symptoms across multiple
sessions on 8/23–8/24 (dates relative to log timestamps):
- Repeated (10+ per session) warnings:
claude-vscode notification channel error: Received a response for an
unknown message ID: {"jsonrpc":"2.0","result":{},"id":0}; further channel
errors are not logged this session
- At least one occurrence of:
[DEBUG] [VSCode] Failed to send experiment_gates notification: Tool
permission stream closed before response received
This matches the root cause described in #44157 (race condition increateCanUseTool() / Promise.race between hook decision and SDK response,
causing orphaned permission responses). That issue was auto-closed as stale
without a fix landing, and the same symptom is still present on a much newer
version (2.1.241 vs. 2.1.92 reported there).
What Should Happen?
Permission responses should not be silently dropped/orphaned when the
Promise.race loses a leg. See #44157's suggested fixes (retry before deny,
deferred cleanup, or unified tracking of pendingRequests/resolvedToolUseIds).
Steps to Reproduce
- Run an extended VS Code extension session with many tool calls requiring
permission prompts
- Over time, permission responses intermittently fail to resolve, and the
session appears to hang until the user re-prompts
Additional Information
Related: #44157 (same root cause, Windows, stale-closed without fix)