Use step environments for MCP file uploads (#35878)

## Why

An MCP tool call can run after its selected environment becomes ready, while the
turn context still contains the earlier starting-state snapshot. File argument
rewriting must use the environment available to the current step so it can
resolve and upload local files in that case.

## What changed

- Pass `StepContext` through MCP file argument rewriting.
- Resolve the primary environment from the step snapshot while retaining
  turn-scoped configuration and metadata.
- Add coverage for an environment that transitions from starting to ready
  during a turn.

GitOrigin-RevId: 935bea18ee425aabeacf4505eaff90565f9751e9
This commit is contained in:
sayan-oai authored and copyberry committed 2026-07-29 03:11:28 +00:00
1 parent 6c13b113a3
commit 250de82bfb
3 files changed
+50 -17

No files matched your search

-1
View File
@@ -141,7 +141,6 @@ impl McpHandler {
};
let started = Instant::now();
// TODO(sayan): Use StepContext for MCP file arguments when MCP follows dynamic environments.
let result = handle_mcp_tool_call(
Arc::clone(&session),
&step_context,