Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

review: NaN guard on the renderer gauge handler + intent comment on the Status early-return

Gulum9ee73c58da00
diff --git a/src/main/hooks.ts b/src/main/hooks.ts
index fbac95ad..4ed79aed 100644
--- a/src/main/hooks.ts
+++ b/src/main/hooks.ts
@@ -104,7 +104,11 @@ export class HookServer {
// exposes). Forward to the renderer for the agent-card context gauge.
// Handled FIRST and returned early: this is pure telemetry from the
// statusLine shim, not a real hook boundary — it must never trip the
- // HALT gate or feed the breaker's loop detector below.
+ // HALT gate or feed the breaker's loop detector below. The early return
+ // also (deliberately) skips recordSession for status ticks: a statusLine
+ // payload's session_id adds nothing the real hooks don't already record,
+ // and telemetry should never write to the registry. transcript_path IS
+ // still captured above, where every payload shape benefits from it.
if (event === 'Status') {
const cw = p.context_window;
if (agentId && cw && typeof cw.total_input_tokens === 'number'
diff --git a/src/renderer/src/hooks/useHive.ts b/src/renderer/src/hooks/useHive.ts
index f12db5af..88d2e45d 100644
--- a/src/renderer/src/hooks/useHive.ts
+++ b/src/renderer/src/hooks/useHive.ts
@@ -382,6 +382,10 @@ export function useHive(config: HarnessConfig | null): void {
// response — no probing, no transcript guesswork.
useEffect(() => {
return window.cth.onHiveContextUpdate(({ agentId, tokens, limit }) => {
+ // Defense-in-depth: the main process already filters limit > 0, but the
+ // renderer must not trust IPC blindly — limit 0 would put NaN progress
+ // into the store (NaN survives the Math.min/max clamp).
+ if (!Number.isFinite(limit) || limit <= 0 || !Number.isFinite(tokens)) return;
const progress = Math.max(0, Math.min(8, Math.round((tokens / limit) * 8)));
useStore.getState().updateAgent(agentId, { contextTokens: tokens, contextLimit: limit, progress });
});