Repository navigation
feat: rework entirely how subagents work - #885
Merged
Merged
Conversation
Contributor
[High impact] The PR changes how agent work is started and coordinated across supported harnesses. Fix duplicate news delivery after a server restart before merging. Findings
Fix with agent prompt### Issue 1
src/local/chat/news.rs:460-463
`deliver_news` saves and starts the receiving turn before marking its news as told. If the server exits between those steps, the subscription becomes ready again after its claim expires. The next delivery gets a new random `client_turn_id`, so it starts another turn instead of finding the saved one. The agent can receive and act on the same answer twice.
Save the news receipt with the receiving turn, or use a stable delivery key and recognize an already-saved delivery.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryReplaces built-in sub-agents with chats managed through the
|
small-angel
force-pushed
the
clo/agent-orchestration
branch
from
November 4, 2026 19:07
845f7aa to
8a6c698
Compare
Contributor
Author
|
@greptileai review |
…CP server
Agents get orx's own MCP server, `orx mcp-gate`, beside alphaXiv's on
every harness that takes one: Claude via --mcp-config, Codex through its thread config, OpenCode
through its config, and ACP agents in session/new, load and resume (stdio,
which ACP requires every agent to accept). Beside Claude's `approve`, it
relays orchestration tools to `orx up` at /api/internal/mcp, which
authenticates the chat by a token derived from a per-process key. Claude
loads the server's tools upfront rather than behind tool search, and
Codex and OpenCode give it a tool timeout past the longest `wait`.
- models: versioned models, the routes that run them in default order
(vendor harness, OpenCode Go, OpenCode, direct APIs, other harnesses,
aggregators) and the effort levels the first route takes. Routes join on
a canonical id; Claude aliases join through the catalog's resolvedModel,
and ACP agents are named by a slug of their name.
- delegate: a chat on the resolved route and effort, a side chat in the
caller's worktree or (`worktree: own`) a chat with its own, with a
permission mode no broader than the caller's. chat_delegates records who
delegated, which is how depth is counted; a retry with the same
clientRequestId finds the first chat by an id derived from it. The caller
subscribes, unless `notify: false`, which starts a chat that is no
delegate: the caller's side chat, or with `worktree: own` a chat of its
own, as a delegate the user kept. canDelegate decides whether the delegate may delegate in
turn; it defaults to a new setting, off, and each delegate is told its
depth.
- subscribe, unsubscribe, wait: any chat can subscribe to any other. A
subscription tells each finished turn, and each question the target
asks, as the first message of the subscriber's next turn, through the
same leased, idle-only loop as run wake-ups, batched into one turn per
subscriber with each piece kept in the transcript as its own message. A
turn that ends asking, or while the target's own delegates work, is not
its answer; answers a later turn overtook ride along with its news.
`wait` collects the same news inside a turn and marks it told as it
returns it, so it never arrives twice.
- answer: answers a forwarded question through the dashboard's own prompt
path, and the card shows which chat answered. Approvals, OpenCode's plan
exit included, stay with the user.
- status, read, send, cancel: read any chat; message a delegate, or any
chat with no broader permissions; stop a delegate and every delegate
below it.
Run wake-ups now go through the same delivery as subscriptions, so a chat
hears every run and chat that finished in one turn instead of one turn per
run, and the second wake-up loop is gone. `orx agent spawn` is removed:
`delegate` with `notify: false` and `worktree: own` opens an independent
chat on any model, and the orx-agent-delegation skill now teaches the MCP
tools. Transcripts that used spawn still render its card.
Each user message reaches its agent tagged with a ref, the start of its
id (msg_3fa9c1d2), which no colour or longer id can be mistaken for. A
ref in a task or message expands, for the receiving agent only, to the
cited message as a quote with its author, chat and attachments, so a
delegate reads the user's own words; one that cites nothing stays as
written. Everything orx or another agent writes into a chat (a task, a
`send`, news) reaches its agent opening with `[orx]`, and its part in the
transcript records its kind and sender (`orx: {kind, from, status}`)
beside the words the sender wrote, through new turns, steering and the
queue alike. The dashboard reads that rather than the text: a collapsed
card on the left whose sender opens that chat and whose first line opens
the whole message, and for a run, its experiment, outcome and how long it
ran in green, red or amber, opening its logs. In chat, a ref is an inline pill with the
cited message's first words and its author's icon (the agent's provider
for an agent's message) that opens that chat at the message, and a chat
id is a link named after the chat. A side chat's or delegate's opening
context names the chat it came from, so `send` back needs no lookup.
Native sub-agent tools are off where the server is present (Claude
Agent/Task/Workflow, Codex multi_agent, OpenCode task), and Claude
delegates get the subagent prompt-cache TTL instead of the main
conversation's 1h. A side chat's worktree owner is now the top of its
chain, since delegates nest.
The dashboard shows delegates as a lineage rather than side chats: the
session JSON carries each delegate's parent, depth, latest turn state, what
it waits on and a preview of its answer or failure; the side chat menu
leaves delegates out; the workspace pane lists active sub-agents (nested
ones indented, ones waiting on an answer marked) with finished ones folded
behind a count; and each delegate gets a card in the transcript under the
turn that started it. Once the user writes in a delegate, a bell in its composer
lets them keep it: it stops notifying the parent agent and becomes that
chat's side chat (or a chat of its own, with its own worktree). Side chats
have no bell; their agent `send`s when asked.
Side chat tooltips in the workspace pane open beside the row instead of
over the menu.
Assisted-by: claude-opus-5.5
small-angel
force-pushed
the
clo/agent-orchestration
branch
from
November 4, 2026 19:18
8a6c698 to
9166caf
Compare
Contributor
Author
|
@greptileai review |
Contributor
Author
|
@greptileai review |
…rx mcp` The user's Stop now stops the chat's delegates too, as an agent's `cancel` already did; otherwise their answers woke the chat the user had just stopped. A `send` retry is keyed by the calling chat and request alone, so it still matches after a restart, and a message cited from another project opens there. `orx mcp-gate` stopped being only Claude's approval gate once every harness spawned it for the orchestration tools. `mcp-gate` stays a hidden alias: an `orx up` running from before an update still writes configs that launch it from the updated binary. Assisted-by: claude-opus-5.5
small-angel
force-pushed
the
clo/agent-orchestration
branch
from
November 4, 2026 19:50
bbd7aac to
5bc0015
Compare
Contributor
Author
|
@greptileai review |
This was referenced Nov 4, 2026
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An agent could only start sub-agents on its own harness and model, and no chat could hear back from or write to another, so cross-model work meant separate sessions and copy-paste.
orx now gives every agent its own MCP server,
orx mcp:delegatestarts a chat on any model, with orx picking the route, and the delegator is woken with its answer. Any chat cansubscribe,wait,sendandansweracross providers, and the harnesses' own sub-agent tools are off, so all sub-agent work shows up in the dashboard.Proved with CI, three Sol review rounds and Greptile's, and runs on a dev server: an OpenCode agent calling
orx mcp's tools, Stop reaching a running delegate, and citations opening across forks and projects.Closes #608.
Assisted-by: claude-opus-5.5