Skip to content

Make environment providers own default selection#20665

Draft
starr-openai wants to merge 7 commits intostarr/exec-env-stdio-stack-2-clientfrom
starr/exec-env-stdio-stack-3-env-model
Draft

Make environment providers own default selection#20665
starr-openai wants to merge 7 commits intostarr/exec-env-stdio-stack-2-clientfrom
starr/exec-env-stdio-stack-3-env-model

Conversation

@starr-openai
Copy link
Copy Markdown
Contributor

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

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 remote and local ids, 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 an exec_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

  • Add DefaultEnvironmentSelection to the EnvironmentProvider contract:
    • Derived preserves the old remote-then-local fallback behavior.
    • Environment(id) lets a provider explicitly select a configured default.
    • Disabled lets a provider intentionally expose no default environment.
  • Move the legacy CODEX_EXEC_SERVER_URL=none default-disabling behavior into DefaultEnvironmentProvider.
  • Make EnvironmentManager validate explicit provider defaults and return an error if the selected id is missing.
  • Track remote_transport separately from exec_server_url so stdio-command environments are still recognized as remote.
  • Add 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.

@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-3-env-model branch from d2b7397 to 7eff29b Compare May 1, 2026 19:19
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-2-client branch 2 times, most recently from 225bb6b to ae52105 Compare May 1, 2026 19:37
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-3-env-model branch 2 times, most recently from 773f789 to 387ab7a Compare May 1, 2026 19:54
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-2-client branch from 3ae465a to d7095cf Compare May 1, 2026 20:00
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-3-env-model branch from 387ab7a to 3fe0b35 Compare May 1, 2026 20:00
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-2-client branch from d7095cf to a38f8e5 Compare May 1, 2026 20:34
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-3-env-model branch 2 times, most recently from f12eaed to 56ada0d Compare May 1, 2026 20:39
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-2-client branch from 4e89a77 to 0781da0 Compare May 1, 2026 20:42
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-3-env-model branch from 56ada0d to abde0bf Compare May 1, 2026 20:43
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-2-client branch from 0781da0 to 1a11c8b Compare May 1, 2026 20:59
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-3-env-model branch from abde0bf to e0ff30e Compare May 1, 2026 21:02
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-2-client branch from 1a11c8b to 751ed42 Compare May 1, 2026 22:02
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-3-env-model branch 2 times, most recently from 4682df9 to 313c1ad Compare May 4, 2026 18:11
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>
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-2-client branch from 3d9bb84 to 4c6d799 Compare May 4, 2026 18:41
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-3-env-model branch 2 times, most recently from 20d01c6 to c0e9b77 Compare May 4, 2026 19:04
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-2-client branch from 7bc1d8f to 309db97 Compare May 4, 2026 19:17
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-3-env-model branch from c0e9b77 to 863fffc Compare May 4, 2026 19:18
starr-openai and others added 2 commits May 4, 2026 12:52
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>
starr-openai and others added 3 commits May 4, 2026 12:52
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>
@starr-openai starr-openai force-pushed the starr/exec-env-stdio-stack-3-env-model branch from 6b1d4ee to 2a16b0e Compare May 4, 2026 19:52
starr-openai and others added 2 commits May 4, 2026 13:03
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant