Code-review task agents can mutate the shared parent worktree
Personne n'a encore pris cette issue.
- Langage dominant
- Shell
- Étoiles
- 11.2k
- Forks
- 1.9k
- Merge moyen
- 14 h 16 min
- PR mergées (30 j)
- 6
Description
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
- Start a project session with one intentional uncommitted file change.
- Record
git status --porcelain. - Invoke two background
taskcalls withagent_type: code-review. - In each reviewer prompt, require investigation through
view,rg, andglobonly, and explicitly forbid shell commands, scratch files, and all writes. - Ask the reviewers to inspect rename, file-mode, conflict, and submodule edge cases.
- Wait for both reviewers to complete and compare
git status --porcelainwith 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
-
Environment: macOS arm64.
-
The reviewers were launched in background mode through the native
tasktool. -
The parent snapshot contained one modified tracked file and no untracked files before launch.
-
The most targeted fix would bind a read-only tool allowlist to the built-in
code-reviewagent. A broader fallback would isolate background task filesystems by default. -
Related sandbox and background-agent requests:
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par retracer les lancements de tâches natives pour agent_type: code-review et le point d’entrée du tool-profile de l’agent intégré ; utilisez git status --porcelain avant et après la reproduction avec deux réviseurs. C’est terminé lorsque l’agent code-review ne peut pas créer, modifier ou supprimer de fichiers dans le worktree parent, et que la validation couvre les cas listés de renommage, de mode, de conflit et de sous-module.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- git
- Domaine
- devtools, security
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 48/100