Skip to content

Outside agents (MCP OAuth clients) need a ledger identity to message and start threads #498

Closed

Description

@Jacksondr5

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 and delegate_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)

  1. Outside agents use J5's tools with a ledger identity. Upstream's t3_thread_send and t3_thread_launch stay 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.

  2. 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 that j5_send_message cannot 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.

  3. 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.

  4. Starting a thread. j5_spawn_agent takes 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 that j5_send_message cannot 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.

  5. 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. steer and restart are allowed under the same cap.
  6. Listing and stopping.

    • j5_list_participants opens 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_agent opens under the same cap: an outside agent cannot stop an agent that runs with broader permissions than its approved level.
    • j5_stop_crew and j5_archive_crew stay refused. Both are Captain-only and an outside agent is never a Captain.
  7. What stays refused, each with an error naming the legal move (start an agent with j5_spawn_agent and brief it to do this): j5_propose_crew, j5_request_crew_member, the playbook run tools, and delegate_task. Each needs a thread for something to come back to.

  8. 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

Related: #539 (A2A is untested for threads in upstream's "No project" project).

Activity

  1. 3 remaining items

  2. added a commit that references this issue on Oct 12, 2026
    b20c0d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions