Skip to content

Surface multi-environment choices in environment context#20646

Merged
starr-openai merged 13 commits into
mainfrom
pr20314-envctx-on-pr20281
May 1, 2026
Merged

Surface multi-environment choices in environment context#20646
starr-openai merged 13 commits into
mainfrom
pr20314-envctx-on-pr20281

Conversation

@starr-openai
Copy link
Copy Markdown
Contributor

@starr-openai starr-openai commented May 1, 2026

Why

The model needs a way to see which environments are available during a multi-environment turn without changing the legacy single-environment prompt surface or pulling replay/persistence changes into the same review.

Stack

  1. Surface multi-environment choices in environment context #20646 - EnvironmentContext rendering for selected environments (this PR)
  2. Prepare selected environment plumbing #20669 - selected-environment ownership and tool config prep
  3. Route process tools to selected environments #20647 - process-tool environment_id routing

What Changed

  • extend environment_context so multi-environment turns render an <environments> block with the selected environment ids and cwd values
  • keep zero- and single-environment turns on the existing cwd-only render path
  • keep replay and persistence paths on the legacy surface for now so this PR stays scoped to live prompt rendering
  • add focused coverage in codex-rs/core/src/context/environment_context_tests.rs

Testing

  • CI
@starr-openai starr-openai marked this pull request as ready for review May 1, 2026 18:19
@starr-openai starr-openai requested a review from a team as a code owner May 1, 2026 18:19
starr-openai and others added 5 commits May 1, 2026 11:23
Render explicit environment choices in the live environment context for multi-environment turns, while keeping replay and persistence on the legacy cwd-only surface for now.

Co-authored-by: Codex <noreply@openai.com>
Inline the multi-environment render condition in EnvironmentContext and leave a short comment explaining why single-environment turns keep the legacy cwd-only surface.

Co-authored-by: Codex <noreply@openai.com>
Inline the model-facing environment initialization in from_turn_context so the multi-environment rendering path reads in one place.

Co-authored-by: Codex <noreply@openai.com>
Keep the environment context render focused on the explicit environment choices and cwd values without surfacing a separate default marker.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@starr-openai starr-openai force-pushed the pr20314-envctx-on-pr20281 branch from db43360 to 3acd99c Compare May 1, 2026 18:23
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct EnvironmentContextEnvironment {
pub(crate) id: String,
pub(crate) cwd: PathBuf,
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.

AbsolutePath?

Comment thread codex-rs/core/src/context/environment_context.rs Outdated
<cwd>/repo/remote</cwd>
</environment>
</environments>
<shell>bash</shell>
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.

probably should be nested in environment.

starr-openai and others added 4 commits May 1, 2026 11:35
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 and others added 2 commits May 1, 2026 13:24
Use platform-aware absolute test paths in the environment context tests so the Windows Bazel lane does not try to construct AbsolutePathBuf values from Unix-only /repo paths.

Co-authored-by: Codex <noreply@openai.com>
Update the prompt caching helper to assert the environment shell metadata rendered by EnvironmentContext instead of the platform default user shell.

Co-authored-by: Codex <noreply@openai.com>
@starr-openai starr-openai merged commit 2952beb into main May 1, 2026
25 checks passed
@starr-openai starr-openai deleted the pr20314-envctx-on-pr20281 branch May 1, 2026 22:11
@github-actions github-actions Bot locked and limited conversation to collaborators May 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants