fix(tools): derive valid git diff argv in sandboxed decorator (#614) - #636
Closed
Tiktokaiagent wants to merge 1 commit into
Closed
fix(tools): derive valid git diff argv in sandboxed decorator (#614)#636Tiktokaiagent wants to merge 1 commit into
Tiktokaiagent wants to merge 1 commit into
Conversation
Replace the inline lambda in git_diff's @sandboxed argv_factory with a dedicated named function that produces valid git invocations: - No --unstaged flag (invalid in git) - No empty string path when path=None - Properly adds -- separator before paths Fixes use-agent-os#614
1 task
Contributor
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.
Summary
Replaces the inline lambda in
git_diff's@sandboxedargv_factorythat produced an invalid--unstagedflag. Git does not accept--unstaged— the unstaged state is the default when--cachedis absent. The lambda also emitted an empty string forpathwhen no path was provided, producing a trailing empty argv element.Fix
_git_diff_argv()named function that properly handles all combinations:("git", "diff")("git", "diff", "--cached")("git", "diff", "--", "path")("git", "diff", "--cached", "--", "path")Changes
src/agentos/tools/builtin/git.py: replaced inline lambda with_git_diff_argv()tests/test_tools/test_git_workdir_policy.py: 4 new test casesTests
Verified git workdir policy tests pass:
Fixes #614