Skip to content

Pair thread environment settings#26687

Merged
pakrym-oai merged 20 commits into
mainfrom
pakrym/full-ci-thread-environment-settings
Jun 8, 2026
Merged

Pair thread environment settings#26687
pakrym-oai merged 20 commits into
mainfrom
pakrym/full-ci-thread-environment-settings

Conversation

@pakrym-oai

Copy link
Copy Markdown
Collaborator

Why

Thread cwd and environment selections are a single logical setting in core: updating one without the other can silently desynchronize the next-turn execution context. This change makes that relationship explicit in the internal thread settings flow while preserving the existing app-server public API shape.

What changed

  • Moved the cwd/environment pair through internal ThreadSettingsOverrides.environment_settings instead of a top-level internal cwd field.
  • Kept thread/settings/update public params unchanged, with app-server translating top-level cwd into the paired internal settings shape.
  • Moved Op::UserInput environment overrides into thread settings so user turns and settings updates use the same core path.
  • Updated core, app-server, MCP, memories, sample, and test callsites to construct the paired settings shape.

Verification

  • git diff --check
  • Local test run starting after PR creation.

}

#[test]
fn thread_settings_update_params_round_trip_cwd() {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

delete

This comment was marked as spam.

This comment was marked as spam.

pakrym-oai added 10 commits June 5, 2026 15:28
…-environment-settings

# Conflicts:
#	codex-rs/app-server/src/request_processors/thread_lifecycle.rs
#	codex-rs/app-server/src/request_processors/thread_processor.rs
#	codex-rs/app-server/src/request_processors/turn_processor.rs
#	codex-rs/core/src/session/tests.rs
…-environment-settings

# Conflicts:
#	codex-rs/protocol/src/protocol.rs
@pakrym-oai pakrym-oai marked this pull request as ready for review June 6, 2026 02:27
@pakrym-oai pakrym-oai requested a review from a team as a code owner June 6, 2026 02:27

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fc6f77e19b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/app-server/src/request_processors/turn_processor.rs Outdated

@anp-oai anp-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.

LGTM, a couple of non-blocking API questions that would be IMO fine to address as follow-ups if they're worth it.

/// Updated `cwd` for sandbox/tool calls.
pub cwd: Option<AbsolutePathBuf>,
/// Updated fallback `cwd` and environments supplied together as a complete pair.
pub environments: Option<TurnEnvironmentSelections>,

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.

Are there any cases where would want to have an environment here but not a cwd, i.e. have non-optional TurnEnvironmentSelections and a cwd: Option<AbsolutePathBuf> field in the struct?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'd like to reduce how many combinations of option can be passed. cwd is related to local env so I'd rather everything was passed at once.

async fn build_environment_override(
thread: &CodexThread,
cwd: Option<AbsolutePathBuf>,
environment_selections: Option<Vec<TurnEnvironmentSelection>>,

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.

nit: if there's a meaningful difference between passing a None for environment_selections and passing an empty vector would be good to leave a comment, if there's no real difference maybe just pass an empty vec here when callers don't have any environments?

@pakrym-oai pakrym-oai merged commit f3c1283 into main Jun 8, 2026
61 of 78 checks passed
@pakrym-oai pakrym-oai deleted the pakrym/full-ci-thread-environment-settings branch June 8, 2026 20:55
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 8, 2026
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.

3 participants