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

fix(hive): route non-Claude (Codex) agent tasks to their REPL instead of bouncing

Chaitanya Giri1d7b71b329c2
diff --git a/src/main/hive.ts b/src/main/hive.ts
index ab7466d8..8aa11897 100644
--- a/src/main/hive.ts
+++ b/src/main/hive.ts
@@ -564,11 +564,12 @@ export class HiveManager {
for (const t of targets) {
const target = reg.agents[t];
if (target && !isClaudeProvider(target.provider ?? 'claude')) {
- this.deliver({
- ...msg,
- to: godId,
- subject: `[bounced — "${t}" uses ${target.provider ?? 'custom'}; route via its terminal, not hive inbox] ${msg.subject}`
- }, godId);
+ // Route non-Claude (e.g. Codex) agent tasks directly to their REPL
+ // instead of bouncing. The renderer enqueues the raw text; the drain
+ // effect types it into the agent's terminal when it next goes idle.
+ // Codex gets no inbox nudge or /compact — only the task body verbatim.
+ const text = [msg.subject, '', msg.body].filter(Boolean).join('\n');
+ this.emit?.('hive:enqueueToAgent', { targetId: t, text });
continue;
}
this.deliver(msg, t);
diff --git a/src/preload/index.ts b/src/preload/index.ts
index 8d78604b..3dc68922 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -414,6 +414,14 @@ const api = {
ipcRenderer.on('hive:message', listener);
return () => ipcRenderer.removeListener('hive:message', listener);
},
+ /** Register a listener for hive tasks routed to non-Claude agents (e.g.
+ * Codex). Main emits this instead of bouncing; the renderer enqueues the
+ * raw text so the drain effect types it into the agent's REPL when idle. */
+ onHiveEnqueue: (cb: (e: { targetId: string; text: string }) => void): (() => void) => {
+ const listener = (_e: IpcRendererEvent, payload: { targetId: string; text: string }) => cb(payload);
+ ipcRenderer.on('hive:enqueueToAgent', listener);
+ return () => ipcRenderer.removeListener('hive:enqueueToAgent', listener);
+ },
// ─── Quit confirmation ───────────────────────────────────────────────────
onCloseRequested: (cb: (info: { ptyCount: number }) => void): (() => void) => {
diff --git a/src/renderer/src/hooks/useHive.ts b/src/renderer/src/hooks/useHive.ts
index 531973fb..f89865bf 100644
--- a/src/renderer/src/hooks/useHive.ts
+++ b/src/renderer/src/hooks/useHive.ts
@@ -460,6 +460,19 @@ export function useHive(config: HarnessConfig | null): void {
});
}, [config?.onboardingComplete]);
+ // 5b) Pipe hive tasks addressed to non-Claude agents (e.g. Codex) into their
+ // terminal queues. When main routes a message to a non-claude provider it
+ // emits 'hive:enqueueToAgent' instead of bouncing; we enqueue the raw
+ // task text here so effect #4 types it into the REPL when the agent idles.
+ // No inbox nudge, no /compact — just the verbatim subject+body text.
+ useEffect(() => {
+ if (!config?.onboardingComplete) return;
+ return window.cth.onHiveEnqueue?.((msg) => {
+ if (!msg?.targetId || !msg?.text?.trim()) return;
+ useStore.getState().enqueueMessage(msg.targetId, msg.text.trim());
+ });
+ }, [config?.onboardingComplete]);
+
// 6) Auto-compact (scheduled standup). Main fires this per tick; we queue a
// /compact for each live agent so the drain (#4) delivers it only when the
// agent is idle — never jamming a working terminal. Deduped: if a /compact