Connect app-server workspace discovery to model request routing (#46281)

## Why

Model requests need the selected workspace's routing constraints before sending content. A missing cached route cannot establish that a custom ChatGPT-auth destination is independent of the workspace.

## What changed

- Register the account processor as the workspace routing resolver for Responses HTTP, compaction, and WebSockets, enabling origin selection and routing headers while preserving API paths and rejecting routed HTTP redirects.
- Share concurrent discovery by auth generation, workspace, and backend configuration. Recover from discovery-time `401` responses while allowing token refreshes for the same auth owner.
- Require successful discovery before classifying custom destinations as independent, and require a new thread when a workspace-bound session's bootstrap origin changes.
- Refresh managed requirements using retained session configuration without fetching thread configuration again. Return typed routing errors without account or backend details.

## Testing

Extend coverage for discovery-time token refresh, retained provider definitions under managed requirements, and specific invalid-routing error categories.

GitOrigin-RevId: 090cda70daa91ee8acfbc973699d028111e54125
This commit is contained in:
acrognale-oai authored and copyberry committed 2026-09-17 19:12:42 +00:00
1 parent d7f8e48d7d
commit 0a5b999169
21 files changed
+505 -200

No files matched your search

@@ -181,7 +181,13 @@ X-Managed = "required"
let rebuilt = Config::rebuild_with_session_layers(
&overridden.config_layer_stack,
overridden.cwd.to_path_buf(),
&overridden,
&overridden.config_layer_stack,
overridden.codex_home.clone(),
overridden
.zsh_path
.clone()
.map(codex_utils_absolute_path::AbsolutePathBuf::try_from)
.transpose()?,
)
.await?;
assert_eq!(rebuilt.model_provider, test.config.model_provider);
@@ -6,7 +6,7 @@ Scenario: Astra asks who a launch update is for, keeps working, and receives the
## Window 1
-- request 1 (request) --
00:additional_tools/developer (3; hash=d4f3e164a92d9bf1):
00:additional_tools/developer (3; hash=9e8e744a3a55a2dd):
- namespace/functions; hash=e7db0a45c4ec3157
- custom/exec
- function/wait
@@ -14,7 +14,7 @@ Scenario: Astra asks who a launch update is for, keeps working, and receives the
- function/request_user_input_async
- namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317
- function/sleep
- namespace/collaboration: Tools for spawning and managing sub-agents.; hash=43f195d9cc99ee15
- namespace/collaboration: Tools for spawning and managing sub-agents.; hash=91f6de0e2773854f
- function/followup_task
- function/interrupt_agent
- function/list_agents
@@ -16,7 +16,7 @@ Settings:
text: {"verbosity":"low"}
tool_choice: "auto"
-- request 1 (request) --
00:additional_tools/developer (3; hash=24819537059703a0):
00:additional_tools/developer (3; hash=d78b689d87e8c03e):
- namespace/functions; hash=97852c93915dad58
- custom/exec
- function/wait
@@ -24,7 +24,7 @@ Settings:
- function/request_user_input_async
- namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317
- function/sleep
- namespace/collaboration: Tools for spawning and managing sub-agents.; hash=43f195d9cc99ee15
- namespace/collaboration: Tools for spawning and managing sub-agents.; hash=91f6de0e2773854f
- function/followup_task
- function/interrupt_agent
- function/list_agents
@@ -16,7 +16,7 @@ Settings:
text: {"verbosity":"low"}
tool_choice: "auto"
-- request 1 (turn) --
00:additional_tools/developer (3; hash=d4f3e164a92d9bf1):
00:additional_tools/developer (3; hash=9e8e744a3a55a2dd):
- namespace/functions; hash=e7db0a45c4ec3157
- custom/exec
- function/wait
@@ -24,7 +24,7 @@ Settings:
- function/request_user_input_async
- namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317
- function/sleep
- namespace/collaboration: Tools for spawning and managing sub-agents.; hash=43f195d9cc99ee15
- namespace/collaboration: Tools for spawning and managing sub-agents.; hash=91f6de0e2773854f
- function/followup_task
- function/interrupt_agent
- function/list_agents
@@ -190,7 +190,7 @@ Settings:
## Window 2 (after request 3: input diverged at item 02)
Settings: same as window 1
-- request 4 (turn) --
00:additional_tools/developer (3; hash=d4f3e164a92d9bf1):
00:additional_tools/developer (3; hash=9e8e744a3a55a2dd):
- namespace/functions; hash=e7db0a45c4ec3157
- custom/exec
- function/wait
@@ -198,7 +198,7 @@ Settings: same as window 1
- function/request_user_input_async
- namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317
- function/sleep
- namespace/collaboration: Tools for spawning and managing sub-agents.; hash=43f195d9cc99ee15
- namespace/collaboration: Tools for spawning and managing sub-agents.; hash=91f6de0e2773854f
- function/followup_task
- function/interrupt_agent
- function/list_agents
@@ -16,7 +16,7 @@ Settings:
text: {"verbosity":"low"}
tool_choice: "auto"
-- request 1 (turn) --
00:additional_tools/developer (3; hash=d4f3e164a92d9bf1):
00:additional_tools/developer (3; hash=9e8e744a3a55a2dd):
- namespace/functions; hash=e7db0a45c4ec3157
- custom/exec
- function/wait
@@ -24,7 +24,7 @@ Settings:
- function/request_user_input_async
- namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317
- function/sleep
- namespace/collaboration: Tools for spawning and managing sub-agents.; hash=43f195d9cc99ee15
- namespace/collaboration: Tools for spawning and managing sub-agents.; hash=91f6de0e2773854f
- function/followup_task
- function/interrupt_agent
- function/list_agents
@@ -113,7 +113,7 @@ Settings:
## Window 2 (after request 2: input diverged at item 00)
Settings: same as window 1
-- request 3 (turn) --
00:additional_tools/developer (3; hash=61ace4f77de8d87f):
00:additional_tools/developer (3; hash=d9bfc9d2033f8c93):
- namespace/functions; hash=8c17932a39355f2d
- custom/exec
- function/wait
@@ -121,7 +121,7 @@ Settings: same as window 1
- function/request_user_input_async
- namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317
- function/sleep
- namespace/collaboration: Tools for spawning and managing sub-agents.; hash=43f195d9cc99ee15
- namespace/collaboration: Tools for spawning and managing sub-agents.; hash=91f6de0e2773854f
- function/followup_task
- function/interrupt_agent
- function/list_agents
@@ -16,7 +16,7 @@ Settings:
text: {"verbosity":"low"}
tool_choice: "auto"
-- request 1 (turn) --
00:additional_tools/developer (3; hash=61ace4f77de8d87f):
00:additional_tools/developer (3; hash=d9bfc9d2033f8c93):
- namespace/functions; hash=8c17932a39355f2d
- custom/exec
- function/wait
@@ -24,7 +24,7 @@ Settings:
- function/request_user_input_async
- namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317
- function/sleep
- namespace/collaboration: Tools for spawning and managing sub-agents.; hash=43f195d9cc99ee15
- namespace/collaboration: Tools for spawning and managing sub-agents.; hash=91f6de0e2773854f
- function/followup_task
- function/interrupt_agent
- function/list_agents