Avoid cloning deferred TUI lifecycle payloads (#34347)

## What changed

- Move lifecycle and approval payloads into either the interrupt queue or the
  immediate handler instead of cloning them for both branches.
- Borrow MCP elicitation request metadata while constructing the corresponding
  form, and consume apply-patch changes after collecting notification paths.

## Testing

- Add a history replay test confirming deferred MCP start and completion events
  remain FIFO after streaming finishes.

GitOrigin-RevId: 84ed34f6ff173463a1da016dc140405392c0ba45
This commit is contained in:
Charlie Marsh authored and copyberry committed 2026-07-20 13:54:11 +00:00
1 parent 2244d11a1d
commit ada5a79ddf
7 files changed
+111 -52

No files matched your search

@@ -45,26 +45,26 @@ impl ChatWidget {
}
pub(super) fn on_file_change_completed(&mut self, item: ThreadItem) {
let item2 = item.clone();
self.defer_or_handle(
|q| q.push_item_completed(item),
|s| s.handle_file_change_completed_now(item2),
item,
InterruptManager::push_item_completed,
Self::handle_file_change_completed_now,
);
}
pub(super) fn on_mcp_tool_call_started(&mut self, item: ThreadItem) {
let item2 = item.clone();
self.defer_or_handle(
|q| q.push_item_started(item),
|s| s.handle_mcp_tool_call_started_now(item2),
item,
InterruptManager::push_item_started,
Self::handle_mcp_tool_call_started_now,
);
}
pub(super) fn on_mcp_tool_call_completed(&mut self, item: ThreadItem) {
let item2 = item.clone();
self.defer_or_handle(
|q| q.push_item_completed(item),
|s| s.handle_mcp_tool_call_completed_now(item2),
item,
InterruptManager::push_item_completed,
Self::handle_mcp_tool_call_completed_now,
);
}