Add session and originating window IDs to MCP request metadata (#45409)

## What changed

Include `sessionId` and the originating `windowId` alongside `threadId` and optional `itemId` in MCP request metadata. Retain the originating item and window for code-mode cells across waits and compaction, including the window when no matching history item is found.

## Testing

Extend metadata assertions for direct and nested MCP calls. Add a regression test verifying that a code-mode cell retains its original item and window IDs when it resumes after compaction.

GitOrigin-RevId: 5e3cf761f2bed4c16565334c94654496367325fd
This commit is contained in:
jif authored and copyberry committed 2026-09-14 11:03:22 +00:00
1 parent d77ebc7223
commit d761097734
11 files changed
+228 -40

No files matched your search

+2 -2
View File
@@ -200,7 +200,7 @@ impl McpHandler {
});
notify_tool_start(&invocation, mcp_tool.as_ref()).await;
let originating_item_id = invocation.originating_item_id().await;
let originating_call = invocation.originating_call().await;
let ToolInvocation {
session,
step_context,
@@ -232,7 +232,7 @@ impl McpHandler {
&step_context,
&cancellation_token,
call_id.clone(),
originating_item_id,
originating_call,
&self.tool_info,
prepared_mcp_call,
self.hook_tool_name(),