fix(trace): attribute shell changes in a mixed Copilot pre-tool batch
Draft
JA
5h ago+126+126+012345678901234567890123456789-15-15-01234567890123456789
Bug
Copilot CLI can send a pre-tool batch that holds both a file tool (create, edit, apply_patch) and a shell tool (bash, powershell). Trace kept only the file tool, so the file changes of the shell command were not attributed to the AI.
Change
- The Copilot provider keeps the shell command of a mixed batch, while the file tool stays the tool name.
- The shared pre-tool handler takes a worktree snapshot for the shell command of such a batch, then snapshots the files one by one.
Testing
go test ./app/cli/internal/trace/copilot/ -run TestReadHookInput -count=1passes, with a new case for a batched file and shell call.
Regression test: fails on base twice (/Command:"",/), passes on fix twice (go test ./app/cli/internal/trace/copilot/ -run TestReadHookInput -count=1)
Fixes #3803