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(ui): the 1:1 button no longer wedges itself on a stale preload
Chaitanya Giri944aa5547959
diff --git a/src/renderer/src/components/AgentHoldButton.tsx b/src/renderer/src/components/AgentHoldButton.tsxindex 35d645d0..516c271b 100644--- a/src/renderer/src/components/AgentHoldButton.tsx+++ b/src/renderer/src/components/AgentHoldButton.tsx@@ -24,6 +24,9 @@ import { useStore } from '@/store/store';export function AgentHoldButton({ agentId }: { agentId: string }) {const agent = useStore((s) => s.agents.find((a) => a.id === agentId));const [busy, setBusy] = useState(false);+ /** Last failure, shown on the button itself. A control that silently does+ * nothing is worse than one that says why. */+ const [err, setErr] = useState<string | null>(null);// The registry is the record and it survives restarts, so the store's copy// can be stale on a fresh launch. Read it back once per agent.@@ -49,22 +52,34 @@ export function AgentHoldButton({ agentId }: { agentId: string }) {disabled={busy}onClick={() => {setBusy(true);- // Mirror locally only after main confirms the write. Flipping- // optimistically would show a hold Michael never heard about.- void window.cth.hiveSetAgentHold(agentId, !on)- .then((r) => { if (r.ok) useStore.getState().updateAgent(agentId, { onHold: !on }); })+ // Promise.resolve().then(...) rather than calling straight into the+ // bridge: on a dev build whose PRELOAD predates this feature the method+ // is undefined, and the resulting TypeError is thrown SYNCHRONOUSLY out+ // of onClick, so `finally` never runs and the button stays disabled+ // until React remounts it. Which is exactly how this was reported.+ // Preload is not hot-reloaded; only a restart picks it up.+ void Promise.resolve()+ .then(() => window.cth.hiveSetAgentHold?.(agentId, !on)+ ?? Promise.reject(new Error('restart the app: this build\'s preload predates the 1:1 control')))+ // Mirror locally only after main confirms the write. Flipping+ // optimistically would show a hold Michael never heard about.+ .then((r) => {+ if (r?.ok) { setErr(null); useStore.getState().updateAgent(agentId, { onHold: !on }); }+ else setErr(r?.error ?? 'could not set the hold');+ })+ .catch((e: unknown) => setErr(e instanceof Error ? e.message : String(e))).finally(() => setBusy(false));}}><spanclassName="cth-tip cth-tip-wrap"- data-tip={on+ data-tip={err ? err : on? `End the 1:1. Michael can hand ${agent.name} work again.`: `Take ${agent.name} aside. Michael stops sending them work until you end it. Unlike the two buttons here, this does not restrain the agent: they keep running and keep answering you.`}aria-label={on ? 'End the 1:1 and release this agent to Michael' : 'Take this agent aside for a 1:1'}style={{ display: 'inline-flex', alignItems: 'center', gap: 4 }}>- <Icon name={on ? 'pause' : 'play'} /> {on ? 'in 1:1' : '1:1'}+ <Icon name={on ? 'pause' : 'play'} /> {err ? '1:1 failed' : on ? 'in 1:1' : '1:1'}</span></PixelButton>);