Load configured environments from CODEX_HOME#20667
Merged
starr-openai merged 13 commits intoMay 8, 2026
Merged
Conversation
This was referenced May 1, 2026
2106226 to
50c4f0d
Compare
a001a32 to
44a2edb
Compare
50c4f0d to
0314e55
Compare
44a2edb to
5a13714
Compare
0314e55 to
d3e9d10
Compare
7bbc2e1 to
f8af4b1
Compare
4fef0c4 to
40ebd87
Compare
f8af4b1 to
67be044
Compare
40ebd87 to
8be2149
Compare
67be044 to
9671f2b
Compare
18bb387 to
16a67b4
Compare
9671f2b to
0fa5fe2
Compare
16a67b4 to
4ba0ef0
Compare
0fa5fe2 to
9920728
Compare
4ba0ef0 to
8898b25
Compare
9920728 to
64848b2
Compare
8898b25 to
2fb7e79
Compare
64848b2 to
57e8885
Compare
2fb7e79 to
0eeddca
Compare
57e8885 to
8ea31ab
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>
0eeddca to
a99c2c7
Compare
f04a72c to
8565584
Compare
1cfd592 to
14121ac
Compare
8565584 to
7a171e1
Compare
14121ac to
b4b2e71
Compare
7a171e1 to
ee9b735
Compare
b4b2e71 to
a5df0b7
Compare
ee9b735 to
3ac2f68
Compare
a0af7e4 to
7e08acf
Compare
a57ea34 to
2a2f9c7
Compare
7e08acf to
7d8d27a
Compare
2a2f9c7 to
dcdd3dd
Compare
This was referenced May 6, 2026
This was referenced May 8, 2026
Co-authored-by: Codex <noreply@openai.com>
Thread codex_home into EnvironmentManager construction so app entrypoints load environments.toml when present and continue falling back to the legacy CODEX_EXEC_SERVER_URL provider otherwise. Co-authored-by: Codex <noreply@openai.com>
Pass the app-owned EnvironmentManager into ChatWidget so connector prefetch uses the same environment selection that the session was initialized with, instead of reconstructing it from config. Co-authored-by: Codex <noreply@openai.com>
Keep the direct ChatWidget test constructor aligned with the production initializer after wiring the active environment manager through the TUI. Co-authored-by: Codex <noreply@openai.com>
Apply the rustfmt indentation reported by the PR20667 Format / etc CI job after the stack rebase. Co-authored-by: Codex <noreply@openai.com>
Preserve provider environment order and derive startup selections from the configured default plus remaining environments. This lets multi-environment CODEX_HOME setups attach every configured environment by default while keeping the default first as primary. Co-authored-by: Codex <noreply@openai.com>
Exercise a non-local configured default so the test proves default-first ordering rather than relying on the implicit local environment already being first. Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Keep the app-server ignore-user-config path compiling after rebasing onto the merged TOML-provider stack. Co-authored-by: Codex <noreply@openai.com>
Drop the stale await from the configured-environments startup regression now that the test helper returns ThreadManager synchronously on current main. Co-authored-by: Codex <noreply@openai.com>
Derive initial thread environments from the default environment and the available environment map instead of storing a separate startup selection list. This also removes the provider snapshot boolean that distinguished legacy and TOML startup policies. Co-authored-by: Codex <noreply@openai.com>
Remove a test-only call to a non-existent CodexThread helper. The test still verifies startup environment ordering through the manager defaults and generated environment context. Co-authored-by: Codex <noreply@openai.com>
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 earlier PRs add stdio transport support and the config-backed environment provider, but the feature remains inert until normal Codex entrypoints construct
EnvironmentManagerwith enough context to discoverCODEX_HOME/environments.toml. This final stack PR activates the provider while preserving the legacyCODEX_EXEC_SERVER_URLfallback when no environments file exists.Stack position: this is PR 5 of 5. It is the product wiring PR that activates the configured environment provider added in PR 4.
What Changed
codex_homeintoEnvironmentManagerArgs.EnvironmentManager::new(...)to load the provider fromCODEX_HOME.DefaultEnvironmentProvider::from_env()whenenvironments.tomlis absent.environments.toml-backed managers start new threads with all configured environments, default first, while keeping the legacy env-var path single-default.codex_homeand handle provider-loading errors.Self-Review Notes
environments.tomlprovider. Using>1configured environment as the only signal would also expand the legacyCODEX_EXEC_SERVER_URLprovider because it keepslocaladdressable alongsideremote.EnvironmentManager; the provider only says whether its snapshot should start new threads with all configured environments.ThreadManager::new(...)installation id argument so the stack compiles under Bazel.Stack
Split from original draft: #20508
Validation
just fmtgit diff --checkbazel build --config=remote --strategy=remote --remote_download_toplevel //codex-rs/thread-manager-sample:codex-thread-manager-samplebazel test --config=remote --strategy=remote --remote_download_toplevel //codex-rs/exec-server:exec-server-unit-testsbazel test --config=remote --strategy=remote --remote_download_toplevel --test_sharding_strategy=disabled --test_arg=default_thread_environment_selections_use_manager_default_id //codex-rs/core:core-unit-testsbazel test --config=remote --strategy=remote --remote_download_toplevel --test_sharding_strategy=disabled --test_arg=start_thread_uses_all_default_environments_from_codex_home //codex-rs/core:core-unit-testsDocumentation
This activates
CODEX_HOME/environments.toml; user-facing documentation should be added before this stack is treated as a documented public workflow.