[codex] Support multiple forced ChatGPT workspaces#18161
Merged
Conversation
rreichel3-oai
added a commit
that referenced
this pull request
Apr 16, 2026
rreichel3-oai
added a commit
that referenced
this pull request
Apr 16, 2026
rreichel3-oai
added a commit
that referenced
this pull request
Apr 16, 2026
6efb453 to
8b4867b
Compare
rreichel3-oai
added a commit
that referenced
this pull request
Apr 16, 2026
rreichel3-oai
added a commit
that referenced
this pull request
Apr 21, 2026
rreichel3-oai
added a commit
that referenced
this pull request
Apr 21, 2026
9545da1 to
d189b55
Compare
rreichel3-oai
added a commit
that referenced
this pull request
Apr 22, 2026
rreichel3-oai
added a commit
that referenced
this pull request
Apr 22, 2026
de2e639 to
fd71d7c
Compare
rreichel3-oai
added a commit
that referenced
this pull request
Apr 22, 2026
rreichel3-oai
added a commit
that referenced
this pull request
Apr 22, 2026
fd71d7c to
e12d9db
Compare
rreichel3-oai
added a commit
that referenced
this pull request
May 4, 2026
rreichel3-oai
added a commit
that referenced
this pull request
May 4, 2026
e12d9db to
7c19791
Compare
rreichel3-oai
added a commit
that referenced
this pull request
May 4, 2026
rreichel3-oai
added a commit
that referenced
this pull request
May 4, 2026
5ae4cef to
a2d466d
Compare
rreichel3-oai
added a commit
that referenced
this pull request
May 6, 2026
a2d466d to
12f6b43
Compare
rreichel3-oai
added a commit
that referenced
this pull request
May 6, 2026
rreichel3-oai
added a commit
that referenced
this pull request
May 6, 2026
rreichel3-oai
added a commit
that referenced
this pull request
May 6, 2026
cd69a02 to
949782b
Compare
rreichel3-oai
added a commit
that referenced
this pull request
May 8, 2026
rreichel3-oai
added a commit
that referenced
this pull request
May 8, 2026
Collaborator
|
codex flagged this, mind taking a look? the rest looks good! nice catch on the agent identity thing
|
owenlin0
approved these changes
May 12, 2026
codex-rs/core/src/config/mod.rs: honor a debug-only CODEX_DISABLE_MANAGED_CONFIG env var in the main config loader so local interactive testing can ignore managed config and managed preferences outside app-server flows.
codex-rs/config/src/config_toml.rs: restore the backward-compatible ForcedChatgptWorkspaceIds enum that the rebased branch still references when parsing forced_chatgpt_workspace_id.
codex-rs/login/src/auth/auth_tests.rs: drop a stale auth-manager watcher test that no longer matches the main-branch API. codex-rs/login/tests/suite/device_code_login.rs: pass the current ServerOptions::new streamlined-login argument.
codex-rs/login/tests/suite/login_server_e2e.rs: pass the current ServerOptions::new streamlined-login argument in the fallback-port test.
codex-rs/login/tests/suite/device_code_login.rs: keep ServerOptions::new aligned with the current four-argument constructor.
codex-rs/login/tests/suite/login_server_e2e.rs: add the streamlined-login field to the multi-workspace server options literal and remove a stale extra constructor argument.
codex-rs/login/src/server.rs: join forced ChatGPT workspace IDs into one comma-separated allowed_workspace_id query parameter for authapi compatibility. codex-rs/login/tests/suite/login_server_e2e.rs: update the multi-workspace login-server regression test to assert exactly one allowed_workspace_id value.
codex-rs/config/src/config_toml.rs: add a custom forced_chatgpt_workspace_id deserializer that keeps single-string and list forms but rejects comma-separated strings with guidance to use a TOML list, plus focused parser tests. codex-rs/core/config.schema.json: refresh the generated config schema description for the workspace allowlist shape.
Add app-server coverage for ChatGPT login URLs when config contains multiple forced workspaces. Assert the interactive account/login/start response carries one comma-separated allowed_workspace_id query parameter, matching authapi's allowlist contract.
sdk/python/src/openai_codex/generated/v2_all.py: regenerate the v2 app-server client model after rebasing so forced_chatgpt_workspace_id matches the current schema.
Update enforced ChatGPT workspace checks so AgentIdentity credentials are compared against the configured workspace allowlist instead of skipping workspace enforcement. Add a regression test for AgentIdentity credentials that belong to a disallowed workspace and verify the auth file is removed.
Normalize legacy single-string forced_chatgpt_workspace_id values before converting ConfigToml into the app-server v2 Config response. Add config/read coverage for existing configs that still use the legacy single workspace string shape.
Update workspace allowlist and ChatGPT account test fixtures to use UUID-shaped IDs instead of org/ws/acct placeholders. Refresh config TOML examples and app-server/login assertions to match the same ID shape.
Keep the PR rebased on current main without carrying the removed commit_attribution field from the old merge side of the conflict.
e2503f3 to
d14a17b
Compare
Allow app-server config payloads to represent forced ChatGPT workspace IDs as either a single string or a string list. Preserve legacy config/read string responses while accepting list configs, refresh generated app-server schemas, and cover both config shapes in tests.
Add runtime config coverage showing unset, empty string, whitespace string, empty list, and blank-only lists disable forced workspace restriction, while mixed lists keep trimmed valid workspace IDs.
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.
Summary
This change lets
forced_chatgpt_workspace_idaccept multiple workspace IDs instead of a single value.It keeps the existing config key name, adds backward-compatible parsing for a single string in
config.toml, and normalizes the setting into an allowed workspace list across login enforcement, app-server config surfaces, and local ChatGPT auth helpers.Why
Workspace-restricted deployments may need to allow more than one ChatGPT workspace without dropping the guardrail entirely.
Server-side impact
Codex's local server and app-server protocol needed changes because they previously assumed a single workspace ID. The local login flow now matches the auth backend interface by sending the allowed workspace list as a single comma-separated
allowed_workspace_idquery parameter.Validation
This was tested with:
All were successful.
Automated coverage:
cargo test -p codex-logincargo test -p codex-app-server-protocolcargo test -p codex-tui local_chatgpt_authcargo test --locked -p codex-app-server login_account_chatgpt_includes_forced_workspace_allowlist_query_param