Skip to content

Support multi-environment apply_patch selection#21617

Merged
starr-openai merged 13 commits into
mainfrom
starr/apply-patch-consolidated-20260507
May 11, 2026
Merged

Support multi-environment apply_patch selection#21617
starr-openai merged 13 commits into
mainfrom
starr/apply-patch-consolidated-20260507

Conversation

@starr-openai

Copy link
Copy Markdown
Contributor

Summary

  • add multi-environment apply_patch routing for both freeform and function-call tool flows
  • parse and reconcile the optional environment selector in the main apply_patch parser, then verify against the selected environment in the handler
  • carry environment_id through runtime and approval surfaces so remote-targeted patches stay explicit end to end

Testing

  • just fmt
  • remote exec-server e2e: cargo test -p codex-core --test all apply_patch_multi_environment_uses_remote_executor -- --nocapture on dev via scripts/test-remote-env.sh

@starr-openai starr-openai requested a review from a team as a code owner May 7, 2026 23:43
@starr-openai starr-openai force-pushed the starr/apply-patch-consolidated-20260507 branch 7 times, most recently from 7def473 to 9698ddc Compare May 8, 2026 00:29
Comment thread codex-rs/app-server-protocol/src/protocol/thread_history.rs Outdated
Comment thread codex-rs/apply-patch/src/parser.rs
Comment thread codex-rs/apply-patch/src/streaming_parser.rs Outdated
Comment thread codex-rs/core/src/tools/handlers/apply_patch_spec.rs Outdated
Comment thread codex-rs/core/src/tools/handlers/apply_patch.rs Outdated
Comment thread codex-rs/core/src/tools/handlers/apply_patch.rs Outdated
Comment thread codex-rs/core/src/tools/handlers/apply_patch.rs Outdated
Comment thread codex-rs/core/src/tools/handlers/apply_patch.rs Outdated
Comment thread codex-rs/core/src/tools/handlers/apply_patch.rs
Comment thread codex-rs/core/src/tools/handlers/apply_patch.rs Outdated
@starr-openai starr-openai force-pushed the starr/apply-patch-consolidated-20260507 branch 8 times, most recently from a885774 to 0267198 Compare May 8, 2026 21:12
Comment thread codex-rs/apply-patch/src/invocation.rs Outdated
Comment thread codex-rs/mcp-server/tests/suite/codex_tool.rs
Comment thread codex-rs/core/src/tools/handlers/apply_patch_tests.rs Outdated

@pakrym-oai pakrym-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

starr-openai added a commit that referenced this pull request May 11, 2026
Co-authored-by: Codex <noreply@openai.com>
starr-openai added a commit that referenced this pull request May 11, 2026
Co-authored-by: Codex <noreply@openai.com>
starr-openai added a commit that referenced this pull request May 11, 2026
Co-authored-by: Codex <noreply@openai.com>
@starr-openai starr-openai force-pushed the starr/apply-patch-consolidated-20260507 branch from 19c6dd1 to b8f059a Compare May 11, 2026 22:11
starr-openai and others added 12 commits May 11, 2026 15:12
Co-authored-by: Codex <noreply@openai.com>
Move environment id extraction into the apply-patch parser and verify parsed freeform tool input without reparsing. Always pass the selected-cwd filesystem sandbox context into apply_patch verification so local preflight reads follow the same sandbox path as remote reads.

Co-authored-by: Codex <noreply@openai.com>
Let multi-environment apply_patch calls without an explicit environment_id fall through to the primary turn environment, matching the optional parser contract and existing resolve_tool_environment(None) behavior.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@starr-openai starr-openai force-pushed the starr/apply-patch-consolidated-20260507 branch from b8f059a to fd9c1f6 Compare May 11, 2026 22:13
Co-authored-by: Codex <noreply@openai.com>
@starr-openai starr-openai merged commit 22e84c4 into main May 11, 2026
27 checks passed
@starr-openai starr-openai deleted the starr/apply-patch-consolidated-20260507 branch May 11, 2026 23:33
@github-actions github-actions Bot locked and limited conversation to collaborators May 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants