Skip to content

Agent defaults to partial scope execution on multi-file operations, producing incomplete migrations, regressions, and wasted compute time #316106

@wendall911

Description

@wendall911

Type: Bug

Description

When asked to perform operations across multiple files (e.g., "migrate all components from $app/stores to $app/state"), the GitHub Copilot agent consistently executes on a random subset of the targets instead of all of them. This violates basic English language semantics — "migrate all" means ALL, not "some."

This is not a minor UX issue. It produces broken intermediate states, downstream regressions, and requires correction iterations that consume significant additional compute time and user effort.


Concrete Example: SvelteKit + Tailwind Migration (this session)

Request

User asked for a complete migration: upgrade to pnpm, latest SvelteKit/Svelte 5/Tailwind 4, and migrate all components.

What the agent did (Session 1 — committed as bbfe217)

The agent migrated some of the 4 affected Svelte components but not all:

File What was done What was skipped
mode-toggle.svelte Updated $modemode.current Did NOT update on:clickonclick
main-nav.svelte Removed $: invert reactive; added CSS class Did NOT migrate $app/stores$app/state
nav.svelte Fixed self-closing div syntax Did NOT migrate $app/stores$app/state
contacts.svelte Fixed self-closing div syntax Did NOT migrate $:$derived

Resulting regression

The nav.svelte partial migration was the most harmful: the agent fixed the div syntax (/>></div>) so the green loading bar div now renders, but left the store import as $app/stores. When Session 2 completed the migration to $app/state, navigating became an object (always truthy) instead of a nullable value — making the green progress bar permanently visible at idle.

This regression required additional investigation and a specific fix: checking navigating.to instead of navigating for truthiness.

Session 1 chat history was also lost

When the Copilot Chat panel was closed, the entire session history was discarded. VS Code's chat session storage only persists single-request snapshots, not full multi-turn conversations. The user lost approximately one hour of context and had to reconstruct the migration plan from scratch by inspecting the git commit diff.


Root Cause Analysis

  1. Partial scope execution: The agent defaults to executing on a subset of targets rather than all targets. No natural language interpretation of "migrate all components" should mean "migrate some components."

  2. No scope discovery step: The agent should grep for all affected files first, display the complete target list, then execute. Instead, it appears to guess or assume a subset.

  3. No completion verification: After partial execution, the agent did not verify that all targets had been migrated (e.g., by checking for remaining $app/stores imports).

  4. Session history not persisted: Full multi-turn conversations are not saved anywhere recoverable. The existing chatSessions/*.json files only store one request per session entry. A long agentic session is unrecoverable if the panel is closed or the window crashes.


Expected Behavior

For any multi-target operation:

  1. Discover all targets (e.g., grep -r "$app/stores" src/)
  2. Display the complete list: "Found 4 files needing migration: nav.svelte, main-nav.svelte, contacts.svelte, mode-toggle.svelte"
  3. Confirm with user if scope is large
  4. Execute on ALL discovered targets
  5. Verify completion (re-run the grep, confirm 0 matches)

The default assumption must be ALL unless the user explicitly limits scope.


Impact

  • Incomplete migrations create broken intermediate states
  • Regressions require additional debugging and correction
  • Each correction iteration consumes additional compute tokens
  • Lost session history means rediscovering context from scratch

In this case: ~2 hours of total session time was consumed correcting issues caused by the agent's partial execution and the resulting regression.


Session Transcript

Full readable conversation transcript (user + assistant messages):
https://dpaste.com/5FXBDBLCW

Raw JSONL transcript (local path):
/home/wendallc/.config/Code/User/workspaceStorage/856672e5688144dbee927bed322ce2a8/GitHub.copilot-chat/transcripts/10523a21-d72e-4680-892c-c63d6db3096e.jsonl


Related Issues / Workarounds

The user was forced to create a global guardrails instruction file at:
/home/wendallc/.config/Code/User/prompts/global-guardrails.instructions.md

This file explicitly instructs the agent to perform scope discovery before executing multi-target operations. The fact that such a workaround is necessary to get correct behavior underscores that this is a product defect, not a user configuration issue.

Extension version: 0.45.1
VS Code version: Code 1.116.0 (560a9db, 2026-04-15T00:28:13Z)
OS version: Linux x64 6.19.12-200.fc43.x86_64
Modes:

Logs
Trace: [messagesAPI]SSE: {"delta":{"partial_json":", \"timeou","type":"input_json_delta"},"index":0,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"partial_json":"t\": 20000}","type":"input_json_delta"},"index":0,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"index":0,"type":"content_block_stop"}
Trace: [messagesAPI]SSE: {"copilot_usage":{"token_details":null,"total_nano_aiu":0},"delta":{"stop_reason":"tool_use","stop_sequence":null},"type":"message_delta","usage":{"cache_creation_input_tokens":321,"cache_read_input_tokens":106371,"input_tokens":1,"output_tokens":216}}
Trace: [messagesAPI]SSE: {"amazon-bedrock-invocationMetrics":{"cacheReadInputTokenCount":106371,"cacheWriteInputTokenCount":321,"firstByteLatency":1431,"inputTokenCount":1,"invocationLatency":3542,"outputTokenCount":216},"type":"message_stop"}
Info: [messagesAPI] message 0 returned. finish reason: [stop]
Trace: [messagesAPI]SSE: [DONE]
Info: ccreq:1aced064.copilotmd | success | claude-sonnet-4.6 -> claude-sonnet-4-6 | 5665ms | [panel/editAgent]
Trace: Resolving chat model
Debug: [Agent] rendering with budget=105227 (baseBudget: 127997, toolTokens: 11078, totalTools: 49, toolSearchEnabled: true), summarizationEnabled=true
Trace: Resolving chat model
Trace: Resolving chat model
Trace: Resolving chat model
Trace: Built prompt
Trace: Sending prompt to model
Warning: Tool click_element failed validation: object has unsupported top-level schema keyword 'oneOf'
Warning: Tool drag_element failed validation: object has unsupported top-level schema keyword 'allOf'
Warning: Tool hover_element failed validation: object has unsupported top-level schema keyword 'oneOf'
Warning: Tool run_playwright_code failed validation: object has unsupported top-level schema keyword 'oneOf'
Warning: Tool type_in_page failed validation: object has unsupported top-level schema keyword 'oneOf'
Debug: [PowerService] Acquired power save blocker, active count: 1
Debug: modelMaxPromptTokens 127997
Debug: modelMaxResponseTokens 32000
Debug: chat model claude-sonnet-4.6
Debug: GH request id: 23E3:125C4D:138766:157866:6A038671
Debug: request.response: [{"type":"ChatMessages"}], took 4561 ms
Debug: [PowerService] Released power save blocker acquisition, active count: 0
Debug: [PowerService] Scheduling power save blocker release in 120000ms
Trace: [messagesAPI]SSE: {"message":{"content":[],"id":"msg_bdrk_01PY7tu4JuzNAk5MxzozfRom","model":"claude-sonnet-4-6","role":"assistant","stop_reason":null,"stop_sequence":null,"type":"message","usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":244},"cache_creation_input_tokens":244,"cache_read_input_tokens":106692,"input_tokens":1,"output_tokens":1}},"type":"message_start"}
Trace: [messagesAPI]SSE: {"content_block":{"text":"","type":"text"},"index":0,"type":"content_block_start"}
Warning: [messagesAPI] Unknown content_block type 'text' at index 0 for model claude-sonnet-4-6
Trace: [messagesAPI]SSE: {"delta":{"text":"Got","type":"text_delta"},"index":0,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"text":" it.","type":"text_delta"},"index":0,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"text":" Now","type":"text_delta"},"index":0,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"text":" creating","type":"text_delta"},"index":0,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"text":" the bug report file","type":"text_delta"},"index":0,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"text":":","type":"text_delta"},"index":0,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"index":0,"type":"content_block_stop"}
Trace: [messagesAPI]SSE: {"content_block":{"id":"toolu_bdrk_014fJcDCpdyH91qTVmZNrDnW","input":{},"name":"create_file","type":"tool_use"},"index":1,"type":"content_block_start"}
Trace: [messagesAPI]SSE: {"delta":{"partial_json":"","type":"input_json_delta"},"index":1,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"partial_json":"{\"filePa","type":"input_json_delta"},"index":1,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"partial_json":"th","type":"input_json_delta"},"index":1,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"partial_json":"\": \"","type":"input_json_delta"},"index":1,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"partial_json":"/home/","type":"input_json_delta"},"index":1,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"partial_json":"wendallc","type":"input_json_delta"},"index":1,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"partial_json":"/Rep","type":"input_json_delta"},"index":1,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"partial_json":"os/gi","type":"input_json_delta"},"index":1,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"partial_json":"t/github/m","type":"input_json_delta"},"index":1,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"partial_json":"ine","type":"input_json_delta"},"index":1,"type":"content_block_delta"}
Trace: [messagesAPI]SSE: {"delta":{"partial_json":"craft/wenda","type":"input_json_delta"},"index":1,"type":"content_block_delta"}
Request IDs
9361de1e-3e3f-4408-8442-ba65582c6e88
5c61ffa3-b657-410f-8fa0-18de0481594c
3ca88782-bfe9-4d73-b792-6e89d0eeac7f
2caef609-5a48-4b17-8385-a5264d21495a
40f93a4d-218a-46d4-81ad-9958add6914a
b6dce181-602a-4022-ab46-bc8f196c663d
4cc0ae0b-037b-4623-ba07-4c68e4302c06
d81ccecd-4d16-4c39-839e-91c93c57d0aa
ad841241-bd3c-4203-ae4b-bf33928d8371
117a399c-0052-430c-9992-d3f08577e527
990324ca-a7e3-4bd1-ac73-7d7fffd35c5f
9c847227-c1e6-4c92-be88-2b2d04120c2a
44ed5fb5-6d27-48dd-b6b1-916ed331bdaa
00423002-79e2-4706-8ff2-79857e37a175
d3993c61-9171-42d2-bb1c-38ad6dd1b892
e74e2725-374f-406a-a2dc-de7460f84787
bb64ea6b-c3b1-4d58-be6f-7db60f2ddf27
0bbe8f37-a257-4025-84e3-4fb904da7c8c
3278e120-8434-46e7-b68a-32b30c218008
72584c85-f28a-4d15-a5a4-e38895f820a5
26d8473e-d89f-4ea5-b12b-110632f846e8
896ec0af-19f1-40a3-9fc8-df5f327abe49
dcaa4dd9-1148-4fc1-8c3f-c7a5964640dc
944e1040-58bc-42d4-9aa2-2cdfc53f3bd5
6ac5829e-e361-47d7-9d26-46cda9167698
1e298a36-8964-493f-b7fb-79a5f3e87b26
142c8fdf-d2b1-455a-9174-119946a7ff51
234739c9-6627-436d-9f8d-85d6200b1531
67b3f1b2-d256-4212-9def-85b34d0f8068
8a394527-74dc-4ee2-8e8f-2218fa4ca815
bb3affb6-2118-4ec9-b6d0-4342c155514f
4fa06b47-7b2b-4a42-a3b6-a2c101db0d67
ad41f2d2-e5b4-4975-aa30-32fe72afbaf4
e4312055-4ffb-4d70-a3a8-487c93d1660f
615dc6ad-dd57-4ba7-8f81-f9ab1f5bc306
34514a76-8866-4a12-82c8-7152686649d2
81de9c0c-d754-4dbb-b619-d2d27fd18929
f4443555-e838-441f-a8d3-d5f9d9421cc9
a419fed5-4e14-4fed-a5ca-394a24873142
88d39780-b154-4569-8f12-697fd08a9451
5dd0134d-8f34-420d-b3e1-9648b2748bbd
1b93396f-62a5-498b-a126-2543ae1a7827
9b3c7785-f737-4144-83e5-691758bca0b8
5c41cede-0a65-43ec-8352-dd0ebc7ce365
117ec59e-7e6b-4bff-b41a-dec053049ba0
bea3ab5f-ead8-4f0e-9774-4dfda0822f5c
5ac33635-14f8-4054-a326-ed5fe8b71895
89c50dac-b950-4aef-84ca-a570d5c1d610
33652003-2c7f-401e-a125-58bb1c7012d0
System Info
Item Value
CPUs AMD Ryzen 7 5700X 8-Core Processor (16 x 4645)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x1002 [Google Inc. (AMD)], DEVICE=0x67df [ANGLE (AMD, AMD Radeon RX 580 Series (radeonsi polaris10 ACO), OpenGL ES 3.2 Mesa 25.3.6)], DRIVER_VENDOR=Mesa, DRIVER_VERSION=25.3.6 ACTIVE
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: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off
Load (avg) 1, 1, 1
Memory (System) 62.71GB (31.99GB free)
Process Argv --crash-reporter-id 527f8027-1c60-4d80-a222-1e9037d52e13
Screen Reader no
VM 0%
DESKTOP_SESSION sway
XDG_CURRENT_DESKTOP sway:wlroots
XDG_SESSION_DESKTOP sway
XDG_SESSION_TYPE wayland
A/B Experiments
vsliv368cf:30146710
pythonvspyt551:31249599
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
63221493:31336333
envsdeactivate2:31505458
cloudbuttont:31379625
3efgi100_wstrepl:31403338
ddidtcf:31399634
ec5jj548:31422691
cmp-cht-diffpatch-lysithea-0011:31509976
cp_cls_t_966_ss:31454198
inlinechat_v2_hd992725:31505030
4je02754:31466945
8hhj4413:31478653
ge8j1254_inline_auto_hint_haiku:31490510
38bie571_auto:31478678
cp_cls_c_1081:31454833
conptydll_true:31498968
ia-use-proxy-models-svc:31452481
e9c30283:31461165
test_treatment2:31471001
idci7584:31464702
e3e4d672:31494082
ei9d7968:31496641
nes-extended-on:31455476
chat:31457767
8hig5102:31480529
7e187181:31503455
i2gc6536:31499202
52612955:31513034
ghj88844:31499326
23c7c724:31491644
ddid_c:31478207
getcmakediagnosticsoff:31489825
pro_large_t:31499376
cp_cls_c_1082:31504161
logging_enabled_new:31498466
j0d79568:31499440
jb_cp_cls_c_632:31510883
56dj4588:31512888
ha629193:31508444
e6ac6c27:31509471

Metadata

Metadata

Assignees

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