Skip to content

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

fix(chat): add ChatCancelledEvent import and replace inline throttle with TurnCostThrottle

Steven Enamakel9f9ddc1a4fc6
diff --git a/app/src/providers/ChatRuntimeProvider.tsx b/app/src/providers/ChatRuntimeProvider.tsx
index 214e2dc9cc..6ec8552142 100644
--- a/app/src/providers/ChatRuntimeProvider.tsx
+++ b/app/src/providers/ChatRuntimeProvider.tsx
@@ -14,6 +14,7 @@ import { maybeParseWorkflowProposalTool } from '../lib/workflows/workflowProposa
import {
type ChatApprovalDecidedEvent,
type ChatApprovalRequestEvent,
+ type ChatCancelledEvent,
type ChatDoneEvent,
type ChatErrorEvent,
type ChatInferenceHeartbeatEvent,
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge.rs b/crates/openhuman-core/src/web_chat/progress_bridge.rs
index 44a45a0fc8..b87f600b16 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge.rs
@@ -349,15 +349,7 @@ pub(crate) fn spawn_progress_bridge(
// (it belongs to the terminal round, which ends with no tool call).
let mut pending_narration = String::new();
let mut timing = super::turn_timing::TurnTiming::start();
- // Throttle for the live `turn_cost` socket event below: a multi-round
- // turn can report a `TurnCostUpdated` on every model call, and a
- // fast-tool-calling round can do that several times a second — far
- // more often than a cost readout needs to repaint. Unconditionally
- // `None` initially so the *first* update of a turn always emits
- // immediately rather than waiting out the interval.
- let mut last_turn_cost_emit: Option<std::time::Instant> = None;
- const TURN_COST_EMIT_MIN_INTERVAL: std::time::Duration =
- std::time::Duration::from_millis(750);
+ let mut turn_cost_throttle = super::turn_timing::TurnCostThrottle::new();
let mut events_seen: u64 = 0;
// Per-request monotonic ordering key stamped on every emitted
// web-channel event (see `publish_seq_stamped`). Unique per emission so