Repository navigation
Description
Context
Upstream added sign-in for agents it did not start (Claude Code or Codex in a terminal, ChatGPT, bots): an OAuth flow on the environment's /mcp, approved at a level from read-only to full access (upstream docs/user/outside-agents.md, apps/server/src/auth/McpOAuth.ts). J5 takes this as upstream ships it (Jackson, 2026-10-08).
An outside agent has a session, a label and an access level, but no thread. On J5 today:
- Upstream's reads work (
t3_thread_read,t3_thread_list,j5_list_personas, artifact and playbook reads). - Every J5 tool that reads or acts as the calling thread is refused with upstream's "needs an agent running inside J5 Code" error:
j5_list_participants,j5_send_message,j5_spawn_agent,j5_stop_agent,j5_stop_crew,j5_archive_crew,j5_propose_crew,j5_request_crew_member, the playbook run tools anddelegate_task.
Upstream's own send, interrupt and launch tools stay hidden (divergence D2), so an outside agent on J5 can watch the fleet but cannot message, start or stop an agent. Upstream's docs promise all three.
An earlier version of this issue said j5_list_participants and the stop tools already worked for outside agents. They do not (apps/server/src/j5/a2a/mcp/handlers.ts).
Decided (Jackson, 2026-10-11)
-
Outside agents use J5's tools with a ledger identity. Upstream's
t3_thread_sendandt3_thread_launchstay hidden. Upstream's send from an outside client lands as bare text with no sender named, so the receiving agent cannot tell it from the person. -
The identity is one participant per sign-in. Its id is
outside:<session id>and it is shown by the label the client registered. It is created on first use, with no registration step, and revoking the session in Settings → Connections retires it. It sends plain messages only. Nothing can be delivered to it, so a message addressed to one is refused, and the envelope tells the receiver that the sender is an outside agent and thatj5_send_messagecannot reply to it. Two sign-ins with the same label are two participants with the same name; the label is set by the client program and is left alone. -
Its messages are recorded in the receiver's project. An outside agent has no home project. A person's reply to an ask is already recorded this way.
-
Starting a thread.
j5_spawn_agenttakes the project from the caller: an outside agent must name one. The new agent sits at the top level of that project and records the outside agent as its spawner on the existing "spawned by" record. Its first turn says it was started by an outside agent and thatj5_send_messagecannot reply to it. The outside agent cannot choose the caller's checkout as the workspace; it picks a new worktree, an existing worktree of that project, or the project root. -
The approved sign-in level caps everything an outside agent does.
- A read-only client changes nothing.
- A spawn cannot run above the approved level. That includes a persona: one whose policy is above the level is refused, and the error names the level and the legal moves. This is stricter than for a thread caller, because the sign-in level is a promise the approval page makes about an agent the person does not watch.
- Every send is checked, a plain queued one included: the receiver cannot run with broader permissions than the approved level.
steerandrestartare allowed under the same cap.
-
Listing and stopping.
j5_list_participantsopens to every outside agent, read-only included. It has no "this is you" row, and outside agents are not listed in it for anyone.j5_stop_agentopens under the same cap: an outside agent cannot stop an agent that runs with broader permissions than its approved level.j5_stop_crewandj5_archive_crewstay refused. Both are Captain-only and an outside agent is never a Captain.
-
What stays refused, each with an error naming the legal move (start an agent with
j5_spawn_agentand brief it to do this):j5_propose_crew,j5_request_crew_member, the playbook run tools, anddelegate_task. Each needs a thread for something to come back to. -
This server only. A send to an agent on a peer server is refused in the tool result. The outside agent signs in to that server's own MCP URL.
Later rulings (Jackson, 2026-10-12)
- No pattern for getting an answer. J5 does not tell anyone how an outside agent learns the outcome of a message or a spawn. The use case is not known yet, and upstream states no flow. Nothing in the envelope, the first turn, an error or a tool description says that an outside agent reads a thread.
- Tool descriptions carry no outside-agent text. Each tool's own errors tell an outside agent the rules.
- The cap is checked when a message is sent. A message already waiting behind a running turn still runs if the person raises the receiver's modes first. Upstream's own send behaves the same way, and J5 does not diverge on permissions.
Build
Built as PR #560, the top of a stack on #557 and #563 (issue #519's send, spawn, stop and peer-steer changes).
To cover when building
- The definition in
docs/j5/product/a2a/index.md(a new kind of participant beside the machine participant, with its acceptance criteria) and D2 indocs/j5/product/upstream.md, including why an outside sender is checked on every send and a thread sender is not. - The card in the thread view attributes the message to the outside agent and marks it as one, on web and mobile.
- Retry keys: an outside caller's request namespace is
client:<session id>, so a new sign-in is a new namespace. Check a retried spawn cannot land on a thread created with broader permissions (the hole found in review of feat(server): t3_thread_launch takes clientRequestId pingdotgg/t3code#16654). - Whether some tools should be restricted for some callers belongs with the human-visibility spectrum discussion (Decide whether J5 agents keep delegate_task alongside spawn_agent, native Subagents and propose_crew #336).
Related: #539 (A2A is untested for threads in upstream's "No project" project).
Activity
3 remaining items
feat(j5): an outside agent can message, start and stop agents (#560)