Repository navigation
feat(j5): delegate_task runs a persona on another J5 machine (#957) - #1255
Merged
Merged
Conversation
) The caller's server calls the other machine's j5_spawn_agent through PeerMcpClient, after its own checks (Linked environments on, not fenced, a Full access link, peering, not a Crew member). It scopes the retry key to the caller and sends the facts the sender header lacks: the spawner's project, the pick source, its access and sandbox, and its authors' models. The other machine treats a link session with a sender thread as a third kind of spawner: the agent is a root, a person's pick is capped at the link's level, an agent's pick at the narrower of that and the caller's access, and a block there is lifted there. Both machines record the route to the other's participant (j5_a2a_peer_route, migration 60) before the spawn returns. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…an import cycle SpawnAgentService needs J5SpawnAgentResult as a value, and tools.ts imports SpawnAgentService for its dependency list, so loading SpawnAgentService first hit tools.ts before SpawnAgentService was initialised. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A linked spawner's facts are left out of the request a retry key binds, and its persona's retry is exempt from the caller's current modes, as a local one is: the spawner's server recomputes both on every call, so a retry in a later turn could never finish the first agent (Fable). - The target refuses a spawner whose server it holds no peering with, so a half-removed link can't start an agent that can't reply (Opus). - The caller's route-record failure names the key to retry with, which was lost when the agent gave none (Opus, Fable). - A link session naming environment_id gets its own refusal text (Opus). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…spawn # Conflicts: # apps/server/src/provider/agentContextBudget.json
…y with (#956) The spawn may have started there before the line dropped, so the retry the message asks for must reuse the key, generated or not. agent-tools.md says a persona's retry is exempt from the caller-mode check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A persona may now name target.environmentId. The caller refuses a machine it is not peered with (only J5 machines peer; a plain T3 Code machine would run a plain delegate instead) and allow_once, then sends the pick's facts (who picked it, the caller's access and sandbox, the authors' models) through upstream's remote delegation, which carries them to t3_thread_launch there (new FORK case 131). The target resolves the persona from its own library against its own models: an agent's pick is held to the narrower of the caller's access and the link's level with the caller's sandbox, a person's pick to the link's level narrowed by the delegating thread's modes, and a block there says it is blocked on that machine. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…level, refused otherwise (#957) The live test showed a Full access persona from a Supervised thread is refused, not narrowed: a persona never runs below its policy. The docs and the refusal now say so, naming the thread's mode beside the link. The docs also say a persona delegate, as any delegate there, needs target.projectId when upstream can't match the project by repository. Co-Authored-By: Claude Opus 5.5 <[email protected]>
#956) Only a real block is lifted on that machine; a persona its library doesn't have, or a library it can't read, gets its own next step. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…code/957-remote-persona-delegate
…ocked there (#957) Only a real block is lifted on that machine; a persona its library doesn't have, or a library it can't read, gets its own next step. The docs say both machines must run a release with this change, since an older J5 machine runs a plain delegate in the persona's place. Co-Authored-By: Claude Opus 5.5 <[email protected]>
) A server advertises the spawn peer capability; spawnOnPeer refuses a machine that doesn't, since an older J5 there would take the spawner for an outside agent that can't be replied to. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…code/957-remote-persona-delegate
…aming it (#957) A server advertises the personaDelegate peer capability; the caller refuses a machine that doesn't, since an older J5 there would drop the persona and run a plain delegate in its place. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…connect (#956) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…code/957-remote-persona-delegate
…machines reconnect (#957) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…spawn # Conflicts: # apps/server/src/provider/agentContextBudget.json
…mote-persona-delegate #1244's FORK case landed as 131, so #957's case is now 132; its references move with it. The tool list measures 102234 bytes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y key (#956) The target can fail after creating the agent, naming its own derived key, which the caller can't pass. agent-tools.md names t3_project_list's environmentId correctly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…code/957-remote-persona-delegate
…thread's modes (#956) Jackson's decision of 2026-11-27 (option b): for a person's pick the caller now sends its thread's own modes as the mode limit, in place of full access, so the other machine refuses a persona broader than the link or the thread it is asked from, as #957's delegate_task does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…code/957-remote-persona-delegate # Conflicts: # docs/j5/product/upstream.md
…persona-delegate # Conflicts: # FORK.md # apps/server/src/j5/a2a/PeerHttp.test.ts # apps/server/src/j5/a2a/PeerStoreService.test.ts # apps/server/src/j5/a2a/peerProtocol.ts # apps/server/src/provider/agentContextBudget.json # docs/j5/product/upstream.md # packages/contracts/src/j5.ts
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 36 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This branch was successfully deployed
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.
Problem
delegate_taskwith a persona could only run here: it refused anytarget. The agent-tool rulings of 2026-11-06/07 let a persona be delegated to another J5 machine, resolved from that machine's own library against its own models. Jackson added on 2026-11-24 that the machine must be peered.Closes #957.
What changed
The design is §3, "Smallest build for #957", of the v0.1.11 re-check.
agentDelegation.ts):target.environmentId, plusprojectId. Provider, model, options,driverKindandruntimeModeare still refused, and so is a localenvironmentIdwith aprojectId.allow_once;personaDelegatepeer capability (an older J5), naming it and saying "update J5 there".agentPersona.delegated: who picked it (turnPickSource), the caller's access and sandbox (resolveCallerAccess), and its authors' models (resolveReviewAuthors). The call is wrapped inUnreachableCalls.observe.RemoteDelegation.tsgains one input field and one spread intot3_thread_launch's arguments (new FORK.md case 132).t3_thread_launchgains an optionalagentPersona. The handler honours it only from a link session withdelegatedFrom, sets its level fromclientModeCeiling, and skips the advertised-model check for it.ThreadLaunchServicepasses the services it already holds and leaves a persona out of the D42 plain-delegate check.resolveAgentPersonaLaunch/pickDelegatedPersona:delegate_task's description gains "To run the persona on a peered J5 machine, pass only target.environmentId." Thepersonafield gains a matching clause. The tool list grows to 102234 bytes (case 110).Personas across machines
When a person types
@persona:IDon machine A, the persona that runs is the one with that id as saved on the target machine. It runs as saved only within the link's level and the asking thread's own modes; one broader is refused, naming the level. This is the same rule as #956'sj5_spawn_agent, after Jackson's decision of 2026-11-27.Live testing
PASS at
7a88354e53(tester-web). Two J5 test servers linked at Full access with messages, Haiku only, with a personab-scoutsaved on both machines and different instructions on each.mode: "wait"delegation from A ran B'sb-scout. It replied B-SCOUT, while the A-SCOUT copy stayed local. The file write was verified on B, and the result came back to A with delegate lineage.allow_once,target.model,runtimeMode, and a localenvironmentIdwith aprojectId.@personain a Supervised thread was refused too, since its Full access is broader than the thread's mode.target: { environmentId }alone. Upstream's remote delegation matches the project there by repository and refused withtarget_required, because the rig's servers have separate disposable repositories. The test passedtarget.projectIdexplicitly instead, which is supported. That's upstream's rule, andagent-tools.mdnow says it.7a88354e53:Reviews
934bfe75fe, after the version-check should-fix. The capability flag and the text-only commits since were reviewed or need no re-check.Evals
The evals
evals/README.mdnames fordelegate_task's text:evals/j5-cliat69ca50c543, 3 samples per case, head (#957) against base (#956).j5-thread-send-to-named-top-level-thread, dipped. In a 6-sample tie-break it came to base 6/9 against head 4/9. Every failure on both sides is the samej5_send_messageaddressing slip, and no sample callsdelegate_task.@persona:ios-builderor "my iOS Builder persona" on the Mac, both harnesses calldelegate_taskwithpersonaand onlytarget.environmentId, 6/6 each.agentPersonaor calledt3_thread_launch.personafield's description never reaches agents, because Effect drops a description annotated onto a checked schema. The same applies toj5_spawn_agent's fields and upstream'stargetfields. Tracked as MCP tool field descriptions on checked schemas never reach agents #1254.Upstream impact
Each upstream-owned file has a minimal J5 edit, recorded in FORK.md in this PR:
apps/server/src/peer/RemoteDelegation.ts: new case 132, and a file-table row.apps/server/src/mcp/OrchestratorMcpService.ts: one type line (case 107).apps/server/src/mcp/toolkits/project/tools.ts: one schema field (case 111), with a new file-table row.apps/server/src/mcp/toolkits/project/handlers.ts: the honouring condition, the skip, and the pass-through (case 111).apps/server/src/orchestration-v2/ThreadLaunchService.ts: one option and one condition, inside case 111's seam.Register D42 records it; Jackson decided on 2026-11-07, 2026-11-24 and 2026-11-27.
Checklist
agentSubagent.integration.test.ts: the refusals (unpeered, older J5,allow_once, model override) and the peered call's facts;agentPersonaLaunch.integration.test.ts: an agent's pick capped both ways, a person's pick capped by the level, a missing pick refused, a persona the target lacks told as that;RemoteDelegation.test.ts: the carried field and the level set from the link.delegate_tasktool. Contracts: J5'sOrchestrationV2AgentPersonaRequestandPeerCapabilities. Connection modes: direct and loopback tested; polling not.docs/j5/product/a2a/agent-tools.md(thedelegate_taskparagraph and AC41),docs/j5/product/upstream.md(register D42). FORK.md cases 107, 110, 111 and 132.Built by Claude Opus 5.5 in Claude Code (J5 Code Crew builder seat).
🤖 Generated with Claude Code