style: run cargo fmt
This commit is contained in:
@@ -639,9 +639,7 @@ async fn controller_loop<C, St>(
|
||||
// sees the buffered notification(s) without a human
|
||||
// Run.
|
||||
if shared_state.get_status() == PodStatus::Idle {
|
||||
pending = Some(PendingRun::RunForNotification(
|
||||
protocol::InvokeKind::Notify,
|
||||
));
|
||||
pending = Some(PendingRun::RunForNotification(protocol::InvokeKind::Notify));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
//! happen at the front of `Pod::run` when
|
||||
//! `worker.last_run_interrupted()` is set; see `Pod::apply_interrupt_prep`.
|
||||
|
||||
use llm_worker::Item;
|
||||
#[cfg(test)]
|
||||
use crate::prompt::catalog::PromptCatalog;
|
||||
use llm_worker::Item;
|
||||
|
||||
/// Build synthetic `Item::ToolResult` items for every unanswered
|
||||
/// `Item::ToolCall` in `history`, preserving order.
|
||||
|
||||
@@ -185,7 +185,9 @@ mod tests {
|
||||
let item = build_system_item(&entry, &catalog).unwrap();
|
||||
match item {
|
||||
SystemItem::PodEvent { event, body } => {
|
||||
assert!(matches!(event, PodEvent::TurnEnded { ref pod_name } if pod_name == "child"));
|
||||
assert!(
|
||||
matches!(event, PodEvent::TurnEnded { ref pod_name } if pod_name == "child")
|
||||
);
|
||||
assert!(body.contains("[Notification]"));
|
||||
assert!(body.contains("`child`"));
|
||||
}
|
||||
|
||||
+5
-10
@@ -1227,8 +1227,7 @@ impl<C: LlmClient, St: Store> Pod<C, St> {
|
||||
self.commit_entry(LogEntry::UserInput {
|
||||
ts: segment_log::now_millis(),
|
||||
segments: input.clone(),
|
||||
})
|
||||
?;
|
||||
})?;
|
||||
self.user_segments.push(input.clone());
|
||||
|
||||
// Resolve `@<path>` refs, `#<slug>` Knowledge refs, and `/<slug>`
|
||||
@@ -1881,8 +1880,7 @@ impl<C: LlmClient, St: Store> Pod<C, St> {
|
||||
self.commit_entry(LogEntry::TurnEnd {
|
||||
ts: segment_log::now_millis(),
|
||||
turn_count,
|
||||
})
|
||||
?;
|
||||
})?;
|
||||
|
||||
// Flush any sync-buffered metrics from this run first
|
||||
// (currently `prune.fire` / `prune.skip` from the prune observer).
|
||||
@@ -1922,8 +1920,7 @@ impl<C: LlmClient, St: Store> Pod<C, St> {
|
||||
cache_read_tokens: record.cache_read_tokens,
|
||||
cache_write_tokens: record.cache_write_tokens,
|
||||
output_tokens: record.output_tokens,
|
||||
})
|
||||
?;
|
||||
})?;
|
||||
if let Some(id) = correlation_id {
|
||||
let metric = session_metrics::Metric::now("prune.post_request")
|
||||
.with_correlation_id(&id)
|
||||
@@ -1945,16 +1942,14 @@ impl<C: LlmClient, St: Store> Pod<C, St> {
|
||||
ts: segment_log::now_millis(),
|
||||
interrupted,
|
||||
result: r.clone(),
|
||||
})
|
||||
?;
|
||||
})?;
|
||||
}
|
||||
Err(e) => {
|
||||
self.commit_entry(LogEntry::RunErrored {
|
||||
ts: segment_log::now_millis(),
|
||||
interrupted,
|
||||
message: e.to_string(),
|
||||
})
|
||||
?;
|
||||
})?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,9 +119,7 @@ impl SegmentLogSink {
|
||||
fn is_live_relevant(entry: &LogEntry) -> bool {
|
||||
matches!(
|
||||
entry,
|
||||
LogEntry::SegmentStart { .. }
|
||||
| LogEntry::SystemItem { .. }
|
||||
| LogEntry::Invoke { .. }
|
||||
LogEntry::SegmentStart { .. } | LogEntry::SystemItem { .. } | LogEntry::Invoke { .. }
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -240,7 +240,10 @@ max_tokens = 100
|
||||
target = "./"
|
||||
permission = "write"
|
||||
"#;
|
||||
let client = MockClient::new(vec![single_text_events("first"), single_text_events("second")]);
|
||||
let client = MockClient::new(vec![
|
||||
single_text_events("first"),
|
||||
single_text_events("second"),
|
||||
]);
|
||||
let mut pod = make_pod_with_manifest(NO_COMPACT_MANIFEST_TOML, client).await;
|
||||
|
||||
pod.run_text("first").await.unwrap();
|
||||
|
||||
@@ -777,13 +777,15 @@ async fn notify_while_idle_auto_starts_turn_and_injects_system_message() {
|
||||
// not on the `event_tx` broadcast that `handle.subscribe()` taps.
|
||||
// Verify the notification landed on the sink mirror instead.
|
||||
let (entries, _) = handle.sink.subscribe_with_snapshot();
|
||||
let saw_notify_in_mirror = entries.iter().any(|e| matches!(
|
||||
e,
|
||||
session_store::LogEntry::SystemItem {
|
||||
item: session_store::SystemItem::Notification { message, .. },
|
||||
..
|
||||
} if message == "turn finished"
|
||||
));
|
||||
let saw_notify_in_mirror = entries.iter().any(|e| {
|
||||
matches!(
|
||||
e,
|
||||
session_store::LogEntry::SystemItem {
|
||||
item: session_store::SystemItem::Notification { message, .. },
|
||||
..
|
||||
} if message == "turn finished"
|
||||
)
|
||||
});
|
||||
assert!(
|
||||
saw_notify_in_mirror,
|
||||
"Method::Notify should commit a SystemItem::Notification entry; mirror = {entries:?}"
|
||||
@@ -865,16 +867,18 @@ async fn pod_event_turn_ended_while_idle_auto_starts_turn_and_injects_system_mes
|
||||
// its Flush of the drain queue) runs afterwards.
|
||||
wait_for_status(&handle, PodStatus::Idle).await;
|
||||
let (entries, _) = handle.sink.subscribe_with_snapshot();
|
||||
let saw_pod_event_in_mirror = entries.iter().any(|e| matches!(
|
||||
e,
|
||||
session_store::LogEntry::SystemItem {
|
||||
item: session_store::SystemItem::PodEvent {
|
||||
event: protocol::PodEvent::TurnEnded { pod_name },
|
||||
let saw_pod_event_in_mirror = entries.iter().any(|e| {
|
||||
matches!(
|
||||
e,
|
||||
session_store::LogEntry::SystemItem {
|
||||
item: session_store::SystemItem::PodEvent {
|
||||
event: protocol::PodEvent::TurnEnded { pod_name },
|
||||
..
|
||||
},
|
||||
..
|
||||
},
|
||||
..
|
||||
} if pod_name == "child"
|
||||
));
|
||||
} if pod_name == "child"
|
||||
)
|
||||
});
|
||||
assert!(
|
||||
saw_pod_event_in_mirror,
|
||||
"Method::PodEvent should commit a SystemItem::PodEvent entry"
|
||||
|
||||
@@ -78,9 +78,14 @@ async fn restore_from_manifest_rejects_empty_segment_log() {
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
std::fs::write(dir.join(format!("{segid}.jsonl")), b"").unwrap();
|
||||
|
||||
let result =
|
||||
Pod::restore_from_manifest(sid, segid, manifest, store, pod::PromptLoader::builtins_only())
|
||||
.await;
|
||||
let result = Pod::restore_from_manifest(
|
||||
sid,
|
||||
segid,
|
||||
manifest,
|
||||
store,
|
||||
pod::PromptLoader::builtins_only(),
|
||||
)
|
||||
.await;
|
||||
|
||||
match result {
|
||||
Err(PodError::SegmentEmpty { segment_id }) => assert_eq!(segment_id, segid),
|
||||
@@ -106,9 +111,14 @@ async fn restore_from_manifest_rejects_segment_without_scope_snapshot() {
|
||||
};
|
||||
session_store::create_segment_with_ids(&store, sid, segid, state).unwrap();
|
||||
|
||||
let result =
|
||||
Pod::restore_from_manifest(sid, segid, manifest, store, pod::PromptLoader::builtins_only())
|
||||
.await;
|
||||
let result = Pod::restore_from_manifest(
|
||||
sid,
|
||||
segid,
|
||||
manifest,
|
||||
store,
|
||||
pod::PromptLoader::builtins_only(),
|
||||
)
|
||||
.await;
|
||||
|
||||
match result {
|
||||
Err(PodError::SegmentScopeMissing { segment_id }) => assert_eq!(segment_id, segid),
|
||||
|
||||
Reference in New Issue
Block a user