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
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
fix(cost-ledger): only write a row for a live session sample (#56)
Chaitanya Giri650c568437e8
diff --git a/src/main/index.ts b/src/main/index.tsindex 0e3deb0e..c0a4914d 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -428,7 +428,14 @@ function runBreakerBeat(progressWindowMs: number): void {for (const [id, a] of Object.entries(reg.agents)) {if (a.archived) continue;const sample = usageProvider.getAgentUsage(id);- if (sample) hive.appendCostLedger(sample); // ledger covers everyone incl. god+ // #56: only append a ledger row for a LIVE session sample. A dead/orphaned+ // agent with a frozen transcript still yields a sample via the transcript+ // fallback, but with an EMPTY sessionId (aggregateLive returns null → no live+ // OTel session). Appending it every ~30s rewrote the identical row forever+ // (2,417 dupes observed). A truthy sessionId is set only by a live session+ // (aggregateLive picks the most-recent live session id), so this gates on+ // "is there a live session" without changing any live-agent behavior.+ if (sample?.sessionId) hive.appendCostLedger(sample); // ledger covers everyone incl. godif (id === reg.godId) continue; // breaker skips godinputs.push({ agentId: id, sample, progressing: now - lastCoordinationAt(id) < progressWindowMs });}