github / github/copilot-cli

Code-review task agents can mutate the shared parent worktree

Aperta
#4,195 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

area:agents area:permissions
Lingua principale
Shell
Stelle
11.2k
Fork
1.9k
Merge medio
14h 16m
PR unite (30g)
6

Descrizione

Describe the bug

Native task agents launched with agent_type: code-review can mutate the shared parent worktree even though the agent type is described as read-only. In one two-reviewer panel, both prompts explicitly required read-only tools and forbade shell commands, scratch files, and repository writes. After the reviewers completed, the parent worktree contained 13 new untracked files and temporary repositories whose names matched the edge cases discussed in the review output.

Prompt-only read-only instructions are not an adequate boundary for a built-in agent advertised as read-only. A reviewer can silently contaminate or overwrite a parent's in-progress work.

Affected version

1.0.71

Steps to reproduce the behavior
  1. Start a project session with one intentional uncommitted file change.
  2. Record git status --porcelain.
  3. Invoke two background task calls with agent_type: code-review.
  4. In each reviewer prompt, require investigation through view, rg, and glob only, and explicitly forbid shell commands, scratch files, and all writes.
  5. Ask the reviewers to inspect rename, file-mode, conflict, and submodule edge cases.
  6. Wait for both reviewers to complete and compare git status --porcelain with the snapshot.

The parent worktree gained these untracked artifacts:

source.txt
target.txt
test-conflict/
test-ita/
test-mode/
test-rename/
test-repo/
test-sub-target/
test-sub/
test_copy
test_copy.rs
test_mode
test_mode.rs

Removing exactly those post-snapshot artifacts restored the parent worktree. The workaround prevents this occurrence from contaminating the pull request, but it cannot prevent a reviewer from overwriting an existing parent file.

Expected behavior

A built-in code-review agent should have an enforced read-only tool profile, regardless of prompt text, so it cannot create, modify, or delete files in the parent worktree. If reviewer validation requires writes, the task should run in an isolated working copy or sandbox rather than the shared parent worktree.

Additional context

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia tracciando gli avvii delle attività native per agent_type: code-review e l’entry point del tool-profile dell’agente integrato; usa git status --porcelain prima e dopo la riproduzione con due revisori. È completato quando l’agente code-review non può creare, modificare o eliminare file nel worktree padre e la validazione copre i casi elencati di rinomina, modalità, conflitto e submodule.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
git
Ambito
devtools, security
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.