mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
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:
1 parent
d7f8e48d7d
commit
0a5b999169
21 files changed
+505
-200
No files matched your search
@@ -5478,10 +5478,13 @@ async fn rebuild_with_session_layers_refreshes_requirements() -> std::io::Result
|
||||
thread_layer_stack,
|
||||
)
|
||||
.await?;
|
||||
let zsh_path = refreshed_config.zsh_path.clone();
|
||||
let config = Config::rebuild_with_session_layers(
|
||||
&thread_config.config_layer_stack,
|
||||
thread_config.cwd.to_path_buf(),
|
||||
&refreshed_config,
|
||||
&refreshed_config.config_layer_stack,
|
||||
refreshed_config.codex_home.clone(),
|
||||
zsh_path.map(AbsolutePathBuf::try_from).transpose()?,
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -5603,10 +5606,13 @@ async fn rebuild_with_session_layers_refreshes_plugin_derived_mcp_config() -> an
|
||||
thread_layer_stack,
|
||||
)
|
||||
.await?;
|
||||
let zsh_path = refreshed_config.zsh_path.clone();
|
||||
let config = Config::rebuild_with_session_layers(
|
||||
&thread_config.config_layer_stack,
|
||||
thread_config.cwd.to_path_buf(),
|
||||
&refreshed_config,
|
||||
&refreshed_config.config_layer_stack,
|
||||
refreshed_config.codex_home.clone(),
|
||||
zsh_path.map(AbsolutePathBuf::try_from).transpose()?,
|
||||
)
|
||||
.await?;
|
||||
let plugins_manager =
|
||||
|
||||
@@ -1844,22 +1844,16 @@ impl Config {
|
||||
pub async fn rebuild_with_session_layers(
|
||||
session_layers: &ConfigLayerStack,
|
||||
cwd: PathBuf,
|
||||
refreshed_config: &Config,
|
||||
refreshed_layers: &ConfigLayerStack,
|
||||
codex_home: AbsolutePathBuf,
|
||||
default_zsh_path: Option<AbsolutePathBuf>,
|
||||
) -> std::io::Result<Self> {
|
||||
let config_layer_stack = Self::layer_stack_preserving_session(
|
||||
session_layers,
|
||||
&refreshed_config.config_layer_stack,
|
||||
)?;
|
||||
let config_layer_stack =
|
||||
Self::layer_stack_preserving_session(session_layers, refreshed_layers)?;
|
||||
let cfg: ConfigToml = config_layer_stack
|
||||
.effective_config()
|
||||
.try_into()
|
||||
.map_err(|err| std::io::Error::new(std::io::ErrorKind::InvalidData, err))?;
|
||||
let default_zsh_path = refreshed_config
|
||||
.zsh_path
|
||||
.clone()
|
||||
.map(AbsolutePathBuf::try_from)
|
||||
.transpose()?;
|
||||
|
||||
Self::load_config_with_layer_stack(
|
||||
LOCAL_FS.as_ref(),
|
||||
cfg,
|
||||
@@ -1868,7 +1862,7 @@ impl Config {
|
||||
default_zsh_path,
|
||||
..Default::default()
|
||||
},
|
||||
refreshed_config.codex_home.clone(),
|
||||
codex_home,
|
||||
config_layer_stack,
|
||||
)
|
||||
.await
|
||||
|
||||
@@ -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);
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
+4
-4
@@ -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
|
||||
|
||||
+4
-4
@@ -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
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
Reference in new issue
Block a user