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

merge PR #130: fix(inbox): stop one odd message id from silencing an agent's wake nudge

Chaitanya Giriaacbdc380db4
diff --cc src/renderer/src/hooks/useHive.ts
index 21a4e803,d84e1458..752a8142
--- a/src/renderer/src/hooks/useHive.ts
+++ b/src/renderer/src/hooks/useHive.ts
@@@ -253,14 -253,20 +253,24 @@@ function passesContextPressure(a: Agent
* doesn't stall while an agent sits at its prompt.
*/
export function useHive(config: HarnessConfig | null): void {
- // Per-agent dedup key for the inbox-wake nudge: the newest inbox message id we
- // last nudged about. Keyed by id (not count) so an oscillating count after a
- // drain doesn't re-nudge for the same message set.
- const nudged = useRef<Record<string, string>>({});
+ // Per-agent dedup for the inbox-wake nudge: every inbox message id we have
+ // already nudged this agent about. A SET, not a high-water mark.
+ //
+ // This used to hold one string — the lexicographically largest id in the inbox,
+ // read as "the newest". Message ids are usually `<timestamp>-<rand>`, so that
+ // held, but an agent may set its own `id` in the outbox JSON and the hive keeps
+ // it verbatim (hive.ts normalize: `partial.id ?? ...`). One such id in god's
+ // inbox — `dev15-progress-canvas-v4` — sorts above EVERY `2026-*` timestamp and
+ // never drains, so the "newest" id was frozen on it: Michael was nudged once per
+ // app launch and then never again, however much real mail piled up behind it.
+ // Tracking the ids we have seen has no such ordering assumption, and it keeps
+ // the property the high-water mark was there for — a set that only shrinks as
+ // messages drain contains nothing new, so it does not re-nudge.
+ const nudged = useRef<Record<string, Set<string>>>({});
+ // Per-agent context size at the last auto-/compact queued. See the latch note
+ // in the context-trigger effect: an idle agent's token count is frozen, so
+ // without this the pressure gate re-fires on the identical number every cycle.
+ const lastCompactUsed = useRef<Record<string, number>>({});
// Per-agent timestamp of the last queued-message we submitted. Guards against
// re-sending the next message before the agent's hooks have flipped it to
// 'working' (there's a short window where it still reads 'idle' right after we