fix(tools): derive valid git diff argv in sandboxed decorator - #617
Merged
andreapn merged 1 commit intoSep 1, 2026
Merged
Conversation
1 task
Preciousuche
force-pushed
the
fix/tools-git-diff-sandbox-argv
branch
from
August 31, 2026 08:43
e06a85a to
0f0ae5d
Compare
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #614
Summary
Fixes the
@sandboxedargv_factoryderivation for the built-ingit_difftool.Problem
git_diff's@sandboxeddecorator defined itsargv_factoryas:This produced invalid arguments:
--unstagedis not a valid git flag.pathis omitted (None),str(a.get("path", ""))stringifiesNoneto"None".While this tuple is not directly executed by the runner, it feeds sandbox action fingerprinting (
sandbox/integration.py) and operator approval surfaces:git diff --unstaged None, misrepresenting the command that will execute.Solution
Replaced the inline lambda with
_git_diff_argv(a)that mirrors the actual command construction ingit_diff:("git", "diff")"--cached"only whenstagedis truthy["--", str(path)]only whenpathis provided and non-emptyTests
Added regression tests in
tests/test_tools/test_git_workdir_policy.pyverifying:("git", "diff")("git", "diff", "--cached")("git", "diff", "--", "src/main.py")("git", "diff", "--cached", "--", "src/main.py")Fixes #614