diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs index 002b91dc..12ba8d8a 100644 --- a/crates/protocol/src/lib.rs +++ b/crates/protocol/src/lib.rs @@ -363,10 +363,6 @@ pub enum Event { max_attempts: u32, reason: String, }, - /// Any transient streaming blocks that were not committed to history were - /// discarded at a run boundary. Clients should remove live in-flight lines - /// without modifying persisted transcript entries. - InFlightCleared, TextDelta { text: String, }, diff --git a/crates/tui/src/app.rs b/crates/tui/src/app.rs index 0469967d..af2abaf0 100644 --- a/crates/tui/src/app.rs +++ b/crates/tui/src/app.rs @@ -1030,12 +1030,6 @@ impl App { "LLM stream interrupted; continuing generation ({attempt}/{max_attempts}): {reason}" )); } - Event::InFlightCleared => { - self.assistant_streaming = false; - self.latest_llm_wait_event = None; - self.mark_orphan_tool_calls_incomplete(); - self.current_tool = None; - } Event::TextDelta { text } => { self.latest_llm_wait_event = None; self.append_assistant_text(&text); diff --git a/crates/worker/src/in_flight.rs b/crates/worker/src/in_flight.rs index 5b545f81..6a08d881 100644 --- a/crates/worker/src/in_flight.rs +++ b/crates/worker/src/in_flight.rs @@ -202,13 +202,8 @@ impl InFlightEvents { } pub(crate) fn clear(&self) { - let cleared = { - let mut inner = self.lock(); - inner.clear() - }; - if cleared { - let _ = self.event_tx.send(Event::InFlightCleared); - } + let mut inner = self.lock(); + inner.clear(); } fn lock(&self) -> MutexGuard<'_, InFlightInner> { @@ -589,7 +584,7 @@ mod tests { } #[test] - fn clear_discards_uncommitted_blocks_and_notifies_clients() { + fn clear_discards_uncommitted_blocks_without_protocol_event() { let (event_tx, _) = broadcast::channel(16); let mut rx = event_tx.subscribe(); let in_flight = InFlightEvents::new(event_tx); @@ -615,7 +610,6 @@ mod tests { rx.try_recv().unwrap(), Event::ToolCallArgsDelta { .. } )); - assert!(matches!(rx.try_recv().unwrap(), Event::InFlightCleared)); assert!(rx.try_recv().is_err()); } diff --git a/web/workspace/src/lib/generated/protocol.ts b/web/workspace/src/lib/generated/protocol.ts index 9d619e65..b639802a 100644 --- a/web/workspace/src/lib/generated/protocol.ts +++ b/web/workspace/src/lib/generated/protocol.ts @@ -225,7 +225,6 @@ export type Event = reason: string; }; } - | { "event": "in_flight_cleared" } | { "event": "text_delta"; "data": { text: string } } | { "event": "text_done"; "data": { text: string } } | { "event": "thinking_start" } diff --git a/web/workspace/src/lib/workspace/console/model.test.ts b/web/workspace/src/lib/workspace/console/model.test.ts index faea91c7..d1c5253c 100644 --- a/web/workspace/src/lib/workspace/console/model.test.ts +++ b/web/workspace/src/lib/workspace/console/model.test.ts @@ -859,53 +859,6 @@ Deno.test("projectConsole renders snapshot entries and in-flight output", () => ); }); -Deno.test("projectConsole clears transient in-flight rows", () => { - const projection = projectConsole([ - { - eventId: "20", - event: { - event: "snapshot", - data: { - entries: [ - { - kind: "assistant_item", - ts: 1, - item: { - kind: "message", - role: "assistant", - content: [{ kind: "text", text: "latest committed" }], - }, - }, - ], - greeting: { - worker_name: "Worker", - cwd: "/repo", - provider: "provider", - model: "model", - scope_summary: "bounded", - tools: [], - context_window: 100, - context_tokens: 20, - }, - status: "running", - in_flight: { - blocks: [{ kind: "text", text: "stale partial" }], - }, - }, - } satisfies Event, - }, - { - eventId: "21", - event: { event: "in_flight_cleared" } satisfies Event, - }, - ]); - - assertEquals( - projection.lines.map((line) => `${line.kind}:${line.body}`), - ["assistant:latest committed"], - ); -}); - Deno.test("projectConsole reseeds visible rows from segment rotation", () => { const projection = projectConsole([ { diff --git a/web/workspace/src/lib/workspace/console/model.ts b/web/workspace/src/lib/workspace/console/model.ts index 218708d1..abfa3d52 100644 --- a/web/workspace/src/lib/workspace/console/model.ts +++ b/web/workspace/src/lib/workspace/console/model.ts @@ -303,9 +303,6 @@ export function applyProtocolEvent( next.lines.push(inFlightLine(envelope.eventId, block, next.cwd)); } break; - case "in_flight_cleared": - next.lines = next.lines.filter((line) => line.kind !== "in_flight"); - break; case "status": next.status = event.data.status; break;