Skip to content

fix: when a shell tool call invokes apply_patch, resolve relative paths against workdir, if specified - #556

Merged
bolinfest merged 1 commit into
mainfrom
pr556
Apr 22, 2025
Merged

bolinfest merged 1 commit into
mainfrom
pr556

Conversation

@bolinfest

@bolinfest bolinfest commented Apr 22, 2025 •

Copy link
Copy Markdown
Collaborator

Previously, we were ignoring the workdir field in an ExecInput when running it through canAutoApprove(). For ordinary exec() calls, that was sufficient, but for apply_patch, we need the workdir to resolve relative paths in the apply_patch argument so that we can check them in isPathConstrainedTowritablePaths().

Likewise, we also need the workdir when running execApplyPatch() because the paths need to be resolved again.

Ideally, the ApplyPatchCommand returned by canAutoApprove() would not be a simple patch: string, but the parsed patch with all of the paths resolved, in which case execApplyPatch() could expect absolute paths and would not need workdir.

@bolinfest
bolinfest deleted the pr556 branch April 22, 2025 21:07
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 22, 2025
@tibo-openai tibo-openai changed the title when a shell tool call invokes apply_patch, resolve relative paths against workdir, if specified fix: when a shell tool call invokes apply_patch, resolve relative paths against workdir, if specified Apr 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants