fix(host): drop in-flight design session when falling to chat path
Codex stop-time review caught a real cross-session leak in the intent gate introduced by the previous commit. `launch_if_pending` clears `current_chat` when the design branch is taken, but the chat branch only cleared `current_chat` (for the unwired-agent error path) — it never cleared `current_design`. Symptom: if a design turn is in flight (worker pumping `apply` requests + `Progress` deltas into the trailing assistant bubble) and the user sends a chat message, the new chat bubble begins streaming chat deltas while the still-running design worker keeps acking apply requests on the canonical doc and appending `Progress` strings to the same bubble. The fix mirrors the design branch — when the chat path is taken (chat intent, design intent without a Provider, or any unwired agent), `*current_design = None` drops the worker's command receiver so its next `apply` returns false and the turn ends. `cargo test -p op-host-desktop` 105 passed. workspace fmt + clippy clean.
This commit is contained in:
parent
f00f1d213d
commit
37f1bb202c
|
|
@ -195,6 +195,13 @@ pub fn launch_if_pending(
|
|||
// the chat path. The assistant CLI will still answer the user
|
||||
// (most CLIs handle design verbs as chat).
|
||||
}
|
||||
// Taking the chat path — drop any in-flight design turn so its
|
||||
// worker's next `apply` returns false (channel dropped) and its
|
||||
// `Progress` deltas stop streaming into this turn's fresh bubble
|
||||
// (codex stop-gate: stale design session survived chat fallback,
|
||||
// kept overwriting the new bubble content + applying ack'd
|
||||
// EditorCommands long after the user moved on).
|
||||
*current_design = None;
|
||||
let agent_idx = host.editor_state().editor_ui.chat_selected_agent;
|
||||
let Some(provider) = provider_for_agent(agent_idx) else {
|
||||
// Selected agent has no `ChatProvider` bridge yet (Codex /
|
||||
|
|
|
|||
Loading…
Reference in a new issue