Copilot hangs on screenshot / image viewing
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Type: Bug
# Bug report: Copilot Chat agent turns hang indefinitely after a tool call completes successfully
## Summary
In VS Code's Copilot Chat agent/CLI sessions, a turn will sometimes hang forever after a tool call finishes. The tool's own execution succeeds and its completion is logged as forwarded successfully, but the session never receives (or never processes) the acknowledgment that would let the conversation continue. There is no timeout, so the turn just sits there indefinitely with no error shown to the user. This has been reproduced repeatedly across multiple days, multiple independent chat sessions, multiple models (Claude Sonnet 5, GPT-6 Astra), and multiple tool types (`screenshotPage`, `view`, and others).
## Environment
- VS Code: 1.137.0
- GitHub Copilot Chat: 0.65.0
- Copilot token SKU: `copilot_enterprise_seat_quota` (GitHub Enterprise managed org)
- OS: Windows
- Models affected: `claude-sonnet-5`, `gpt-6-astra` (not model-specific)
## Symptom
1. Agent calls a tool (e.g. `screenshotPage`, `view`, a browser-automation action).
2. The tool executes and its result is logged internally as delivered successfully.
3. The session-level acknowledgment that should unblock the next model turn never arrives.
4. The chat turn stays in "in progress" / "thinking" state indefinitely — minutes to (observed) 17+ minutes, sometimes never recovering within the observation window.
5. No error, no timeout, no retry is surfaced to the user. The only way out is manually cancelling the turn.
## Root-cause evidence (from `agenthost.log`)
Every hang shows the same shape: a tool's completion is forwarded successfully, but the paired session-level `Tool completed: ` event for that exact tool call ID never appears, even though it does appear consistently for tool calls that behave normally seconds earlier/later in the same session.
### Reproduction 1 — today, `screenshotPage`-family tool, session `8aff36d4-718d-4639-a251-3df7d7e74ed1`
```
10:47:49.799 [Copilot:691bd252...] Tool completed: toolu_01K5oz... <- previous tool, acknowledged normally
10:47:52.055 Permission response: toolCallId=toolu_01MuRK... <- next tool call approved
10:47:52.093 Forwarding client tool completion: source=client-dispatch, toolCallId=toolu_01MuRK..., success=true
[... nothing more for this session, ever, in the observation window ...]
```
Stuck for 30+ minutes at time of writing.
### Reproduction 2 — yesterday, `view` tool, session `f082a375-0ef7-4052-9494-eef3939ec017`
```
15:54:03 Tool started: view
15:54:04 Permission response: approve-once
[hang]
16:03:03 Full message received: 282 chars <- response arrives ~9 minutes late, after the client-side
turn context had already moved on
```
Same session hung again minutes later on another `view` call; recovered only after the user cancelled and resent with a fresh model/process.
### Reproduction 3 — two days ago, four independent sessions, all on `screenshotPage`
Sessions `80b01ae9`, `9f69a409`, `6751cb83`, `207e4753` — in every case: `Tool started: screenshotPage` → tool completion forwarded (`success=true`) → no further activity for that session ever again in the log; each was silently abandoned and a new chat was started.
### Confirmed NOT model-specific
Same session, switched from `claude-sonnet-5` to `gpt-6-astra` mid-incident — hung identically on both.
## Ruled out (with direct testing, not assumption)
- **Local DNS**: resolved cleanly on every check during hangs.
- **VPN/routing conflict** (two mesh VPN clients — NetBird + Tailscale — both active with adapter metrics prioritized above the physical NIC): stopped both services, confirmed clean DNS/TCP, hang still reproduced identically afterward.
- **Stale pooled HTTP connection reused across an idle gap**: fully reloaded the VS Code window (fresh extension host process, fresh connections) and resent — hang still reproduced.
- **OS-level TCP idle timeout / dead socket reuse**: set `HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\KeepAliveTime`/`KeepAliveInterval` to 30s/5s (from the 2-hour default) and explicitly enabled `SO_KEEPALIVE` on a raw test socket to `api.githubcopilot.com` — the connection still died/failed identically under idle conditions, and re-testing after applying the fix showed no improvement in the actual Copilot Chat hangs.
- Directly measured that idle HTTPS connections from this network die silently after ~5 minutes (reproduced against both `api.githubcopilot.com` and an unrelated host, `www.google.com`), but this is a separate, generic network characteristic — not correlated with when the Copilot Chat hangs actually occur (hangs also occur on freshly established connections, immediately after a tool call, well under any idle threshold).
## Why this points at an internal extension/session-state bug, not infrastructure
The tool's completion is already recorded as successfully forwarded (`AgentSideEffects: Forwarding client tool completion ... success=true`) *before* the hang begins. The gap is entirely between that already-successful internal event and the session picking it up — i.e., it's happening after any network round-trip has already completed, inside the running extension host process. This is consistent with a race condition or lost message in the session's internal event bus/state machine for tool-completion acknowledgment, not a network, proxy, VPN, or backend-availability issue.
## Impact
Any agent workflow that relies on browser-based visual verification (`screenshotPage`, `clickElement`, `navigatePage`, etc.) or even plain file-reading tools (`view`) is at risk of the entire turn hanging indefinitely with no recovery, forcing the user to manually cancel and resend — which loses the model's in-progress reasoning/context for that turn and makes visual verification of UI work unreliable in agent mode.
## Suggested next step for investigation
Look at the session/turn state machine's handling of the `Tool completed: ` event relative to `AgentSideEffects: Forwarding client tool completion`, particularly for tool calls where the two are momentarily decoupled (e.g. a fast follow-up tool call approved before the prior one's UI/state bookkeeping finishes) — this is the exact moment where every observed hang begins.
VS Code version: Code 1.137.0 (645f29cc3176500b4b5762ba887cf2a7f0ffdf2c, 2026-09-08T13:43:59-07:00)
OS version: Windows_NT x64 10.0.26200
Modes:
System Info
|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) Ultra 7 155H (22 x 2995)|
|GPU Status|2d_canvas: enabled
GPU0: VENDOR= 0x8086, DEVICE=0x7d55 [Intel(R) Arc(TM) Graphics], DRIVER_VENDOR=Intel, DRIVER_VERSION=32.0.101.8508 *ACTIVE*
GPU1: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.9278
Machine model name:
Machine model version:
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgpu: enabled
webnn: disabled_off|
|Load (avg)|undefined|
|Memory (System)|63.32GB (12.21GB free)|
|Process Argv|--folder-uri file:///c%3A/_AzureGitRepos/tehnicka-podrska-portal --crash-reporter-id cf8e0810-8329-45cf-8b5e-f469811c6b5f|
|Screen Reader|no|
|VM|0%|
Extensions (59)
Name|Identifier|Author|Version
---|---|---|---
Project Manager|alefragnani.project-manager|alefragnani|13.1.0
SQLite|alexcvzz.vscode-sqlite|alexcvzz|0.14.1
Claude Code for VS Code|anthropic.claude-code|Anthropic|2.1.270
Docker DX|docker.docker|docker|0.18.0
XML Tools|dotjoshjohnson.xml|DotJoshJohnson|2.5.1
Debugger for Firefox|firefox-devtools.vscode-firefox-debug|firefox-devtools|2.15.0
shell-format|foxundermoon.shell-format|foxundermoon|7.2.8
GitHub Actions|github.vscode-github-actions|github|0.32.3
GitHub Pull Requests|github.vscode-pull-request-github|GitHub|0.166.0
Go|golang.go|golang|0.56.1
Spreadsheet Viewer|grapecity.gc-excelviewer|GrapeCity|4.2.66
Random Everything|helixquar.randomeverything|helixquar|0.0.3
Peacock|johnpapa.vscode-peacock|johnpapa|4.4.1
Rainbow CSV|mechatroner.rainbow-csv|mechatroner|3.24.1
DotENV|mikestead.dotenv|mikestead|1.0.1
Container Tools|ms-azuretools.vscode-containers|ms-azuretools|2.5.0
German Language Pack for Visual Studio Code|ms-ceintl.vscode-language-pack-de|MS-CEINTL|1.131.2026090407
C# Dev Kit|ms-dotnettools.csdevkit|ms-dotnettools|3.20.207
C#|ms-dotnettools.csharp|ms-dotnettools|2.140.9
.NET Extension Pack|ms-dotnettools.vscode-dotnet-pack|ms-dotnettools|1.0.13
.NET Install Tool|ms-dotnettools.vscode-dotnet-runtime|ms-dotnettools|3.1.0
Microsoft Edge Tools for VS Code|ms-edgedevtools.vscode-edge-devtools|ms-edgedevtools|2.1.11
Kubernetes|ms-kubernetes-tools.vscode-kubernetes-tools|ms-kubernetes-tools|1.4.1
Data Workspace|ms-mssql.data-workspace-vscode|ms-mssql|0.6.3
SQL Server (mssql)|ms-mssql.mssql|ms-mssql|1.45.1
SQL Bindings|ms-mssql.sql-bindings-vscode|ms-mssql|0.4.1
SQL Database Projects|ms-mssql.sql-database-projects-vscode|ms-mssql|1.7.0
Playwright Test for VSCode|ms-playwright.playwright|ms-playwright|1.1.19
Python Debugger|ms-python.debugpy|ms-python|2026.6.0
Python|ms-python.python|ms-python|2026.4.0
Pylance|ms-python.vscode-pylance|ms-python|2026.3.1
Python Environments|ms-python.vscode-python-envs|ms-python|1.36.0
Data Wrangler|ms-toolsai.datawrangler|ms-toolsai|1.24.2
Jupyter|ms-toolsai.jupyter|ms-toolsai|2025.9.1
Jupyter Keymap|ms-toolsai.jupyter-keymap|ms-toolsai|1.1.2
Jupyter Notebook Renderers|ms-toolsai.jupyter-renderers|ms-toolsai|1.3.0
Jupyter Cell Tags|ms-toolsai.vscode-jupyter-cell-tags|ms-toolsai|0.1.9
Jupyter Slide Show|ms-toolsai.vscode-jupyter-slideshow|ms-toolsai|0.1.6
Dev Containers|ms-vscode-remote.remote-containers|ms-vscode-remote|0.469.0
Remote - SSH|ms-vscode-remote.remote-ssh|ms-vscode-remote|0.128.0
Remote - SSH: Editing Configuration Files|ms-vscode-remote.remote-ssh-edit|ms-vscode-remote|0.87.0
WSL|ms-vscode-remote.remote-wsl|ms-vscode-remote|0.104.3
Remote Development|ms-vscode-remote.vscode-remote-extensionpack|ms-vscode-remote|0.26.0
PowerShell|ms-vscode.powershell|ms-vscode|2025.4.0
Remote Explorer|ms-vscode.remote-explorer|ms-vscode|0.5.0
Remote - Tunnels|ms-vscode.remote-server|ms-vscode|1.5.3
VS Code Speech|ms-vscode.vscode-speech|ms-vscode|0.16.0
Codex – OpenAI’s coding agent|openai.chatgpt|openai|26.908.40401
XML|redhat.vscode-xml|redhat|0.29.3
YAML|redhat.vscode-yaml|redhat|1.24.0
File Utils|sleistner.vscode-fileutils|sleistner|3.10.3
Even Better TOML|tamasfe.even-better-toml|tamasfe|0.21.2
Error Lens|usernamehw.errorlens|usernamehw|3.28.0
vscode-icons|vscode-icons-team.vscode-icons|vscode-icons-team|12.19.0
Vim|vscodevim.vim|vscodevim|1.32.4
TODO Highlight|wayou.vscode-todo-highlight|wayou|1.0.5
NGINX Configuration|william-voyek.vscode-nginx|william-voyek|0.7.2
change-case|wmaurer.change-case|wmaurer|1.0.0
Save as Root in Remote - SSH|yy0931.save-as-root|yy0931|1.12.0
A/B Experiments
```
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
envsactivate1:31551504
478i5457:31544283
cloudbuttont:31379625
3efgi100_wstrepl:31403338
bj468946:31457056
ddidtcf:31399634
ec5jj548:31422691
cp_cls_t_966_ss:31526232
4je02754:31466945
c3h7c220:31478652
ge8j1254_inline_auto_hint_haiku:31490510
cp_cls_t_1081:31454832
conptydll_true:31498968
e9c30283:31461165
c9b86496:31447327
ei9d7968:31496641
chat:31457767
8hig5102:31480529
89g7j272:31518289
i2gc6536:31499202
52612955:31516516
githubstableflight:31469463
ddid_c:31478207
hmra_i5g22:31518061
l_j1ci3728:31580635
7df3h592:31512476
cp_cls_t_1082:31535311
logging_enabled_new:31498466
j0d79568:31499440
jb_cp_cls_t_632:31543129
56dj4588:31512888
32d76977:31512328
ha629193:31508444
a1ije391_t:31540920
jbcp_cls_pctr_t:31531130
cp_intellij_t_nes:31548657
jf4hg949:31526829
ahp-both-windows:31556933
ihg5j128:31534457
9gg7f176:31542112
enable_editor_pane_layout:31569726
allow-none:31555437
36h42362:31564511
c7c27ce7:31554789
1h923230:31564177
treatment-23-1:31555779
unuse_dynamic_mcp:31555281
0d8dfbc3:31570291
switchtoauto:31559321
0c1h4866:31566224
vrbsty_fls:31561059
session-mark-done:31558131
5b8j3302:31564601
mangle-name-control:31572633
intellij_nes_preview_t:31580086
39a5d156:31574986
2bfb8b39:31576696
soft:31581111
aw-autom-on:31583758
revealsession_control_7ed7e840:31582193
permission_prompt_control:1332567
ccr_pr_nudge_adoption:1319471
vsc_wsm_t:1340632
jidc7660:1370295
1g5a5742:1379227
3aced641:1389836
```
Contributor guide
Assessment
This issue has not been assessed yet.