From 8c78e55b28653798e1cdf567cf98ecd376125afa Mon Sep 17 00:00:00 2001 From: Hare Date: Tue, 29 Sep 2026 15:19:01 +0900 Subject: [PATCH] chore: format Worker command telemetry --- crates/worker/src/in_flight.rs | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/crates/worker/src/in_flight.rs b/crates/worker/src/in_flight.rs index dec0a435b..f76c81fbd 100644 --- a/crates/worker/src/in_flight.rs +++ b/crates/worker/src/in_flight.rs @@ -284,11 +284,11 @@ impl InFlightInner { CommandEvent::Started { tool_call_id: None, .. } => false, - CommandEvent::Output { command_id, .. } - | CommandEvent::Terminal { command_id, .. } => self - .commands - .iter() - .any(|command| command.command_id == *command_id), + CommandEvent::Output { command_id, .. } | CommandEvent::Terminal { command_id, .. } => { + self.commands + .iter() + .any(|command| command.command_id == *command_id) + } } } @@ -433,9 +433,7 @@ impl InFlightInner { } fn clear(&mut self) -> bool { - if self.blocks.is_empty() - && self.known_tool_call_ids.is_empty() - && self.commands.is_empty() + if self.blocks.is_empty() && self.known_tool_call_ids.is_empty() && self.commands.is_empty() { false } else { @@ -764,7 +762,10 @@ mod tests { let mut rx = working_event_tx.subscribe(); let in_flight = InFlightEvents::new(working_event_tx); in_flight.tool_call_start("tool-1".into(), "Bash".into()); - assert!(matches!(rx.try_recv().unwrap(), Event::ToolCallStart { .. })); + assert!(matches!( + rx.try_recv().unwrap(), + Event::ToolCallStart { .. } + )); in_flight.publish_command_event(CommandEvent::Started { command_id: "command-1".into(), tool_call_id: Some("tool-1".into()), @@ -817,7 +818,10 @@ mod tests { let mut rx = working_event_tx.subscribe(); let in_flight = InFlightEvents::new(working_event_tx); in_flight.tool_call_start("own-tool".into(), "Bash".into()); - assert!(matches!(rx.try_recv().unwrap(), Event::ToolCallStart { .. })); + assert!(matches!( + rx.try_recv().unwrap(), + Event::ToolCallStart { .. } + )); in_flight.publish_command_event(CommandEvent::Started { command_id: "foreign-command".into(), @@ -842,7 +846,11 @@ mod tests { }); assert!(rx.try_recv().is_err()); - assert!(snapshot_from_guard(&in_flight.snapshot_guard()).commands.is_empty()); + assert!( + snapshot_from_guard(&in_flight.snapshot_guard()) + .commands + .is_empty() + ); in_flight.replace_command_snapshot(vec![ command_snapshot("own-command", Some("own-tool")),