Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

Commits on main

fix(chat): identify sub-agent spawn events so a replay cannot cancel a question\n\nTwo P2 review findings on the delegation card, both about a signal the surface\ncould not act on.\n\n**A replayed spawn cleared a live question.** `continue_subagent` announces a\nresume by republishing `subagent_spawned` for the same task/agent, so "a row\nthat already exists got spawned again" was read as a resume — and that is\nexactly what Socket.IO redelivering the ORIGINAL spawn looks like. This socket\nreconnects and replays freely (13+ times in one measured session), so the\nfailure was likely, not theoretical: the pause cleared, the question vanished,\nand the user was left with a spinner for a child still blocked on them. That is\nthe class of bug this change set exists to remove.\n\nThe core already stamps the answer. `publish_seq_stamped` puts a per-request\nmonotonic `seq` on every event it emits, and `WebChannelEvent` documents\n`(request_id, seq)` as the pair the frontend is meant to dedupe replayed\nagainst live events with. It was simply not declared on the sub-agent wire\ntypes or read anywhere, so it is declared and read now, in two places:\n\n- `ChatRuntimeProvider` gates `onSubagentSpawned` and `onSubagentAwaitingUser`\n through the same `markChatEventSeen` cache `onToolCall`/`onToolResult`\n already use. The mirrored guard matters on its own: a replayed\n `subagent_awaiting_user` would otherwise re-park a child that had resumed.\n- `subagentSpawned` records the identity of the event that started the row and\n unparks only for an identity it has not already been started by. That cache\n is bounded (10 min, 500 entries) and a busy thread can evict a key, so the\n reducer keeps a durable check of its own rather than trusting it.\n\nUnidentifiable events (an older core with no `seq`, replayed inside one\nrequest) collapse to the same string and are treated as replays deliberately.\nIt is the safe direction to fail: a stale question is visible and still settles\non `subagent_done`, while a silently cleared one strands the user. The resume\nthat matters carries a different `request_id` regardless, because the user's\nanswer is what triggers it.\n\n**Inline delegations could not open the drawer.** `SubagentCall` is the only\nrenderer for a delegation on the assistant-ui surface and supplied no `onView`,\nso it could not set `openSubagentTaskId`. The legacy `ToolTimelineBlock` passes\none per row; the sole remaining launcher, `BackgroundProcessesPanel`, lists\nasync/typed spawns only — so every other delegation's persisted worker\nconversation was unreachable.\n\n`subagentDrawerHost` is the seam: a context, because the consumer is a tool\npart rendered from inside the transcript while the drawer's disclosure state\nbelongs to `Conversations`. It carries `canOpen` as well as `open` — the host\nresolves a `taskId` against the thread's live timeline and renders nothing when\nit is absent, so a delegation replayed from the settled core transcript would\notherwise get a button that opens an empty sheet. Asking the host also keeps\nthe tool part free of a store subscription: it renders on surfaces that have no\nRedux provider. No host, no affordance, which is what the read-only mounts (the\ndrawer itself, past-turn insights) want.\n\nThe two fixes share a commit because they share a test file: the drawer cases\nbuild on the spawn-identity helpers the replay cases introduce.\n
M3gA-Mind committed 3 months ago
a70ae2d
dcab945
fix(chat): one predicate for "timeline row still in flight"\n\nCodeRabbit, PR #6036: `activeSubagentEntry` matched only\n`status === 'running'`, but `subagentAwaitingUser` sets `awaiting_user` on\nthe row's TOP-LEVEL status when a delegated child parks on\n`ask_user_clarification`. The lookup returned `undefined` for the paused\nrow, so `AssistantUiInferenceStatus` lost its `activeSubagentEntry` and the\ngeneric status line reappeared over the delegation card — announcing that\nthe agent was working at the one moment it was blocked on the user.\n\nTwo places in this PR disagreed about what "active" means, so rather than\npatch one side, the question now has a single answer:\n`isActiveTimelineStatus` in `chatRuntimeSlice`, beside the reducer that\nproduces the status.\n\nThere were three hand-written copies, not two — `assistantUiMessages`'\n`toolPart` had a correct third one that decides whether the paused row is\nprojected onto the surface at all. All three now delegate:\n\n- `useOpenHumanExternalStore` — `activeToolEntry` / `activeSubagentEntry`\n (the defect).\n- `AssistantUiSubagentCall` — `isActiveSubagentStatus` keeps its name for\n its ~4 call sites and reads better beside a `SubagentActivity`, but is\n now a delegate rather than a second opinion.\n- `assistantUiMessages` — `toolPart`'s `running`.\n\nTest: a sub-agent pauses via the real `subagentAwaitingUser` reducer, and\nthe delegation card keeps the floor — its question renders and the generic\nline stays away. Reverting the `activeSubagentEntry` predicate alone fails\nit on that assertion.\n\nTwo correct-but-still-hand-written copies are deliberately left alone\nrather than widen this PR's diff into files other workers hold open:\n`AssistantUiToolCall.tsx:149` and `ToolTimelineBlock.tsx:535`.\n
M3gA-Mind committed 3 months ago
9766381
fix(chat): show what is being approved before offering the decision\n\nThe assistant-ui approval path copied only the request id and the decision\noptions onto the tool part, so `PendingApproval.message` — the core's\n`Run <tool> — <action summary>` explanation — never reached the surface.\nWhen the arguments were unavailable or heavily redacted, the user saw a\ngeneric tool name and three buttons, one of which was "Always allow". That\none writes the tool onto the auto-approve allowlist, so a decision taken\nwithout being able to read the command was a durable one.\n\nThe decision controls are `ApprovalRequestCard` now — the surface AGENTS.md\ndesignates for this gate, and the one the legacy panel used. It renders the\nsummary and the exact command above its buttons, so the two cannot come\napart again: there is no arrangement of this component that offers a choice\nwithout stating what the choice is about. It replaces the bespoke bar that\nhad already drifted from it.\n\nThe card is passed into the tool card as its footer rather than replacing\nit, so the full arguments stay visible when there are any, and the call\nkeeps its "awaiting input" status. Reusing the card also restores the\nfailed-decide handling the bar could not have: `respondToApproval` returns\nvoid and the runtime swallows the rejection, so the bar answered a failure\nwith a button disabled for ten seconds; the card surfaces the error and\nre-enables immediately.\n\n`PendingApproval` is read from Redux at the render site, the same way the\n`composio_connect` route already resolves it — assistant-ui's `approval`\ntype has nowhere to carry a request summary, its `reason` field being the\nreason a decision was given rather than the reason one is being asked for.\nBoth routes now share one resolver.\n\nThe gated branches are selected on the part's own `approval` field before\nany store-reading component mounts, so an ordinary tool call neither\nsubscribes to Redux nor requires a store to render.\n
M3gA-Mind committed 3 months ago
d023dae
fix(chat): answer the tool-approval gate on the assistant-ui surface\n\nA `Prompt`-class tool call parks the turn on the ApprovalGate and waits for\na decision. On `/chat` no decision could be given: the socket handler wrote\n`chatRuntime.pendingApprovalByThread`, and the only reader of that slice\n(`ApprovalRequestCard`) lives inside `Conversations`' `legacyMainPanel`,\nwhich renders only in `mic-cloud` composer mode. The observable failure was\na shell call spinning forever with no prompt, then the core dropping the\nparked call as denied ~2 minutes later and the agent answering with a\nsentence.\n\nBoth halves of the seam were missing, so both are repaired here.\n\nData. The external-store adapter now selects the parked approval and hangs\nit off the tool part it gates, matching by tool name against the newest\nunsettled call — the `approval_request` event carries no `tool_call_id`.\nWhen no row matches (the progress channel is bounded and drops frames, and\nthe gate can park before the `tool_call` frame lands) a part is synthesised\nrather than dropped: a prompt in an imperfect slot beats no prompt at all.\nThe tail message goes to `requires-action`/`interrupt`, which is what gives\nthe gated part the status a decision renders from, and the tail is now\nminted even when the lifecycle reports the turn settled.\n\nDecisions route through `onRespondToToolApproval` to the existing\n`openhuman.approval_decide` RPC. Supplying that callback is load-bearing:\nwithout it the runtime throws "Runtime does not support tool approvals."\nrather than no-opping. Option ids are the core's own decision literals, so\nthey forward with no translation table.\n\nRender. `OpenHumanToolCall` forwarded four fields and dropped `status`,\n`approval` and `respondToApproval`, so a parked call rendered as an\nordinary running one. It now carries a localized decision row, placed\noutside the disclosure — a decision the turn is blocked on must not be\nhidden behind something to open. The kit's own approval-capable\n`ToolFallback` stays unused: `AssistantUiChat` overrides it, and it\nhardcodes English.\n\n`composio_connect` parks on the same gate but must not get approve/deny —\napproving without connecting resumes the agent against a toolkit with no\ncredentials. It routes to the existing `IntegrationConnectCard`, which runs\nthe OAuth handoff and resolves the gate itself once the toolkit is live.\n\nAlso makes the `awaiting input` label reachable. It could only ever fire on\na `status` the adapter forwards for `error`/`cancelled` alone, so the state\nit was written for never reached it.\n
M3gA-Mind committed 3 months ago
52f806e
fix(chat): give a sub-agent awaiting the user its own state and a way to answer\n\n`onSubagentAwaitingUser` reached the assistant-ui surface, but nothing there\ncould tell the pause apart from ordinary work. `isActiveSubagentStatus` folds\n`awaiting_user` into `running`, and the surface passes `running` from\n`result === undefined`, which is true for a parked delegation too -- so a child\nblocked on a question rendered as a spinning "running" chip for as long as the\ngate stayed open. The question itself never left the socket event: the reducer\ntook only `{threadId, rowId}` and dropped `message`, which is the core's only\ncopy of it. There was no way to answer either: `SubagentDrawer` lives inside\nthe unreachable `legacyMainPanel`.\n\nThe data half. `subagentAwaitingUser` now carries the question onto\n`SubagentActivity.awaitingQuestion`, and `subagentSpawned` treats a republished\nspawn for an already-parked row as the resume signal it is -- `continue_subagent`\nresumes a paused child by republishing `subagent_spawned` for the same\ntask/agent, and the idempotency guard swallowed it wholesale, leaving the row\nstuck on `awaiting_user` for the rest of the run. It stays idempotent for a\nplain redelivery: no second row, and a `running` row is untouched.\n\nThe render half. `isAwaitingUserSubagentStatus` asks the question\n`isActiveSubagentStatus` cannot: not "is this in flight" but "is the blockage\nthe user". The card reads it from the activity rather than the `running` prop,\nshows a distinct chip instead of a spinner, pins its disclosure open while the\ngate is held, and renders the question with a reply box. The reply is an\nordinary user turn -- the orchestrator holds the `[SUBAGENT_AWAITING_USER]`\nenvelope and resumes the child with `continue_subagent` once the user answers\n-- so it appends through the runtime and out to the registered chat surface,\nthe same entry point as the composer's Send, which keeps the queued-vs-new-turn\ndecision in one place. `onAnswer` is opt-in, so the read-only surfaces that\nalso render this card (the process drawer, past-turn insights) get the question\nwithout a dead reply box.\n
M3gA-Mind committed 3 months ago
5c28836