Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(web_chat): apply rustfmt formatting

Steven Enamakel7bbd488e0f0e
diff --git a/crates/openhuman-core/src/web_chat/egress_surface.rs b/crates/openhuman-core/src/web_chat/egress_surface.rs
index 5d526767f4..45eb5f28e3 100644
--- a/crates/openhuman-core/src/web_chat/egress_surface.rs
+++ b/crates/openhuman-core/src/web_chat/egress_surface.rs
@@ -94,13 +94,16 @@ impl EventHandler<DomainEvent> for EgressSurfaceSubscriber {
descriptor.reason,
request_id,
);
- publish_web_channel_event_in(&crate::core::runtime::DispatchCtx::ambient(), WebChannelEvent {
- event: "external_transfer_pending".to_string(),
- client_id: client_id.clone(),
- thread_id: thread_id.clone(),
- request_id: request_id.clone().unwrap_or_default(),
- args: Some(args),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ WebChannelEvent {
+ event: "external_transfer_pending".to_string(),
+ client_id: client_id.clone(),
+ thread_id: thread_id.clone(),
+ request_id: request_id.clone().unwrap_or_default(),
+ args: Some(args),
+ ..Default::default()
+ },
+ );
}
}
diff --git a/crates/openhuman-core/src/web_chat/event_bus.rs b/crates/openhuman-core/src/web_chat/event_bus.rs
index 1d367963dd..b35566c9bb 100644
--- a/crates/openhuman-core/src/web_chat/event_bus.rs
+++ b/crates/openhuman-core/src/web_chat/event_bus.rs
@@ -188,13 +188,16 @@ impl EventHandler<DomainEvent> for MemoryActivitySurfaceSubscriber {
log::debug!(
"[web-channel] memory-activity-surface emitting memory_activity kind={event_name} thread_id={thread_id} client_id={client_id}"
);
- publish_web_channel_event_in(&ctx, WebChannelEvent {
- event: "memory_activity".to_string(),
- client_id,
- thread_id,
- args: Some(args),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &ctx,
+ WebChannelEvent {
+ event: "memory_activity".to_string(),
+ client_id,
+ thread_id,
+ args: Some(args),
+ ..Default::default()
+ },
+ );
}
}
@@ -252,48 +255,60 @@ impl EventHandler<DomainEvent> for AgentSurfaceSubscriber {
log::debug!(
"[web-channel] agent-surface emitting thread_goal_updated thread_id={thread_id}"
);
- publish_web_channel_event_in(&ctx, WebChannelEvent {
- event: "thread_goal_updated".to_string(),
- client_id: String::new(),
- thread_id: thread_id.clone(),
- goal: goal.clone(),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &ctx,
+ WebChannelEvent {
+ event: "thread_goal_updated".to_string(),
+ client_id: String::new(),
+ thread_id: thread_id.clone(),
+ goal: goal.clone(),
+ ..Default::default()
+ },
+ );
}
DomainEvent::ThreadGoalCleared { thread_id } => {
log::debug!(
"[web-channel] agent-surface emitting thread_goal_cleared thread_id={thread_id}"
);
- publish_web_channel_event_in(&ctx, WebChannelEvent {
- event: "thread_goal_cleared".to_string(),
- client_id: String::new(),
- thread_id: thread_id.clone(),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &ctx,
+ WebChannelEvent {
+ event: "thread_goal_cleared".to_string(),
+ client_id: String::new(),
+ thread_id: thread_id.clone(),
+ ..Default::default()
+ },
+ );
}
DomainEvent::ThreadTodosChanged { thread_id, todos } => {
log::debug!(
"[web-channel] agent-surface emitting thread_todos_changed thread_id={thread_id}"
);
- publish_web_channel_event_in(&ctx, WebChannelEvent {
- event: "thread_todos_changed".to_string(),
- client_id: String::new(),
- thread_id: thread_id.clone(),
- todos: Some(todos.clone()),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &ctx,
+ WebChannelEvent {
+ event: "thread_todos_changed".to_string(),
+ client_id: String::new(),
+ thread_id: thread_id.clone(),
+ todos: Some(todos.clone()),
+ ..Default::default()
+ },
+ );
}
DomainEvent::ThreadRunModeChanged { thread_id, mode } => {
log::debug!(
"[web-channel] agent-surface emitting run_mode_changed thread_id={thread_id} mode={mode}"
);
- publish_web_channel_event_in(&ctx, WebChannelEvent {
- event: "run_mode_changed".to_string(),
- client_id: String::new(),
- thread_id: thread_id.clone(),
- message: Some(mode.clone()),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &ctx,
+ WebChannelEvent {
+ event: "run_mode_changed".to_string(),
+ client_id: String::new(),
+ thread_id: thread_id.clone(),
+ message: Some(mode.clone()),
+ ..Default::default()
+ },
+ );
}
DomainEvent::RunQueueMessageQueued {
thread_id,
@@ -313,17 +328,20 @@ impl EventHandler<DomainEvent> for AgentSurfaceSubscriber {
log::debug!(
"[web-channel] agent-surface emitting queue_item_queued thread_id={thread_id} item_id={item_id}"
);
- publish_web_channel_event_in(&ctx, WebChannelEvent {
- event: "queue_item_queued".to_string(),
- client_id: String::new(),
- thread_id: thread_id.clone(),
- queue_item: Some(crate::web_chat::QueueItemPayload {
- id: item_id,
- lane: None,
- text_preview: text_preview.clone(),
- }),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &ctx,
+ WebChannelEvent {
+ event: "queue_item_queued".to_string(),
+ client_id: String::new(),
+ thread_id: thread_id.clone(),
+ queue_item: Some(crate::web_chat::QueueItemPayload {
+ id: item_id,
+ lane: None,
+ text_preview: text_preview.clone(),
+ }),
+ ..Default::default()
+ },
+ );
}
DomainEvent::RunQueueMessageDelivered {
thread_id,
@@ -339,17 +357,20 @@ impl EventHandler<DomainEvent> for AgentSurfaceSubscriber {
log::debug!(
"[web-channel] agent-surface emitting queue_item_delivered thread_id={thread_id} item_id={item_id}"
);
- publish_web_channel_event_in(&ctx, WebChannelEvent {
- event: "queue_item_delivered".to_string(),
- client_id: String::new(),
- thread_id: thread_id.clone(),
- queue_item: Some(crate::web_chat::QueueItemPayload {
- id: item_id,
- lane,
- text_preview: text_preview.clone(),
- }),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &ctx,
+ WebChannelEvent {
+ event: "queue_item_delivered".to_string(),
+ client_id: String::new(),
+ thread_id: thread_id.clone(),
+ queue_item: Some(crate::web_chat::QueueItemPayload {
+ id: item_id,
+ lane,
+ text_preview: text_preview.clone(),
+ }),
+ ..Default::default()
+ },
+ );
}
DomainEvent::RunQueueFollowupDispatched {
thread_id,
@@ -370,17 +391,20 @@ impl EventHandler<DomainEvent> for AgentSurfaceSubscriber {
log::debug!(
"[web-channel] agent-surface emitting queue_item_delivered thread_id={thread_id} item_id={item_id}"
);
- publish_web_channel_event_in(&ctx, WebChannelEvent {
- event: "queue_item_delivered".to_string(),
- client_id: String::new(),
- thread_id: thread_id.clone(),
- queue_item: Some(crate::web_chat::QueueItemPayload {
- id: item_id,
- lane,
- text_preview: text_preview.clone(),
- }),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &ctx,
+ WebChannelEvent {
+ event: "queue_item_delivered".to_string(),
+ client_id: String::new(),
+ thread_id: thread_id.clone(),
+ queue_item: Some(crate::web_chat::QueueItemPayload {
+ id: item_id,
+ lane,
+ text_preview: text_preview.clone(),
+ }),
+ ..Default::default()
+ },
+ );
}
_ => {}
}
@@ -424,22 +448,25 @@ impl EventHandler<DomainEvent> for ArtifactSurfaceSubscriber {
log::info!(
"[web-channel] artifact-surface emitting artifact_ready id={artifact_id} kind={kind} thread_id={thread_id} client_id={client_id} tool_call_id={tool_call_id:?}"
);
- publish_web_channel_event_in(&ctx, WebChannelEvent {
- event: "artifact_ready".to_string(),
- client_id: client_id.clone(),
- thread_id: thread_id.clone(),
- tool_call_id: tool_call_id.clone(),
- turn_request_id: request_id.clone(),
- args: Some(serde_json::json!({
- "artifact_id": artifact_id,
- "kind": kind,
- "title": title,
- "workspace_dir": workspace_dir,
- "path": path,
- "size_bytes": size_bytes,
- })),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &ctx,
+ WebChannelEvent {
+ event: "artifact_ready".to_string(),
+ client_id: client_id.clone(),
+ thread_id: thread_id.clone(),
+ tool_call_id: tool_call_id.clone(),
+ turn_request_id: request_id.clone(),
+ args: Some(serde_json::json!({
+ "artifact_id": artifact_id,
+ "kind": kind,
+ "title": title,
+ "workspace_dir": workspace_dir,
+ "path": path,
+ "size_bytes": size_bytes,
+ })),
+ ..Default::default()
+ },
+ );
}
DomainEvent::ArtifactFailed {
artifact_id,
@@ -462,21 +489,24 @@ impl EventHandler<DomainEvent> for ArtifactSurfaceSubscriber {
"[web-channel] artifact-surface emitting artifact_failed id={artifact_id} kind={kind} thread_id={thread_id} client_id={client_id} tool_call_id={tool_call_id:?} error_len={}",
error.len()
);
- publish_web_channel_event_in(&ctx, WebChannelEvent {
- event: "artifact_failed".to_string(),
- client_id: client_id.clone(),
- thread_id: thread_id.clone(),
- tool_call_id: tool_call_id.clone(),
- turn_request_id: request_id.clone(),
- args: Some(serde_json::json!({
- "artifact_id": artifact_id,
- "kind": kind,
- "title": title,
- "workspace_dir": workspace_dir,
- "error": error,
- })),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &ctx,
+ WebChannelEvent {
+ event: "artifact_failed".to_string(),
+ client_id: client_id.clone(),
+ thread_id: thread_id.clone(),
+ tool_call_id: tool_call_id.clone(),
+ turn_request_id: request_id.clone(),
+ args: Some(serde_json::json!({
+ "artifact_id": artifact_id,
+ "kind": kind,
+ "title": title,
+ "workspace_dir": workspace_dir,
+ "error": error,
+ })),
+ ..Default::default()
+ },
+ );
}
DomainEvent::ArtifactPending {
artifact_id,
@@ -498,21 +528,24 @@ impl EventHandler<DomainEvent> for ArtifactSurfaceSubscriber {
log::info!(
"[web-channel] artifact-surface emitting artifact_pending id={artifact_id} kind={kind} thread_id={thread_id} client_id={client_id} tool_call_id={tool_call_id:?}"
);
- publish_web_channel_event_in(&ctx, WebChannelEvent {
- event: "artifact_pending".to_string(),
- client_id: client_id.clone(),
- thread_id: thread_id.clone(),
- tool_call_id: tool_call_id.clone(),
- turn_request_id: request_id.clone(),
- args: Some(serde_json::json!({
- "artifact_id": artifact_id,
- "kind": kind,
- "title": title,
- "workspace_dir": workspace_dir,
- "path": path,
- })),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &ctx,
+ WebChannelEvent {
+ event: "artifact_pending".to_string(),
+ client_id: client_id.clone(),
+ thread_id: thread_id.clone(),
+ tool_call_id: tool_call_id.clone(),
+ turn_request_id: request_id.clone(),
+ args: Some(serde_json::json!({
+ "artifact_id": artifact_id,
+ "kind": kind,
+ "title": title,
+ "workspace_dir": workspace_dir,
+ "path": path,
+ })),
+ ..Default::default()
+ },
+ );
}
_ => {}
}
@@ -641,17 +674,20 @@ impl EventHandler<DomainEvent> for ApprovalSurfaceSubscriber {
log::info!(
"[web-channel] approval-surface emitting approval_request request_id={request_id} thread_id={thread_id} client_id={client_id} tool={tool_name}"
);
- publish_web_channel_event_in(&ctx, approval_request_event(
- request_id,
- tool_name,
- action_summary,
- args_redacted,
- thread_id,
- client_id,
- tool_call_id.as_deref(),
- expires_at.as_deref(),
- crate::security::approval::is_detached_request(request_id),
- ));
+ publish_web_channel_event_in(
+ &ctx,
+ approval_request_event(
+ request_id,
+ tool_name,
+ action_summary,
+ args_redacted,
+ thread_id,
+ client_id,
+ tool_call_id.as_deref(),
+ expires_at.as_deref(),
+ crate::security::approval::is_detached_request(request_id),
+ ),
+ );
}
_ => {
log::warn!(
@@ -675,17 +711,20 @@ impl EventHandler<DomainEvent> for ApprovalSurfaceSubscriber {
log::info!(
"[web-channel] approval-surface emitting approval_decided request_id={request_id} thread_id={thread_id} client_id={client_id} tool={tool_name} decision={decision}"
);
- publish_web_channel_event_in(&ctx, WebChannelEvent {
- event: "approval_decided".to_string(),
- client_id: client_id.clone(),
- thread_id: thread_id.clone(),
- request_id: request_id.clone(),
- tool_name: Some(tool_name.clone()),
- message: Some(decision.clone()),
- tool_call_id: tool_call_id.clone(),
- cancel_reason: resolution.clone(),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &ctx,
+ WebChannelEvent {
+ event: "approval_decided".to_string(),
+ client_id: client_id.clone(),
+ thread_id: thread_id.clone(),
+ request_id: request_id.clone(),
+ tool_name: Some(tool_name.clone()),
+ message: Some(decision.clone()),
+ tool_call_id: tool_call_id.clone(),
+ cancel_reason: resolution.clone(),
+ ..Default::default()
+ },
+ );
}
_ => {
log::debug!(
@@ -707,15 +746,18 @@ impl EventHandler<DomainEvent> for ApprovalSurfaceSubscriber {
"[web-channel] plan-review-surface emitting plan_review_request request_id={request_id} thread_id={thread_id} client_id={client_id} steps={}",
steps.len()
);
- publish_web_channel_event_in(&ctx, plan_review_request_event(
- request_id,
- summary,
- steps,
- thread_id,
- client_id,
- tool_call_id.as_deref(),
- expires_at.as_deref(),
- ));
+ publish_web_channel_event_in(
+ &ctx,
+ plan_review_request_event(
+ request_id,
+ summary,
+ steps,
+ thread_id,
+ client_id,
+ tool_call_id.as_deref(),
+ expires_at.as_deref(),
+ ),
+ );
}
_ => {
log::warn!(
@@ -737,17 +779,20 @@ impl EventHandler<DomainEvent> for ApprovalSurfaceSubscriber {
log::info!(
"[web-channel] plan-review-surface emitting plan_review_decided request_id={request_id} thread_id={thread_id} client_id={client_id} decision={decision}"
);
- publish_web_channel_event_in(&ctx, WebChannelEvent {
- event: "plan_review_decided".to_string(),
- client_id: client_id.clone(),
- thread_id: thread_id.clone(),
- request_id: request_id.clone(),
- tool_name: Some("request_plan_review".to_string()),
- message: Some(decision.clone()),
- tool_call_id: tool_call_id.clone(),
- cancel_reason: resolution.clone(),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &ctx,
+ WebChannelEvent {
+ event: "plan_review_decided".to_string(),
+ client_id: client_id.clone(),
+ thread_id: thread_id.clone(),
+ request_id: request_id.clone(),
+ tool_name: Some("request_plan_review".to_string()),
+ message: Some(decision.clone()),
+ tool_call_id: tool_call_id.clone(),
+ cancel_reason: resolution.clone(),
+ ..Default::default()
+ },
+ );
}
_ => {
log::debug!(
diff --git a/crates/openhuman-core/src/web_chat/mod.rs b/crates/openhuman-core/src/web_chat/mod.rs
index bb19365527..ddc8671e51 100644
--- a/crates/openhuman-core/src/web_chat/mod.rs
+++ b/crates/openhuman-core/src/web_chat/mod.rs
@@ -62,10 +62,10 @@ pub use channel_event::{
};
pub use egress_surface::register_egress_surface_subscriber;
pub use event_bus::{
- approval_request_event, plan_review_request_event, publish_web_channel_event, publish_web_channel_event_in,
- register_agent_surface_subscriber, register_approval_surface_subscriber,
- register_artifact_surface_subscriber, register_memory_activity_surface_subscriber,
- subscribe_web_channel_events,
+ approval_request_event, plan_review_request_event, publish_web_channel_event,
+ publish_web_channel_event_in, register_agent_surface_subscriber,
+ register_approval_surface_subscriber, register_artifact_surface_subscriber,
+ register_memory_activity_surface_subscriber, subscribe_web_channel_events,
};
pub use progress_bridge::unix_epoch_ms;
diff --git a/crates/openhuman-core/src/web_chat/ops/budget_correlation.rs b/crates/openhuman-core/src/web_chat/ops/budget_correlation.rs
index 701270be2f..4d98005a75 100644
--- a/crates/openhuman-core/src/web_chat/ops/budget_correlation.rs
+++ b/crates/openhuman-core/src/web_chat/ops/budget_correlation.rs
@@ -70,7 +70,11 @@ fn prune_stale_budget_signals(signals: &mut HashMap<String, BudgetSignal>) {
/// Record that this thread just hit an inference budget-exhausted error on the
/// given provider binding.
-pub(crate) async fn record_budget_signal(ctx: &DispatchCtx, thread_id: &str, provider_binding: &str) {
+pub(crate) async fn record_budget_signal(
+ ctx: &DispatchCtx,
+ thread_id: &str,
+ provider_binding: &str,
+) {
let mut signals = thread_budget_signals().lock_owned().await;
prune_stale_budget_signals(&mut signals);
signals.insert(
@@ -93,7 +97,11 @@ pub(crate) async fn clear_budget_signal(ctx: &DispatchCtx, thread_id: &str) {
/// **on the same provider binding** as the current turn. A binding mismatch or
/// an expired entry evicts it and reads as not-fresh, so a re-routed turn never
/// inherits the prior provider's exhaustion.
-pub(crate) async fn has_fresh_budget_signal(ctx: &DispatchCtx, thread_id: &str, provider_binding: &str) -> bool {
+pub(crate) async fn has_fresh_budget_signal(
+ ctx: &DispatchCtx,
+ thread_id: &str,
+ provider_binding: &str,
+) -> bool {
let mut signals = thread_budget_signals().lock_owned().await;
let key = key_for(ctx, thread_id);
match signals.get(&key) {
@@ -114,7 +122,12 @@ pub(crate) async fn has_fresh_budget_signal(ctx: &DispatchCtx, thread_id: &str,
/// Test-only seeder: record a budget signal on `provider_binding` aged `age`
/// into the past so expiry can be exercised without sleeping.
#[cfg(test)]
-async fn record_budget_signal_aged(ctx: &DispatchCtx, thread_id: &str, provider_binding: &str, age: Duration) {
+async fn record_budget_signal_aged(
+ ctx: &DispatchCtx,
+ thread_id: &str,
+ provider_binding: &str,
+ age: Duration,
+) {
let mut signals = thread_budget_signals().lock_owned().await;
let when = Instant::now().checked_sub(age).unwrap_or_else(Instant::now);
signals.insert(
diff --git a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs b/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
index 5bb30ff394..97d17a5b66 100644
--- a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
+++ b/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
@@ -28,9 +28,11 @@ pub async fn cancel_chat_scoped(
thread_id: &str,
request_id: Option<&str>,
) -> Result<Option<String>, String> {
- Ok(cancel_chat_inner(ctx, client_id, thread_id, request_id, false)
- .await?
- .request_id)
+ Ok(
+ cancel_chat_inner(ctx, client_id, thread_id, request_id, false)
+ .await?
+ .request_id,
+ )
}
/// The placeholder `client_id` a lease-loss teardown logs under. It carries no
@@ -195,23 +197,29 @@ async fn cancel_chat_inner(
(true, Some(started_by)) => started_by,
_ => client_id.to_string(),
};
- publish_web_channel_event_in(ctx, WebChannelEvent {
- event: "chat_error".to_string(),
- client_id: client_id.clone(),
- thread_id: thread_id.to_string(),
- request_id: request_id.clone(),
- message: Some("Cancelled".to_string()),
- error_type: Some("cancelled".to_string()),
- ..Default::default()
- });
- publish_web_channel_event_in(ctx, WebChannelEvent {
- event: "chat_cancelled".to_string(),
- client_id,
- thread_id: thread_id.to_string(),
- request_id,
- cancel_reason: Some("user_stop".to_string()),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ ctx,
+ WebChannelEvent {
+ event: "chat_error".to_string(),
+ client_id: client_id.clone(),
+ thread_id: thread_id.to_string(),
+ request_id: request_id.clone(),
+ message: Some("Cancelled".to_string()),
+ error_type: Some("cancelled".to_string()),
+ ..Default::default()
+ },
+ );
+ publish_web_channel_event_in(
+ ctx,
+ WebChannelEvent {
+ event: "chat_cancelled".to_string(),
+ client_id,
+ thread_id: thread_id.to_string(),
+ request_id,
+ cancel_reason: Some("user_stop".to_string()),
+ ..Default::default()
+ },
+ );
}
Ok(CancelOutcome {
@@ -307,7 +315,8 @@ fn queue_item_json(
pub async fn channel_web_queue_status(
ctx: &DispatchCtx,
- thread_id: &str) -> Result<Outcome<Value>, String> {
+ thread_id: &str,
+) -> Result<Outcome<Value>, String> {
let map_key = key_for(ctx, thread_id);
let in_flight = in_flight().lock_owned().await;
if let Some(entry) = in_flight.get(&map_key) {
@@ -384,17 +393,20 @@ pub async fn channel_web_queue_remove(
drop(in_flight);
if removed > 0 {
log::info!("[web-channel] removed queued item thread_id={thread_id} item_id={item_id}");
- publish_web_channel_event_in(ctx, WebChannelEvent {
- event: "queue_item_removed".to_string(),
- client_id: client_id.to_string(),
- thread_id: thread_id.to_string(),
- queue_item: Some(crate::web_chat::QueueItemPayload {
- id: item_id.to_string(),
- lane: None,
- text_preview: None,
- }),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ ctx,
+ WebChannelEvent {
+ event: "queue_item_removed".to_string(),
+ client_id: client_id.to_string(),
+ thread_id: thread_id.to_string(),
+ queue_item: Some(crate::web_chat::QueueItemPayload {
+ id: item_id.to_string(),
+ lane: None,
+ text_preview: None,
+ }),
+ ..Default::default()
+ },
+ );
}
Ok(Outcome::single_log(
json!({
@@ -408,7 +420,8 @@ pub async fn channel_web_queue_remove(
pub async fn channel_web_queue_clear(
ctx: &DispatchCtx,
- thread_id: &str) -> Result<Outcome<Value>, String> {
+ thread_id: &str,
+) -> Result<Outcome<Value>, String> {
let map_key = key_for(ctx, thread_id);
let in_flight = in_flight().lock_owned().await;
if let Some(entry) = in_flight.get(&map_key) {
diff --git a/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs b/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs
index 674ddd2cdb..2005b5f3a9 100644
--- a/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs
+++ b/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs
@@ -169,22 +169,25 @@ pub(crate) async fn spawn_parallel_turn(
);
}
- publish_web_channel_event_in(&ctx_task, WebChannelEvent {
- event: "chat_error".to_string(),
- client_id: client_id_task.clone(),
- thread_id: thread_id_task.clone(),
- request_id: request_id_task.clone(),
- message: Some(classified.message),
- error_type: Some(classified.error_type.to_string()),
- error_source: Some(classified.source.to_string()),
- error_retryable: Some(classified.retryable),
- error_retry_after_ms: classified.retry_after_ms,
- error_provider: classified.provider,
- error_fallback_available: classified.fallback_available,
- copy_key: Some(classified.copy_key.to_string()),
- copy_params: classified.copy_params,
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &ctx_task,
+ WebChannelEvent {
+ event: "chat_error".to_string(),
+ client_id: client_id_task.clone(),
+ thread_id: thread_id_task.clone(),
+ request_id: request_id_task.clone(),
+ message: Some(classified.message),
+ error_type: Some(classified.error_type.to_string()),
+ error_source: Some(classified.source.to_string()),
+ error_retryable: Some(classified.retryable),
+ error_retry_after_ms: classified.retry_after_ms,
+ error_provider: classified.provider,
+ error_fallback_available: classified.fallback_available,
+ copy_key: Some(classified.copy_key.to_string()),
+ copy_params: classified.copy_params,
+ ..Default::default()
+ },
+ );
}
None => {
log::info!(
@@ -196,14 +199,17 @@ pub(crate) async fn spawn_parallel_turn(
// `chat_error` on this path today — leaving a client
// waiting on this request_id with no terminal event.
// `chat_cancelled` closes it out.
- publish_web_channel_event_in(&ctx_task, WebChannelEvent {
- event: "chat_cancelled".to_string(),
- client_id: client_id_task.clone(),
- thread_id: thread_id_task.clone(),
- request_id: request_id_task.clone(),
- cancel_reason: Some("user_stop".to_string()),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ &ctx_task,
+ WebChannelEvent {
+ event: "chat_cancelled".to_string(),
+ client_id: client_id_task.clone(),
+ thread_id: thread_id_task.clone(),
+ request_id: request_id_task.clone(),
+ cancel_reason: Some("user_stop".to_string()),
+ ..Default::default()
+ },
+ );
}
}
diff --git a/crates/openhuman-core/src/web_chat/ops/start_chat.rs b/crates/openhuman-core/src/web_chat/ops/start_chat.rs
index 218e9d9764..7d767110d6 100644
--- a/crates/openhuman-core/src/web_chat/ops/start_chat.rs
+++ b/crates/openhuman-core/src/web_chat/ops/start_chat.rs
@@ -455,27 +455,33 @@ async fn start_chat_inner(
item_id: Some(request_id.clone()),
text_preview: Some(crate::agent::queued_turn::text_preview(&message)),
});
- publish_web_channel_event_in(ctx, WebChannelEvent {
- event: "chat_error".to_string(),
- client_id: client_id.clone(),
- thread_id: thread_id.clone(),
- request_id: cancelled_id.clone(),
- message: Some("Cancelled by newer request".to_string()),
- error_type: Some("cancelled".to_string()),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ ctx,
+ WebChannelEvent {
+ event: "chat_error".to_string(),
+ client_id: client_id.clone(),
+ thread_id: thread_id.clone(),
+ request_id: cancelled_id.clone(),
+ message: Some("Cancelled by newer request".to_string()),
+ error_type: Some("cancelled".to_string()),
+ ..Default::default()
+ },
+ );
// See channel_ops::cancel_chat_inner — `chat_cancelled` is the
// structured successor to `chat_error{error_type:"cancelled"}`,
// kept alongside it for one release.
- publish_web_channel_event_in(ctx, WebChannelEvent {
- event: "chat_cancelled".to_string(),
- client_id: client_id.clone(),
- thread_id: thread_id.clone(),
- request_id: cancelled_id,
- cancel_reason: Some("superseded".to_string()),
- superseded_by: Some(request_id.clone()),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ ctx,
+ WebChannelEvent {
+ event: "chat_cancelled".to_string(),
+ client_id: client_id.clone(),
+ thread_id: thread_id.clone(),
+ request_id: cancelled_id,
+ cancel_reason: Some("superseded".to_string()),
+ superseded_by: Some(request_id.clone()),
+ ..Default::default()
+ },
+ );
}
}
diff --git a/crates/openhuman-core/src/web_chat/ops/state_tests.rs b/crates/openhuman-core/src/web_chat/ops/state_tests.rs
index a30f801a7a..e6893ffb52 100644
--- a/crates/openhuman-core/src/web_chat/ops/state_tests.rs
+++ b/crates/openhuman-core/src/web_chat/ops/state_tests.rs
@@ -89,8 +89,8 @@ async fn a_user_cancel_under_the_fence_placeholder_id_keeps_the_callers_client()
"fence-thread",
None,
)
- .await
- .unwrap();
+ .await
+ .unwrap();
assert!(token.is_cancelled());
let mut seen = None;
diff --git a/crates/openhuman-core/src/web_chat/ops/turn_guards.rs b/crates/openhuman-core/src/web_chat/ops/turn_guards.rs
index 169b377aa6..5b7da8c692 100644
--- a/crates/openhuman-core/src/web_chat/ops/turn_guards.rs
+++ b/crates/openhuman-core/src/web_chat/ops/turn_guards.rs
@@ -43,9 +43,7 @@ fn web_turn_deadline() -> Option<Duration> {
/// explicit `OPENHUMAN_WEB_TURN_TIMEOUT_SECS` override still wins; otherwise the
/// default is the local turn ceiling plus a grace period, never the hosted
/// backstop, which sits below the local harness ceilings and would pre-empt them.
-async fn resolve_web_turn_deadline(
- ctx: &crate::core::runtime::DispatchCtx,
-) -> Option<Duration> {
+async fn resolve_web_turn_deadline(ctx: &crate::core::runtime::DispatchCtx) -> Option<Duration> {
if std::env::var("OPENHUMAN_WEB_TURN_TIMEOUT_SECS").is_ok() {
return web_turn_deadline();
}
diff --git a/crates/openhuman-core/src/web_chat/ops_budget_correlation_tests_tests.rs b/crates/openhuman-core/src/web_chat/ops_budget_correlation_tests_tests.rs
index 5c2c6ec728..5aa554b05c 100644
--- a/crates/openhuman-core/src/web_chat/ops_budget_correlation_tests_tests.rs
+++ b/crates/openhuman-core/src/web_chat/ops_budget_correlation_tests_tests.rs
@@ -65,7 +65,13 @@ async fn record_then_fresh_then_clear() {
async fn stale_signal_is_not_fresh_and_is_evicted() {
let thread = "budget-corr-test-stale";
// Seed a signal older than the TTL.
- record_budget_signal_aged(&ctx(), thread, BINDING, BUDGET_SIGNAL_TTL + Duration::from_secs(1)).await;
+ record_budget_signal_aged(
+ &ctx(),
+ thread,
+ BINDING,
+ BUDGET_SIGNAL_TTL + Duration::from_secs(1),
+ )
+ .await;
// Reads as not-fresh and self-evicts.
assert!(!has_fresh_budget_signal(&ctx(), thread, BINDING).await);
// Confirm eviction: still not fresh, and a later in-window seed works.
@@ -96,7 +102,8 @@ async fn record_prunes_other_threads_stale_entries() {
let abandoned = "budget-corr-test-abandoned";
let active = "budget-corr-test-active";
// An abandoned thread leaves a stale entry behind...
- record_budget_signal_aged(&ctx(),
+ record_budget_signal_aged(
+ &ctx(),
abandoned,
BINDING,
BUDGET_SIGNAL_TTL + Duration::from_secs(1),
diff --git a/crates/openhuman-core/src/web_chat/presentation.rs b/crates/openhuman-core/src/web_chat/presentation.rs
index af8d6e5200..2a44d9e2b8 100644
--- a/crates/openhuman-core/src/web_chat/presentation.rs
+++ b/crates/openhuman-core/src/web_chat/presentation.rs
@@ -219,50 +219,53 @@ fn publish_chat_done(
usage_payload: Option<TurnUsagePayload>,
timing_payload: Option<crate::web_chat::TurnTimingPayload>,
) {
- publish_web_channel_event_in(ctx, WebChannelEvent {
- event: "chat_done".to_string(),
- client_id: client_id.to_string(),
- thread_id: thread_id.to_string(),
- request_id: request_id.to_string(),
- full_response: Some(full_response.to_string()),
- message: None,
- error_type: None,
- error_source: None,
- error_retryable: None,
- error_retry_after_ms: None,
- error_provider: None,
- error_fallback_available: None,
- copy_key: None,
- copy_params: None,
- tool_name: None,
- skill_id: None,
- args: None,
- output: None,
- success: None,
- round: None,
- segment_index: None,
- segment_total: None,
- delta: None,
- delta_kind: None,
- tool_call_id: None,
- failure: None,
- subagent: None,
- tool_display_label: None,
- tool_display_detail: None,
- elapsed_ms: None,
- structured: None,
- citations: if citations.is_empty() {
- None
- } else {
- Some(serde_json::json!(citations))
+ publish_web_channel_event_in(
+ ctx,
+ WebChannelEvent {
+ event: "chat_done".to_string(),
+ client_id: client_id.to_string(),
+ thread_id: thread_id.to_string(),
+ request_id: request_id.to_string(),
+ full_response: Some(full_response.to_string()),
+ message: None,
+ error_type: None,
+ error_source: None,
+ error_retryable: None,
+ error_retry_after_ms: None,
+ error_provider: None,
+ error_fallback_available: None,
+ copy_key: None,
+ copy_params: None,
+ tool_name: None,
+ skill_id: None,
+ args: None,
+ output: None,
+ success: None,
+ round: None,
+ segment_index: None,
+ segment_total: None,
+ delta: None,
+ delta_kind: None,
+ tool_call_id: None,
+ failure: None,
+ subagent: None,
+ tool_display_label: None,
+ tool_display_detail: None,
+ elapsed_ms: None,
+ structured: None,
+ citations: if citations.is_empty() {
+ None
+ } else {
+ Some(serde_json::json!(citations))
+ },
+ usage: usage_payload,
+ timing: timing_payload,
+ // Terminal delivery events are emitted outside the seq-stamping
+ // progress bridge; leave `seq` unset (older clients ignore it).
+ seq: None,
+ ..Default::default()
},
- usage: usage_payload,
- timing: timing_payload,
- // Terminal delivery events are emitted outside the seq-stamping
- // progress bridge; leave `seq` unset (older clients ignore it).
- seq: None,
- ..Default::default()
- });
+ );
}
#[cfg(any(test, debug_assertions))]
diff --git a/crates/openhuman-core/src/web_chat/presentation_tests.rs b/crates/openhuman-core/src/web_chat/presentation_tests.rs
index 8efe514365..70389f8645 100644
--- a/crates/openhuman-core/src/web_chat/presentation_tests.rs
+++ b/crates/openhuman-core/src/web_chat/presentation_tests.rs
@@ -9,7 +9,14 @@ fn single_bubble_delivery_emits_one_unsegmented_chat_done() {
Nothing needs input from you right now, so I have not rescheduled anything on your behalf.";
let request_id = format!("single-bubble-{}", uuid::Uuid::new_v4());
- deliver_response_single_bubble(&crate::core::runtime::DispatchCtx::ambient(), "system", "thread-1", &request_id, text, None);
+ deliver_response_single_bubble(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ "system",
+ "thread-1",
+ &request_id,
+ text,
+ None,
+ );
// Other tests publish on the same process-global bus; keep only ours.
let mut mine = Vec::new();
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge.rs b/crates/openhuman-core/src/web_chat/progress_bridge.rs
index 61cf672675..a7c71d7e69 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge.rs
@@ -284,7 +284,8 @@ pub(crate) fn spawn_progress_bridge(
request_id: String,
turn_state_store: std::sync::Arc<dyn TurnStates>,
metadata: ChatRequestMetadata,
- config: crate::config::Config, dispatch_ctx: crate::core::runtime::DispatchCtx,
+ config: crate::config::Config,
+ dispatch_ctx: crate::core::runtime::DispatchCtx,
) -> ProgressBridgeHandle {
use crate::agent::progress::AgentProgress;
use std::collections::HashMap;
@@ -1188,7 +1189,11 @@ pub(crate) fn spawn_progress_bridge(
let live_spans = collector.spans().to_vec();
let journal_export = if let Some(trace_ctx) = journal_trace_ctx.take() {
super::journal_shadow::shadow_compare_journal_projection(
- &dispatch_ctx, &request_id, trace_ctx.clone(), parent_max_iterations, &live_spans,
+ &dispatch_ctx,
+ &request_id,
+ trace_ctx.clone(),
+ parent_max_iterations,
+ &live_spans,
)
.await
.map(|observations| (trace_ctx, observations))
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs b/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
index e5c1d707f5..531b57c308 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
@@ -114,7 +114,8 @@ async fn tool_call_completed_forwards_real_output_on_tool_result() {
"req-out".into(),
store,
ChatRequestMetadata::default(),
- config, crate::core::runtime::DispatchCtx::ambient(),
+ config,
+ crate::core::runtime::DispatchCtx::ambient(),
);
tx.send(crate::agent::progress::AgentProgress::ToolCallCompleted {
@@ -226,7 +227,8 @@ fn spawn_test_bridge(
request_id.to_string(),
store,
ChatRequestMetadata::default(),
- Config::default(), crate::core::runtime::DispatchCtx::ambient(),
+ Config::default(),
+ crate::core::runtime::DispatchCtx::ambient(),
);
tx
}
@@ -421,7 +423,8 @@ async fn wait_drained_returns_after_queued_events_are_forwarded() {
"req-drain".into(),
store,
ChatRequestMetadata::default(),
- drain_test_config(&tmp), crate::core::runtime::DispatchCtx::ambient(),
+ drain_test_config(&tmp),
+ crate::core::runtime::DispatchCtx::ambient(),
);
tx.send(AgentProgress::ToolCallCompleted {
@@ -478,7 +481,8 @@ async fn wait_drained_is_bounded_when_the_turn_never_completes() {
"req-drain-timeout".into(),
store,
ChatRequestMetadata::default(),
- drain_test_config(&tmp), crate::core::runtime::DispatchCtx::ambient(),
+ drain_test_config(&tmp),
+ crate::core::runtime::DispatchCtx::ambient(),
);
assert!(!handle.wait_drained(Duration::from_millis(50)).await);
// Closing the channel ends the bridge, which counts as drained.
@@ -503,7 +507,8 @@ async fn short_narration_is_flushed_on_the_rounds_first_tool_call() {
"req-short".into(),
store,
ChatRequestMetadata::default(),
- drain_test_config(&tmp), crate::core::runtime::DispatchCtx::ambient(),
+ drain_test_config(&tmp),
+ crate::core::runtime::DispatchCtx::ambient(),
);
tx.send(AgentProgress::TextDelta {
delta: "Let me check.".into(),
@@ -699,7 +704,8 @@ async fn hold_text_stream_suppresses_text_delta_but_keeps_interim() {
hold_text_stream: true,
..Default::default()
},
- config, crate::core::runtime::DispatchCtx::ambient(),
+ config,
+ crate::core::runtime::DispatchCtx::ambient(),
);
tx.send(AgentProgress::TextDelta {
diff --git a/crates/openhuman-core/src/web_chat/run_task.rs b/crates/openhuman-core/src/web_chat/run_task.rs
index 45d19bc55f..d1ab7aae51 100644
--- a/crates/openhuman-core/src/web_chat/run_task.rs
+++ b/crates/openhuman-core/src/web_chat/run_task.rs
@@ -233,7 +233,8 @@ pub(crate) async fn run_chat_task(
// Only consult the cross-turn signal for an empty response that is
// not already a budget error — avoids taking the lock on every turn.
let has_fresh_signal = if !is_budget && is_empty {
- super::ops::has_fresh_budget_signal(ctx, thread_id, &current_fp.provider_binding).await
+ super::ops::has_fresh_budget_signal(ctx, thread_id, &current_fp.provider_binding)
+ .await
} else {
false
};
@@ -243,7 +244,8 @@ pub(crate) async fn run_chat_task(
// so a follow-up empty 200 on this thread+provider (managed
// route closes the SSE clean under credit exhaustion, no
// inline marker) reclassifies as budget. #3386.
- super::ops::record_budget_signal(ctx, thread_id, &current_fp.provider_binding).await;
+ super::ops::record_budget_signal(ctx, thread_id, &current_fp.provider_binding)
+ .await;
log::warn!(
"[web-channel] inference budget exhausted for client={} thread={} request_id={} error_category=budget_exhausted",
client_id,
diff --git a/crates/openhuman-core/src/web_chat/schemas.rs b/crates/openhuman-core/src/web_chat/schemas.rs
index 55ea5d4022..31a4edee40 100644
--- a/crates/openhuman-core/src/web_chat/schemas.rs
+++ b/crates/openhuman-core/src/web_chat/schemas.rs
@@ -215,7 +215,9 @@ fn handle_queue_remove(ctx: DispatchCtx, params: Map<String, Value>) -> Controll
fn handle_cancel(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let p = deserialize_params::<WebCancelParams>(params)?;
- to_json(channel_web_cancel(&ctx, &p.client_id, &p.thread_id, p.request_id.as_deref()).await?)
+ to_json(
+ channel_web_cancel(&ctx, &p.client_id, &p.thread_id, p.request_id.as_deref()).await?,
+ )
})
}
diff --git a/crates/openhuman-core/src/web_chat/session_checkout_tests.rs b/crates/openhuman-core/src/web_chat/session_checkout_tests.rs
index 602ef50bf0..4cc68e2027 100644
--- a/crates/openhuman-core/src/web_chat/session_checkout_tests.rs
+++ b/crates/openhuman-core/src/web_chat/session_checkout_tests.rs
@@ -127,7 +127,8 @@ async fn checkout_cold_boots_from_the_thread_transcript_and_checkin_keeps_it_war
mut agent,
fingerprint,
} = checkout_session_agent(
- &DispatchCtx::ambient(), &config,
+ &DispatchCtx::ambient(),
+ &config,
super::super::SYSTEM_CLIENT_ID,
&thread_id,
None,
@@ -160,7 +161,8 @@ async fn checkout_cold_boots_from_the_thread_transcript_and_checkin_keeps_it_war
// The next checkout — a user turn — reuses the warm agent with that history.
let CheckedOutSession { agent, .. } = checkout_session_agent(
- &DispatchCtx::ambient(), &config,
+ &DispatchCtx::ambient(),
+ &config,
"client-1",
&thread_id,
None,
@@ -195,15 +197,28 @@ async fn checkin_if_vacant_yields_to_a_turn_that_re_cached_meanwhile() {
// A user turn finished while the system turn was running and cached its
// agent unconditionally.
let user_turn_agent = host_seeded_with(&config, "user-turn-history");
- checkin_session_agent(&DispatchCtx::ambient(), &thread_id, user_turn_agent, fingerprint(&config)).await;
+ checkin_session_agent(
+ &DispatchCtx::ambient(),
+ &thread_id,
+ user_turn_agent,
+ fingerprint(&config),
+ )
+ .await;
// The system turn must not clobber it.
let system_turn_agent = host_seeded_with(&config, "system-turn-history");
assert!(
- !checkin_session_agent_if_vacant(&DispatchCtx::ambient(), &thread_id, system_turn_agent, fingerprint(&config)).await
+ !checkin_session_agent_if_vacant(
+ &DispatchCtx::ambient(),
+ &thread_id,
+ system_turn_agent,
+ fingerprint(&config)
+ )
+ .await
);
let CheckedOutSession { agent, .. } = checkout_session_agent(
- &DispatchCtx::ambient(), &config,
+ &DispatchCtx::ambient(),
+ &config,
"client-1",
&thread_id,
None,
@@ -218,10 +233,17 @@ async fn checkin_if_vacant_yields_to_a_turn_that_re_cached_meanwhile() {
// Into a vacant slot it goes in.
let system_turn_agent = host_seeded_with(&config, "system-turn-history");
assert!(
- checkin_session_agent_if_vacant(&DispatchCtx::ambient(), &thread_id, system_turn_agent, fingerprint(&config)).await
+ checkin_session_agent_if_vacant(
+ &DispatchCtx::ambient(),
+ &thread_id,
+ system_turn_agent,
+ fingerprint(&config)
+ )
+ .await
);
let CheckedOutSession { agent, .. } = checkout_session_agent(
- &DispatchCtx::ambient(), &config,
+ &DispatchCtx::ambient(),
+ &config,
"client-1",
&thread_id,
None,
@@ -243,14 +265,16 @@ async fn a_fork_never_takes_or_returns_the_cached_agent() {
let fingerprint =
super::build_session_fingerprint(&config, None, None, "orchestrator".into(), "chat");
checkin_session_agent(
- &DispatchCtx::ambient(), &thread_id,
+ &DispatchCtx::ambient(),
+ &thread_id,
host_seeded_with(&config, "primary-history"),
fingerprint,
)
.await;
let CheckedOutSession { agent, .. } = checkout_session_agent(
- &DispatchCtx::ambient(), &config,
+ &DispatchCtx::ambient(),
+ &config,
"client-1",
&thread_id,
None,
@@ -280,14 +304,16 @@ async fn a_system_turn_adopts_the_cached_agent_and_its_fingerprint() {
let pinned =
super::build_session_fingerprint(&config, None, Some(0.2), "orchestrator".into(), "chat");
checkin_session_agent(
- &DispatchCtx::ambient(), &thread_id,
+ &DispatchCtx::ambient(),
+ &thread_id,
host_seeded_with(&config, "pinned-history"),
pinned.clone(),
)
.await;
let CheckedOutSession { agent, fingerprint } = checkout_session_agent(
- &DispatchCtx::ambient(), &config,
+ &DispatchCtx::ambient(),
+ &config,
super::super::SYSTEM_CLIENT_ID,
&thread_id,
None,
@@ -303,7 +329,8 @@ async fn a_system_turn_adopts_the_cached_agent_and_its_fingerprint() {
// An exact user checkout with the same settings then still hits warm.
checkin_session_agent_if_vacant(&DispatchCtx::ambient(), &thread_id, agent, fingerprint).await;
let CheckedOutSession { agent, .. } = checkout_session_agent(
- &DispatchCtx::ambient(), &config,
+ &DispatchCtx::ambient(),
+ &config,
"client-1",
&thread_id,
None,
@@ -327,7 +354,8 @@ async fn a_thread_binds_one_stable_session_across_cold_boots() {
let thread_id = unique_thread("stable");
let first = checkout_session_agent(
- &DispatchCtx::ambient(), &config,
+ &DispatchCtx::ambient(),
+ &config,
"client-1",
&thread_id,
None,
@@ -339,7 +367,8 @@ async fn a_thread_binds_one_stable_session_across_cold_boots() {
.unwrap();
// Nothing is checked back in, so the next checkout is a genuine cold boot.
let second = checkout_session_agent(
- &DispatchCtx::ambient(), &config,
+ &DispatchCtx::ambient(),
+ &config,
"client-1",
&thread_id,
None,
@@ -566,14 +595,16 @@ async fn a_system_turn_never_adopts_an_agent_from_another_workspace() {
let built_for_a =
super::build_session_fingerprint(&config_a, None, None, "orchestrator".into(), "chat");
checkin_session_agent(
- &DispatchCtx::ambient(), &thread_id,
+ &DispatchCtx::ambient(),
+ &thread_id,
host_seeded_with(&config_a, "user-a-history"),
built_for_a,
)
.await;
let CheckedOutSession { agent, fingerprint } = checkout_session_agent(
- &DispatchCtx::ambient(), &config_b,
+ &DispatchCtx::ambient(),
+ &config_b,
super::super::SYSTEM_CLIENT_ID,
&thread_id,
None,
@@ -615,7 +646,8 @@ async fn each_checkout_arms_the_reply_language_from_its_own_locale() {
let thread_id = thread_id.clone();
async move {
checkout_session_agent(
- &DispatchCtx::ambient(), &config,
+ &DispatchCtx::ambient(),
+ &config,
"client-1",
&thread_id,
None,
@@ -675,7 +707,8 @@ async fn an_english_only_session_and_a_locale_less_turn_carry_no_directive() {
let thread_id = unique_thread("english");
for locale in [Some("en"), None] {
let CheckedOutSession { agent, fingerprint } = checkout_session_agent(
- &DispatchCtx::ambient(), &config,
+ &DispatchCtx::ambient(),
+ &config,
"client-1",
&thread_id,
None,
diff --git a/crates/openhuman-core/src/web_chat/suggestions.rs b/crates/openhuman-core/src/web_chat/suggestions.rs
index ea86ab1c46..1926d7c7bc 100644
--- a/crates/openhuman-core/src/web_chat/suggestions.rs
+++ b/crates/openhuman-core/src/web_chat/suggestions.rs
@@ -189,14 +189,17 @@ async fn generate_and_emit(
request_id={request_id} count={}",
suggestions.len()
);
- publish_web_channel_event_in(ctx, WebChannelEvent {
- event: "chat_suggestions".to_string(),
- client_id: client_id.to_string(),
- thread_id: thread_id.to_string(),
- turn_request_id: Some(request_id.to_string()),
- suggestions: Some(suggestions),
- ..Default::default()
- });
+ publish_web_channel_event_in(
+ ctx,
+ WebChannelEvent {
+ event: "chat_suggestions".to_string(),
+ client_id: client_id.to_string(),
+ thread_id: thread_id.to_string(),
+ turn_request_id: Some(request_id.to_string()),
+ suggestions: Some(suggestions),
+ ..Default::default()
+ },
+ );
}
fn build_suggestions_request(user_message: &str, assistant_message: &str) -> ModelRequest {
diff --git a/crates/openhuman-core/src/web_chat/suggestions_tests.rs b/crates/openhuman-core/src/web_chat/suggestions_tests.rs
index 88df82cf1c..55d55e23bf 100644
--- a/crates/openhuman-core/src/web_chat/suggestions_tests.rs
+++ b/crates/openhuman-core/src/web_chat/suggestions_tests.rs
@@ -123,7 +123,7 @@ async fn emits_chat_suggestions_for_a_well_formed_reply() {
let thread_id = "sugg-thread-ok";
generate_and_emit(
-&crate::core::runtime::DispatchCtx::ambient(),
+ &crate::core::runtime::DispatchCtx::ambient(),
"client-1",
thread_id,
"req-1",
@@ -151,7 +151,7 @@ async fn drops_silently_when_the_model_returns_garbage() {
let thread_id = "sugg-thread-garbage";
generate_and_emit(
-&crate::core::runtime::DispatchCtx::ambient(),
+ &crate::core::runtime::DispatchCtx::ambient(),
"client-1",
thread_id,
"req-2",
@@ -175,7 +175,7 @@ async fn skips_when_the_user_message_is_too_short() {
}));
generate_and_emit(
-&crate::core::runtime::DispatchCtx::ambient(),
+ &crate::core::runtime::DispatchCtx::ambient(),
"client-1",
"sugg-thread-short",
"req-3",
diff --git a/crates/openhuman-core/src/web_chat/web_tests_rate_limit_classification_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_rate_limit_classification_tests.rs
index 399f524198..b92edbebfc 100644
--- a/crates/openhuman-core/src/web_chat/web_tests_rate_limit_classification_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests_rate_limit_classification_tests.rs
@@ -185,7 +185,7 @@ async fn start_chat_chat_error_event_serializes_structured_fields_to_json_wire()
let mut rx = subscribe_web_channel_events();
let request_id = start_chat(
-&crate::core::runtime::DispatchCtx::ambient(),
+ &crate::core::runtime::DispatchCtx::ambient(),
"wire-shape-client",
"wire-shape-thread",
"Please summarize this in one line.",
@@ -280,7 +280,7 @@ async fn start_chat_emits_structured_rate_limit_metadata_on_chat_error_event() {
let mut rx = subscribe_web_channel_events();
let request_id = start_chat(
-&crate::core::runtime::DispatchCtx::ambient(),
+ &crate::core::runtime::DispatchCtx::ambient(),
"rate-limit-client",
"rate-limit-thread",
"Please summarize this in one line.",