Skip to content

Load named environments from config#18898

Draft
starr-openai wants to merge 31 commits intomainfrom
starr/sticky-env-split-2-config-toml
Draft

Load named environments from config#18898
starr-openai wants to merge 31 commits intomainfrom
starr/sticky-env-split-2-config-toml

Conversation

@starr-openai
Copy link
Copy Markdown
Contributor

@starr-openai starr-openai commented Apr 21, 2026

Summary

  • parse named environment definitions from config.toml
  • convert configured environments into EnvironmentManager setup
  • wire app-server, CLI, MCP, and TUI startup through configured environment manager creation

Stack

  1. Add sticky environment API and thread state #18897: API and thread persistence
  2. This PR: config.toml named environment loading
  3. Wire selected environments into tools #18899: downstream tool/runtime consumers

Validation

  • Not run locally; split only.

starr-openai and others added 29 commits April 21, 2026 10:31
Refactor EnvironmentManager to own a keyed environment registry with explicit default and local lookups. Keep remote exec-server connections lazy at environment use sites and preserve disabled agent environment access separately from internal local environment access.

Co-authored-by: Codex <noreply@openai.com>
Use EnvironmentManager::new for args-struct construction and keep from_env methods as the env-var factory entrypoints.

Co-authored-by: Codex <noreply@openai.com>
Return concrete default and local environments from EnvironmentManager now that the manager always installs local and default entries. Keep arbitrary ID lookup optional.

Co-authored-by: Codex <noreply@openai.com>
Keep the lazy remote exec-server client wrapper alongside ExecServerClient and import it from the client module for environment-backed exec and filesystem use.

Co-authored-by: Codex <noreply@openai.com>
Use EnvironmentManager::new with EnvironmentManagerArgs for runtime-path-aware construction and keep from_env only for the no-args env-var factory.

Co-authored-by: Codex <noreply@openai.com>
Add high-level EnvironmentManager docs for local/remote initialization, default environment selection, disabled agent access, and lazy remote connection behavior.

Co-authored-by: Codex <noreply@openai.com>
Drop the unused local_environment helper and keep local lookups on the generic get_environment API.

Co-authored-by: Codex <noreply@openai.com>
Clarify that SessionServices carries an Arc handle to the process-level EnvironmentManager rather than owning a session-specific manager.

Co-authored-by: Codex <noreply@openai.com>
Restore CODEX_EXEC_SERVER_URL=none semantics by making EnvironmentManager::default_environment return None when environment access is disabled. Remove the separate disabled-for-agent flag and derive tool availability from the optional default environment.

Add an end-to-end tool exposure test for CODEX_EXEC_SERVER_URL=none.

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>
Create one lazy exec-server client per remote environment and pass clones into the remote process and filesystem backends. This keeps ExecServerClient as the connected-client type while avoiding duplicate websocket clients for one environment.

Co-authored-by: Codex <noreply@openai.com>
Make EnvironmentManagerArgs::default() own CODEX_EXEC_SERVER_URL parsing so production entrypoints can keep using EnvironmentManager::new with struct update syntax for runtime paths. Add explicit test defaults so test managers do not depend on the process environment.

Co-authored-by: Codex <noreply@openai.com>
Drop the networked integration test for CODEX_EXEC_SERVER_URL=none omitting environment-backed tools. Lower-level coverage already verifies disabled environments omit those tools.

Co-authored-by: Codex <noreply@openai.com>
Make EnvironmentManagerArgs carry ExecServerRuntimePaths for production construction and route test-only unsandboxed setup through explicit _for_tests helpers. Use the manager local environment for MCP and app-server filesystem fallbacks instead of constructing a fresh default environment.

Co-authored-by: Codex <noreply@openai.com>
Remove the app-server-client re-export now that environment-manager construction owns CODEX_EXEC_SERVER_URL reading directly in exec-server.

Co-authored-by: Codex <noreply@openai.com>
Add a connector loading helper that accepts the existing EnvironmentManager and switch app-server paths to use it. Keep the config-only helper as a temporary fallback for callers such as TUI that do not yet pass the manager through.

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>
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>
Allow thread/start to configure sticky environment selections that are used by turns when no per-turn override is supplied. Per-turn environments continue to take precedence, while omitted thread selections preserve the existing default behavior.

Co-authored-by: Codex <noreply@openai.com>
Cover sticky thread environment selections and turn-level overrides through the app-server v2 thread/start and turn/start JSON-RPC flow. The matrix mirrors the manual smoke cases for omitted, empty, local, remote, and local plus remote selections.

Co-authored-by: Codex <noreply@openai.com>
Group thread-start options for lint-friendly callsites and update generated v2 schema for sticky environment selections.

Co-authored-by: Codex <noreply@openai.com>
@starr-openai starr-openai force-pushed the starr/sticky-env-split-1-api-thread branch from c3f1adb to 6edcdf2 Compare April 21, 2026 23:58
@starr-openai starr-openai force-pushed the starr/sticky-env-split-2-config-toml branch from c66a268 to c7533c1 Compare April 22, 2026 00:05
@starr-openai starr-openai force-pushed the starr/sticky-env-split-1-api-thread branch from 6edcdf2 to e04ef64 Compare April 22, 2026 00:05
@starr-openai starr-openai force-pushed the starr/sticky-env-split-2-config-toml branch from c7533c1 to 3539ef2 Compare April 22, 2026 00:08
@starr-openai starr-openai force-pushed the starr/sticky-env-split-1-api-thread branch from e04ef64 to 6edcdf2 Compare April 22, 2026 00:08
Introduce a small EnvironmentProvider interface that discovers remote environment specs while EnvironmentManager owns validation and concrete runtime Environment caching. Wire env-var, static config.toml, and HTTP-backed provider setup through the same manager construction path.

Co-authored-by: Codex <noreply@openai.com>
@starr-openai starr-openai force-pushed the starr/sticky-env-split-2-config-toml branch from 3539ef2 to 16587a7 Compare April 22, 2026 00:36
@starr-openai starr-openai force-pushed the starr/sticky-env-split-1-api-thread branch 12 times, most recently from a5e0d6c to 23ff063 Compare April 23, 2026 01:05
@starr-openai starr-openai force-pushed the starr/sticky-env-split-1-api-thread branch 8 times, most recently from ce102d0 to a1ec341 Compare April 23, 2026 18:27
starr-openai added a commit that referenced this pull request Apr 24, 2026
## Summary
- add sticky environment selections to app-server v2 thread/start and
turn/start request flow
- carry thread-level selections through core session/thread state
- add app-server coverage for sticky selections and turn overrides

## Stack
1. This PR: API and thread persistence
2. #18898: config.toml named environment loading
3. #18899: downstream tool/runtime consumers

## Validation
- Not run locally; split only.

---------

Co-authored-by: Codex <noreply@openai.com>
Base automatically changed from starr/sticky-env-split-1-api-thread to main April 24, 2026 01:57
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