Skip to content

feat(agents): fold invoke_agent into delegate_task with a saved-agent parameter - #141

Merged
bryantderosier merged 2 commits into
j5/mainfrom
feature/agent-delegate-task
Sep 15, 2026
Merged

bryantderosier merged 2 commits into
j5/mainfrom
feature/agent-delegate-task

Conversation

@bryantderosier

Copy link
Copy Markdown
Collaborator

From Jackson's review on #124: invoke_agent was a J5-only wrapper around the same delegated-child engine that upstream's delegate_task uses, and saved agents give delegate_task a purpose again.

J5 now registers its own delegate_task (apps/server/src/j5/agents/agentDelegation.ts): upstream's input plus an optional agent (a saved agent id from an @agent:ID mention or the Settings → Agents library), and upstream's description plus one sentence about agent. With agent, the J5 invocation module resolves the definition, route, and permissions and passes the pinned assignment through OrchestratorMcpService.delegateTask; target and runtimeMode are refused alongside it because the agent pins them. Without agent, it is upstream's plain child delegation. task_status and task_cancel return unchanged so a parent can follow the child. Raw thread creation (create_threads, t3_thread_start, t3_thread_send, t3_thread_interrupt) stays excluded. invoke_agent is removed; the provider mention instructions, the exact MCP tool inventories, FORK.md, and the agent tools definition follow.

Validation

  • Server J5 agent suite, J5 MCP surface and registration tests, and the worktree registration inventory pass (the subagent integration test now also covers delegate_task with agent, the refusal of target/runtimeMode with agent, and the plain path); server typecheck and lint clean.
  • No provider was driven end to end.

Merge order

Part of GitHub stack 120, on top of #140.

🤖 Generated with Claude Code

@bryantderosier
bryantderosier added this pull request to stack #120 September 14, 2026 12:23
@github-actions github-actions Bot added size:L 100-499 effective changed lines (test files excluded in mixed PRs). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Sep 14, 2026
@bryantderosier bryantderosier self-assigned this Sep 14, 2026
@bryantderosier
bryantderosier force-pushed the feature/agent-delegate-task branch 2 times, most recently from de51d7c to 54e899d Compare September 14, 2026 13:14
Base automatically changed from feature/agent-library-review-fixes to j5/main September 14, 2026 21:36
… parameter

Jackson's review: invoke_agent was a J5-only wrapper around the same delegated-
child engine upstream's delegate_task uses, and personas give delegate_task a
purpose again. J5 now registers its own delegate_task with upstream's input
plus an optional agent (saved agent id). With agent, the J5 invocation module
resolves the definition, route, and permissions and passes the pinned
assignment through OrchestratorMcpService.delegateTask; target and runtimeMode
are refused alongside it. Without agent, it is upstream's plain child
delegation. task_status and task_cancel return unchanged so a parent can follow
the child. Raw thread creation stays excluded. Provider instructions, tool
inventories, FORK.md, and the agent tools definition follow.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Jacksondr5
Jacksondr5 force-pushed the feature/agent-delegate-task branch from 54e899d to 591f6b3 Compare September 14, 2026 21:36

@tyler-barton-horizon tyler-barton-horizon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mechanics look right: refusing target/runtimeMode alongside agent, passing title and mode through, keeping task_status/task_cancel unchanged, and the integration test covers all three paths. Approving with one text fix I'd like in before merge (the tool description), plus two optional nits.

Reviewed with Claude Fable 5.1 in Claude Code.

Comment thread apps/server/src/j5/agents/agentDelegation.ts Outdated
Comment thread apps/server/src/j5/agents/agentDelegation.ts
Comment thread docs/j5/product/a2a/agent-tools.md Outdated
…eam's text

Upstream's description tells the model to use delegate_task for any subagent
request, which contradicts the orchestration instructions that keep ordinary
subagent work provider-native. The J5 tool now carries its own description:
the saved-agent use leads, the plain child is the fallback for cross-provider
or T3-tracked work, and the mechanics (modes, timeouts, task_status) stay.
Also notes why the target/runtimeMode destructure exists and corrects the
agent-tools page on what orchestrator_capabilities advertises.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@bryantderosier

Copy link
Copy Markdown
Collaborator Author

Addressed all three comments in 34592c8 (description rewritten for J5, destructure comment, agent-tools wording). Threads resolved; J5 CI is running on that head.

@bryantderosier
bryantderosier merged commit c6149eb into j5/main Sep 15, 2026
19 checks passed
@bryantderosier
bryantderosier deleted the feature/agent-delegate-task branch September 15, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines (test files excluded in mixed PRs). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants