mirror of
https://github.com/openai/codex.git
synced 2026-09-08 15:50:34 +00:00
Use parsed apply_patch cwd for shell intercepts
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -402,12 +402,18 @@ impl ToolHandler for ApplyPatchHandler {
|
||||
.await
|
||||
{
|
||||
codex_apply_patch::MaybeApplyPatchVerified::Body(changes) => {
|
||||
let action_cwd = changes.cwd.clone();
|
||||
let (file_paths, effective_additional_permissions, file_system_sandbox_policy) =
|
||||
effective_patch_permissions(session.as_ref(), turn.as_ref(), &cwd, &changes)
|
||||
.await;
|
||||
effective_patch_permissions(
|
||||
session.as_ref(),
|
||||
turn.as_ref(),
|
||||
&action_cwd,
|
||||
&changes,
|
||||
)
|
||||
.await;
|
||||
match apply_patch::apply_patch(
|
||||
turn.as_ref(),
|
||||
&cwd,
|
||||
&action_cwd,
|
||||
&file_system_sandbox_policy,
|
||||
changes,
|
||||
)
|
||||
@@ -432,7 +438,7 @@ impl ToolHandler for ApplyPatchHandler {
|
||||
let req = ApplyPatchRequest {
|
||||
environment_id: tool_environment.environment_id.clone(),
|
||||
environment: tool_environment.environment,
|
||||
cwd,
|
||||
cwd: action_cwd,
|
||||
action: apply.action,
|
||||
file_paths,
|
||||
changes,
|
||||
@@ -514,6 +520,7 @@ pub(crate) async fn intercept_apply_patch(
|
||||
.await
|
||||
{
|
||||
codex_apply_patch::MaybeApplyPatchVerified::Body(changes) => {
|
||||
let action_cwd = changes.cwd.clone();
|
||||
session
|
||||
.record_model_warning(
|
||||
format!(
|
||||
@@ -523,9 +530,15 @@ pub(crate) async fn intercept_apply_patch(
|
||||
)
|
||||
.await;
|
||||
let (approval_keys, effective_additional_permissions, file_system_sandbox_policy) =
|
||||
effective_patch_permissions(session.as_ref(), turn.as_ref(), cwd, &changes).await;
|
||||
match apply_patch::apply_patch(turn.as_ref(), cwd, &file_system_sandbox_policy, changes)
|
||||
.await
|
||||
effective_patch_permissions(session.as_ref(), turn.as_ref(), &action_cwd, &changes)
|
||||
.await;
|
||||
match apply_patch::apply_patch(
|
||||
turn.as_ref(),
|
||||
&action_cwd,
|
||||
&file_system_sandbox_policy,
|
||||
changes,
|
||||
)
|
||||
.await
|
||||
{
|
||||
InternalApplyPatchInvocation::Output(item) => {
|
||||
let content = item?;
|
||||
@@ -554,7 +567,7 @@ pub(crate) async fn intercept_apply_patch(
|
||||
"apply_patch is unavailable in this session".to_string(),
|
||||
)
|
||||
})?,
|
||||
cwd: cwd.clone(),
|
||||
cwd: action_cwd,
|
||||
action: apply.action,
|
||||
file_paths: approval_keys,
|
||||
changes,
|
||||
|
||||
Reference in New Issue
Block a user