Make environment providers own default selection#20665
Merged
Merged
Conversation
This was referenced May 1, 2026
d2b7397 to
7eff29b
Compare
225bb6b to
ae52105
Compare
773f789 to
387ab7a
Compare
3ae465a to
d7095cf
Compare
387ab7a to
3fe0b35
Compare
d7095cf to
a38f8e5
Compare
f12eaed to
56ada0d
Compare
4e89a77 to
0781da0
Compare
56ada0d to
abde0bf
Compare
0781da0 to
1a11c8b
Compare
abde0bf to
e0ff30e
Compare
1a11c8b to
751ed42
Compare
4682df9 to
313c1ad
Compare
starr-openai
added a commit
that referenced
this pull request
May 4, 2026
## Why This stack adds configured exec-server environments, including environments reached over stdio. Before client-side stdio transports or config can use that path, the exec-server binary itself needs a first-class stdio listen mode so it can speak the same JSON-RPC protocol over stdin/stdout that it already speaks over websockets. **Stack position:** this is PR 1 of 5. It is the server-side transport foundation for the stack. ## What Changed - Accept `stdio` and `stdio://` for `codex exec-server --listen`. - Promote the existing stdio `JsonRpcConnection` helper from test-only code into normal exec-server transport code. - Add parse coverage for stdio listen URLs while preserving the existing websocket default. ## Stack - **1. This PR:** #20663 - Add stdio exec-server listener - 2. #20664 - Add stdio exec-server client transport - 3. #20665 - Make environment providers own default selection - 4. #20666 - Add CODEX_HOME environments TOML provider - 5. #20667 - Load configured environments from CODEX_HOME Split from original draft: #20508 ## Validation Not run locally; this was split out of the original draft stack. --------- Co-authored-by: Codex <noreply@openai.com>
3d9bb84 to
4c6d799
Compare
20d01c6 to
c0e9b77
Compare
7bc1d8f to
309db97
Compare
6b1d4ee to
2a16b0e
Compare
abb8b00 to
26bf42b
Compare
70fbecf to
2a1200e
Compare
59776b1 to
bc0677d
Compare
f023486 to
9f125d2
Compare
bc0677d to
7cb55d2
Compare
Oreoxp
pushed a commit
to Oreoxp/codex-cli
that referenced
this pull request
May 7, 2026
## Why This stack adds configured exec-server environments, including environments reached over stdio. Before client-side stdio transports or config can use that path, the exec-server binary itself needs a first-class stdio listen mode so it can speak the same JSON-RPC protocol over stdin/stdout that it already speaks over websockets. **Stack position:** this is PR 1 of 5. It is the server-side transport foundation for the stack. ## What Changed - Accept `stdio` and `stdio://` for `codex exec-server --listen`. - Promote the existing stdio `JsonRpcConnection` helper from test-only code into normal exec-server transport code. - Add parse coverage for stdio listen URLs while preserving the existing websocket default. ## Stack - **1. This PR:** openai#20663 - Add stdio exec-server listener - 2. openai#20664 - Add stdio exec-server client transport - 3. openai#20665 - Make environment providers own default selection - 4. openai#20666 - Add CODEX_HOME environments TOML provider - 5. openai#20667 - Load configured environments from CODEX_HOME Split from original draft: openai#20508 ## Validation Not run locally; this was split out of the original draft stack. --------- Co-authored-by: Codex <noreply@openai.com>
ca24653 to
dc926a5
Compare
starr-openai
added a commit
that referenced
this pull request
May 7, 2026
## Why Configured environments need to connect to exec-server instances that are not necessarily already listening on a websocket URL. A command-backed stdio transport lets Codex start an exec-server process, speak JSON-RPC over its stdio streams, and clean up that child process with the client lifetime. **Stack position:** this is PR 2 of 5. It builds on the server-side stdio listener from PR 1 and provides the client transport used by later environment/config PRs. ## What Changed - Add `ExecServerTransport` variants for websocket URLs and stdio shell commands. - Add stdio command connection support for `ExecServerClient`. - Move websocket/stdio transport setup into `client_transport.rs` so `client.rs` stays focused on shared JSON-RPC client, session, HTTP, and notification behavior. - Tie stdio child process cleanup to the JSON-RPC connection lifetime with a RAII lifetime guard. - Keep existing websocket environment behavior by adapting URL-backed remotes to `ExecServerTransport::WebSocketUrl`. ## Stack - 1. #20663 - Add stdio exec-server listener - **2. This PR:** #20664 - Add stdio exec-server client transport - 3. #20665 - Make environment providers own default selection - 4. #20666 - Add CODEX_HOME environments TOML provider - 5. #20667 - Load configured environments from CODEX_HOME Split from original draft: #20508 ## Validation Not run locally; this was split out of the original draft stack and then refactored to separate transport setup from the base client. --------- Co-authored-by: Codex <noreply@openai.com>
Let environment providers return an explicit default selection and let remote environments track the underlying transport instead of treating only websocket URLs as remote. This prepares the environment layer for stdio-backed remotes without introducing config-file loading. Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Have providers return a concrete default environment id after constructing their environment map, using None to disable the default. This removes the DefaultEnvironmentSelection tri-state while preserving legacy derived defaults through the trait's default implementation. Co-authored-by: Codex <noreply@openai.com>
Make environment providers return the environment map and default id together. This keeps provider-owned startup state in one boundary and removes the separate default callback over a map. Co-authored-by: Codex <noreply@openai.com>
Remove the EnvironmentProviderSnapshot wrapper. Providers now expose environments and the selected default id directly, while EnvironmentManager validates that the default id exists in the returned environment map. Co-authored-by: Codex <noreply@openai.com>
Remove the private from_provider_parts helper. EnvironmentManager::from_provider now performs the provider read, validation, and manager construction directly, and tests use a small provider implementation instead of bypassing that path. Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Keep EnvironmentManager construction async to preserve caller behavior while moving provider-owned default selection into a single snapshot object. Co-authored-by: Codex <noreply@openai.com>
dc926a5 to
01f47ba
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The next PR in this stack introduces configured environments, where the provider knows both which environments exist and which one should be selected by default. The existing manager derived the default internally by checking for the legacy
remoteandlocalids, and it treated "remote" as equivalent to "has a websocket URL." That does not work cleanly for stdio-command remotes because they are remote environments without anexec_server_url.Stack position: this is PR 3 of 5. It is the environment-model bridge between PR 2's transport enum and PR 4's TOML provider.
What Changed
DefaultEnvironmentSelectionto theEnvironmentProvidercontract:Derivedpreserves the oldremote-then-localfallback behavior.Environment(id)lets a provider explicitly select a configured default.Disabledlets a provider intentionally expose no default environment.CODEX_EXEC_SERVER_URL=nonedefault-disabling behavior intoDefaultEnvironmentProvider.EnvironmentManagervalidate explicit provider defaults and return an error if the selected id is missing.remote_transportseparately fromexec_server_urlso stdio-command environments are still recognized as remote.Environment::remote_stdio_shell_command(...)for the TOML provider added in the next PR.Stack
Split from original draft: #20508
Validation
Not run locally; this was split out of the original draft stack.