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: archived check ahead of the provider branches; the notice is routed, not dropped into an inbox

Gastón Péchieue1c216c9bf1e
diff --git a/src/main/hive.ts b/src/main/hive.ts
index 68a8ef1a..cd067e36 100644
--- a/src/main/hive.ts
+++ b/src/main/hive.ts
@@ -1592,6 +1592,39 @@ export class HiveManager {
}, godId);
continue;
}
+ // An ARCHIVED recipient (its terminal is gone) still has an inbox, so the
+ // mail lands there and reads as delivered — and stays unread. Filing it
+ // is right: a worker re-hired under the same id reads it on its first turn
+ // (a released worker's inbox is settled only up to its done signal). But
+ // the sender learned nothing, so god kept mailing dead agents for hours
+ // (seen live 2026-08-16), and a request to a worker nobody re-hires was
+ // simply lost. Now mail that expects an answer is filed AND its sender is
+ // told, at once, that no one is there to answer it. Inform-only mail
+ // (status, done, agree) is filed quietly. This comes BEFORE the provider
+ // branches below on purpose: with no terminal there is nothing to hand a
+ // work order to, whatever the engine — the inbox is the only place left.
+ // The notice itself is ROUTED, not dropped into an inbox, so a sender on
+ // a hookless or proxy-tier engine gets it the way it gets any mail.
+ if (t !== godId && reg.agents[t]?.archived) {
+ if (this.deliver(msg, t)) delivered.push(t);
+ this.appendLog({ kind: 'archived-recipient', from: msg.from, to: t, id: msg.id, act: msg.act });
+ const sender = reg.agents[msg.from];
+ if (msg.requires_reply && sender && !sender.archived) {
+ this.routeMessage(this.normalize({
+ to: msg.from,
+ act: 'inform',
+ in_reply_to: msg.id,
+ conversation: msg.conversation,
+ hops: msg.hops + 1,
+ requires_reply: false,
+ subject: `[no one is there to answer — "${t}" is archived] ${msg.subject}`,
+ body: `Your ${msg.act} to ${t} was filed in its inbox, but ${t} has no live terminal (archived), `
+ + `so it will only be read if ${t} is restored or re-hired under the same id. `
+ + 'If you need this done now, route it to an agent on the live roster or hire one.'
+ }, 'system'));
+ }
+ continue;
+ }
// A provider without safe-idle lifecycle state (a hookless custom command)
// would let direct mail rot unread. Claude and bridged Antigravity/Codex
// receive directly into inbox/ for guarded renderer delivery. Otherwise try
@@ -1624,35 +1657,6 @@ export class HiveManager {
} else delivered.push(t);
continue;
}
- // An ARCHIVED recipient (its terminal is gone) still has an inbox, so the
- // mail lands there and reads as delivered — and stays unread. Filing it
- // is right: a worker re-hired under the same id reads it on its first turn
- // (a released worker's inbox is settled only up to its done signal). But
- // the sender learned nothing, so god kept mailing dead agents for hours
- // (seen live 2026-08-16), and a request to a worker nobody re-hires was
- // simply lost. Now mail that expects an answer is filed AND its sender is
- // told, at once, that no one is there to answer it. Inform-only mail
- // (status, done, agree) is filed quietly.
- if (t !== godId && reg.agents[t]?.archived) {
- if (this.deliver(msg, t)) delivered.push(t);
- this.appendLog({ kind: 'archived-recipient', from: msg.from, to: t, id: msg.id, act: msg.act });
- const sender = reg.agents[msg.from];
- if (msg.requires_reply && sender && !sender.archived && msg.from !== t) {
- this.deliver(this.normalize({
- to: msg.from,
- act: 'inform',
- in_reply_to: msg.id,
- conversation: msg.conversation,
- hops: msg.hops + 1,
- requires_reply: false,
- subject: `[no one is there to answer — "${t}" is archived] ${msg.subject}`,
- body: `Your ${msg.act} to ${t} was filed in its inbox, but ${t} has no live terminal (archived), `
- + `so it will only be read if ${t} is restored or re-hired under the same id. `
- + 'If you need this done now, route it to an agent on the live roster or hire one.'
- }, 'system'), msg.from);
- }
- continue;
- }
if (this.deliver(msg, t)) { delivered.push(t); continue; }
// No agents/<t>/inbox — an id that isn't on the floor. This was the one
// delivery failure with neither bounce nor log, so the sender saw a routed
diff --git a/test/hive-archived-recipient.test.cjs b/test/hive-archived-recipient.test.cjs
index beacac4c..03d6befa 100644
--- a/test/hive-archived-recipient.test.cjs
+++ b/test/hive-archived-recipient.test.cjs
@@ -79,6 +79,29 @@ test('a live agent other than god is informed the same way; a sender off the ros
assert.equal(hive.inbox('worker-jim').length, 2);
});
+// The archived check runs BEFORE the provider branches: an archived agent on a
+// hookless engine used to be handed a terminal work order (there is no
+// terminal) instead of having the mail filed, and its sender heard nothing.
+// The notice is routed like any mail, so a sender on such an engine is told the
+// way it is told anything else (terminal handoff, or the god bounce when no
+// renderer is there to type it).
+test('an archived agent on a hookless engine is filed and its sender told; a hookless sender is told through routing', async (t) => {
+ const { hive, home } = await floor(t);
+ await hive.ensureAgent({ id: 'worker-toby', name: 'Toby', provider: 'custom', cwd: home });
+ hive.setArchived('worker-toby', true);
+ const sent = hive.send({ to: 'worker-toby', act: 'request', subject: 'HR audit', body: '' }, 'god-1');
+ assert.deepEqual(hive.inbox('worker-toby').map((m) => m.id), [sent.id], 'filed in the inbox, not handed to a terminal that is gone');
+ assert.equal(hive.inbox('god-1').length, 1, 'the sender is told');
+ assert.equal(entries(hive, 'archived-recipient').length, 1);
+
+ await hive.ensureAgent({ id: 'creed-1', name: 'Creed', provider: 'custom', cwd: home });
+ const fromCreed = hive.send({ to: 'worker-jim', act: 'query', subject: 'still there?', body: '' }, 'creed-1');
+ const routed = entries(hive, 'message').filter((e) => e.from === 'system' && e.to === 'creed-1' && e.act === 'inform');
+ assert.equal(routed.length, 1, 'the notice to a hookless sender goes through routeMessage, not straight into an inbox nobody drains');
+ assert.equal(hive.inbox('creed-1').length, 0, 'so it is not left rotting in creed\'s inbox');
+ assert.ok(fromCreed.id, 'the original query itself was routed');
+});
+
test('once the agent is back on the floor, mail to it is ordinary again', async (t) => {
const { hive } = await floor(t);
hive.setArchived('worker-jim', false);