mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Prewarm shell snapshots for eligible turns (#42137)
## Why Shell Snapshot V2 previously captured the login-shell environment lazily when a command started, adding that work to the command path. ## What changed - Start one asynchronous snapshot capture after turn hooks accept the turn, so eligible local `exec_command` calls can reuse it without blocking the model. - Use the turn's resolved tools, permissions, sandbox, environment, and shell configuration, and skip prewarming for unsupported or network-managed cases. - Cancel outstanding prewarming during shutdown. Keep failed speculative captures retryable by real commands without consuming their retry budget. ## Testing Added coverage for non-blocking capture and reuse, failure recovery, sandbox and permission isolation, shutdown cancellation, hook-stopped turns, eligibility gates, and concurrent capture retries. GitOrigin-RevId: ff24a4f0328c06653e09d03fd0a3db1eccd65030
This commit is contained in:
1 parent
c5b5fa8089
commit
612e6491d5
13 files changed
+783
-50
No files matched your search
@@ -190,14 +190,7 @@ async fn parallel_support_does_not_match_namespaced_local_tool_names() -> anyhow
|
||||
|
||||
assert_eq!(
|
||||
router
|
||||
.tool_runtime(&ToolCall {
|
||||
tool_name: ToolName::plain(parallel_tool_name),
|
||||
call_id: "call-local-tool".to_string(),
|
||||
payload: ToolPayload::Function {
|
||||
arguments: "{}".to_string(),
|
||||
},
|
||||
encrypted_function_args: None,
|
||||
})
|
||||
.tool_runtime(&ToolName::plain(parallel_tool_name))
|
||||
.map(|runtime| runtime.tool_name()),
|
||||
Some(ToolName::plain(parallel_tool_name))
|
||||
);
|
||||
@@ -369,7 +362,7 @@ async fn mcp_parallel_support_uses_handler_data() -> anyhow::Result<()> {
|
||||
assert!(router.tool_supports_parallel(&call));
|
||||
assert_eq!(
|
||||
router
|
||||
.tool_runtime(&call)
|
||||
.tool_runtime(&call.tool_name)
|
||||
.map(|runtime| runtime.tool_name()),
|
||||
Some(call.tool_name.clone())
|
||||
);
|
||||
@@ -385,7 +378,7 @@ async fn mcp_parallel_support_uses_handler_data() -> anyhow::Result<()> {
|
||||
assert!(!router.tool_supports_parallel(&different_server_call));
|
||||
assert_eq!(
|
||||
router
|
||||
.tool_runtime(&different_server_call)
|
||||
.tool_runtime(&different_server_call.tool_name)
|
||||
.map(|runtime| runtime.tool_name()),
|
||||
Some(different_server_call.tool_name.clone())
|
||||
);
|
||||
@@ -399,7 +392,7 @@ async fn mcp_parallel_support_uses_handler_data() -> anyhow::Result<()> {
|
||||
encrypted_function_args: None,
|
||||
};
|
||||
assert!(!router.tool_supports_parallel(&hidden_call));
|
||||
assert!(router.tool_runtime(&hidden_call).is_some());
|
||||
assert!(router.tool_runtime(&hidden_call.tool_name).is_some());
|
||||
|
||||
let nested_only_call = ToolCall {
|
||||
tool_name: ToolName::namespaced("mcp__nested_echo__", "query_with_delay"),
|
||||
|
||||
Reference in new issue
Block a user