Repository navigation
fix(cli): stop escalating read-only git commands in the sandbox - #14222
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Incremental review of commit Files Reviewed (1 files)
Previous Review Summaries (5 snapshots, latest commit 91aea98)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 91aea98)Status: No Issues Found | Recommendation: Merge Incremental review of commit Files Reviewed (1 files)
Previous review (commit 367a9cd)Status: No Issues Found | Recommendation: Merge Incremental review of commit Files Reviewed (2 files)
Previous review (commit 32aaae2)Status: 1 Issue Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)SUGGESTION
Files Reviewed (2 files)
Previous review (commit 2da7e2b)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit f90dc84)Status: 2 Issues Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (4 files)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
WebReflection
left a comment
There was a problem hiding this comment.
ok, I think latest change makes sense, thanks!
|
Added a quick comment to make it clear |
When the OS sandbox is enabled, the bash tool runs the git mutation classifier on every parsed command and forces an unsandboxed-run prompt on any match. The classifier treated several read-only forms as mutations, so users were prompted to leave the sandbox just to run
git remote -v,git stash list, orgit branch -v. This change teaches the classifier the read-only forms ofremote,stash,branch,tag,config,worktree,reflog,ls-remote, andnotes. Every writing form still mutates (git branch -d,git branch <name>,git stash push/pop/drop,git remote add/set-url,git config <key> <value>,git tag <name>,git worktree add), unknown subcommands still default to mutate, andgit fetch,git pull,git push, andgit clonestay mutating because they write refs or need network.This classifier is a convenience layer that reduces noisy escalation prompts. It is not a security boundary: a misclassified command still runs inside the sandbox, and command execution stays governed by the normal bash permission rules. It is scheduled for replacement when generic escalation lands, so the per-subcommand read/write sets are intentionally temporary.
Newly non-mutating forms:
git remote,git remote -v,git remote --verbose,git remote show,git remote get-urlgit stash list,git stash showgit branchlist forms:-v,-vv,-a,-r,-l,--list,--all,--remotes,--verbose,--show-current,--contains,--merged,--no-merged,--points-at,--format,--sort,--columngit taglist forms:-l,-v,-n,--list,--contains,--points-at,--merged,--no-merged,--format,--sort,--columngit config --get,--get-all,--get-regexp,--list, and the other existing read flagsgit worktree listgit reflog,git reflog show,git reflog existsgit notes,git notes list,git notes show,git notes get-refgit ls-remoteComposed forms are handled too: mutating flags win over list flags (
git branch -v -d feature,git tag -d v1 --column), option values are consumed (git branch foo -vstill mutates;git notes --ref <name> liststays read-only), and short-flag clusters are expanded (git branch -av,git tag -ln5).Manual test
Ran in an isolated dev-mode VS Code instance on macOS, with a disposable git workspace configured with
sandbox.enabled: trueandpermission.bash: "allow"so the only prompt under test is the sandbox escalation.git remote -vvia the bash tool. It ran and returned(no output); nosandbox_escalationcard appeared.git branch sandbox-selftest. Thesandbox_escalationcard appeared before execution: "Allow Git operation outside the sandbox? / Create sandbox-selftest branch / git branch sandbox-selftest". Rejected it, and the branch was not created (git branch --liststill showed onlymain).Automated coverage:
bun test ./test/kilocode/sandbox/git.test.ts(table-driven read/write cases),bun test ./test/kilocode/tool/shell-unparsed.test.ts(real shell scanner path),bun run typecheck, andbun run script/check-opencode-annotations.ts --worktree.