Skip to content

feat(identitybroker): give def-less helpers the session's gateway tools - #2914

Merged
rdimitrov merged 14 commits into
feat/per-agent-registrationfrom
feat/helper-broker-tools
Nov 20, 2026
Merged

rdimitrov merged 14 commits into
feat/per-agent-registrationfrom
feat/helper-broker-tools

Conversation

@rdimitrov

@rdimitrov rdimitrov commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Stacked on #2913 (on #2912, on #2883). The base is feat/helper-registration. The new commits here are feat(identitybroker): give def-less helpers the session's gateway tools, its review fix, and a small refactor from the panel review.

#2913 gives each helper agent its own registered identity. This PR gives helpers the session's MCP gateway tools, so a helper's gateway call carries that identity in act.sub instead of being impossible. With it, #2555 is done.

The three choices proposed on #2555 and approved before implementation:

  • Gateway routes only. A helper gets only the broker tools whose calls take the identity broker's gateway, which presents the acting agent's own credential (keyed by root and acting session). Other broker routes use the root session's shared grant and would act as the session, so a helper never gets one. CallMcpWithQuery is also left out.
  • Teams created over the API get them too. Their generic members get the root session's gateway tools, limited to those the root's bound authority allows, and those names are added to the members' authority. This requires the root's broker attachment to be resident in this process, as it is once the root has run here, and the root to have a bound authority. Otherwise members get none and their calls fail closed.
  • Helpers running a named definition get none for now. For a --agents-dir subagent, the definition's ceiling already removes them, and a definition cannot opt in. Per-agent tool limit, checked by the broker #2842, the per-agent tool limit, is where that belongs. Team members built from a named definition get none either.

Who gets them: the default and writable explorers, parallel branches (including routed ones), generic team members (from the Team tool or the API), and the no-FS variants of these.

  • The bare route. A helper gets the bare gateway route rather than the protected wrapper the main agent sees. The wrapper only adds MCP-broker authorization methods, and for a gateway route those never require anything (protectedSessionTool.RequestAuthorization returns early). The engine refuses any authorization-capable tool in a run that cannot present an authorization, which every helper run is, so the wrapper would make the tool unusable. sessionTool.HelperGatewayTool returns the bare route.
  • Permissions. A helper's bound authority comes from its parent's, as before, so the main agent's broker keys reach def-less helpers. Authority still decides each call, and the identity broker authorizes it against the helper's own credential.

Issue relationship

Closes #2555. Part of #2554.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

Baseline checks

  • Linting (task lint)
  • Race tests of the touched packages (internal/adapter/mcpbroker/..., internal/adapter/server, internal/app, cmd/mecak8s); the full race suite ran on feat(identitybroker): register each helper agent under its parent #2913
  • Markdown changed: docs generation/link checks (task docs)
  • User docs/user-facing behavior changed: site build (task site:build)
  • Guarded engine API affected: not affected

Tests

  • End to end through mecak8s's startup (cmd/mecak8s, offline, real broker, AS-1 and AS-2 stand-ins, embedded vMCP):
    • The main agent delegates to a default subagent. The subagent's non-gateway broker tool is not in its catalog. Its gateway call completes.
    • The main agent then makes the same call. AS-1 issues two ID-JAGs, for the same user, with two distinct act.sub agent IDs.
  • Server:
    • HelperGatewayTools keeps only gateway routes.
    • An API team's members get the root's allowed gateway tools and nothing else: none without a resident attachment, a root, or a bound root authority. Their authority allows the gateway tool and not the other route. Dropping the authority update fails the test (checked by mutation).
  • App:
    • The read-only and writable explorer catalogs and a generic member carry the gateway tool. A member built from a named definition does not.
    • A no-FS child catalog carries the tool. A colliding name is skipped with a warning, not a panic.

Real use

The local harness from #2913 has no gateway configured. The cmd/mecak8s end-to-end test above is the real mecak8s startup with a gateway, run offline.

Changes

File Change
internal/adapter/mcpbroker/runtime.go sessionTool.HelperGatewayTool
internal/adapter/server/identity_broker_helpers.go, team.go, service.go HelperGatewayTools; API team members' tools and authority; MemberEngineWithHelperTools
internal/app/catalog.go, build.go, helper_registrar.go Per-session helper tools in the def-less helper catalogs; API team member factory
internal/adapter/mcpbroker/gateway_outcomes.go Comment
user-docs/operating/mecak8s/identity-and-client-access.md identityBroker.enabled row
*_test.go Tests above

API compatibility

  • Assessment. No gRPC or HTTP change. With --enable-identity-broker and gateway servers configured, def-less helpers now see and can call the session's gateway tools under their own identity, and gateway records name helper identities. Main agents are unchanged. Additive.
  • Major/feature changes: none.
  • Upgrade implications: none. Operators who want a helper limited further wait for Per-agent tool limit, checked by the broker #2842.

Special notes for reviewers

  • Attachment lifetime. A helper's tools are the root's attachment-bound routes. Each call re-resolves its route against the attachment's current catalogue, so a withdrawn route returns "unavailable" and a closed attachment fails, exactly as for the main agent.
  • Collisions. In a no-FS catalog, a gateway tool named like a server-global MCP tool is skipped with a warning. The session's own catalog refuses that collision gracefully when it registers the session's tools.

🤖 Generated with Claude Code

@rdimitrov
rdimitrov force-pushed the feat/helper-broker-tools branch 2 times, most recently from 8a433de to 5f6a7e2 Compare November 20, 2026 11:43
@rdimitrov
rdimitrov force-pushed the feat/helper-registration branch from 21a3ad6 to 4bfb270 Compare November 20, 2026 11:43
@rdimitrov
rdimitrov force-pushed the feat/helper-broker-tools branch from 5f6a7e2 to 6d6c93d Compare November 20, 2026 12:09
rdimitrov and others added 12 commits November 20, 2026 15:34
Add port.ChildSessionCreator, an optional SessionStore capability. When
the engine first publishes a subagent, parallel-branch, or team-member
session, it calls CreateChild instead of Create, passing the definition
the child runs. An error stops the child before its first turn, like a
failed Create. Stores without the capability behave as before.

mecak8s uses this to register each helper agent with the identity
broker before it runs (#2555).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A member's factory falls back to a generic member when the roster's
agent type is unknown, so the agent type is not always what runs.
MemberBuild.DefinitionName reports the definition the factory adopted,
and the supervisor passes it to CreateChild instead of the agent type.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A resumed subagent was never published again, so a host could not
admit it: a child whose admission was refused, or whose admission was
lost, could be resumed and run. port.ChildSessionResumer gives the
host ResumeChild before a resumed subagent runs again; an error stops
the resume.

The child-store decorator rule is narrowed to what the engine uses on
child stores, and the background refusal test now waits for the child
to end before checking that its model was not called.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Subagents, parallel branches, and team members now get their own agent
identity when the engine first publishes their session, before they
run. Each registers in its root session's broker session with the agent
that created it as parent, and a refused registration stops the helper.

- D5: a child reports its parent's host session, and the broker refuses
  one that is not the parent's recorded host session.
- Built-ins system/branch and system/member join system/explorer for
  helpers that run no named definition.
- The credential holder moves a helper into its root's new broker
  session, after its parent, keeping its identity.
- A helper whose root has no registered main agent, such as a member of
  a team with no source session, runs unregistered; its gateway calls
  fail closed.

Part of #2555.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A team member registers with the definition its factory built it
  from, so an unknown agent type falls back to a generic member as
  before instead of being refused.
- An API team keeps the class of a member's registration failure, so an
  unavailable broker stays retryable rather than an invalid argument.
- A failed lookup of a helper's parent maps like a registration failure
  instead of always as retryable.
- A helper lookup made after its root moved no longer joins an in-place
  renewal started before the move.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…reopens

When a root's main agent registers into a reopened broker session at
run entry, the tree's held helpers now register there too, parents
first, keeping their identities, as the design's session end requires.
Before, a helper moved only at its next gateway call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A resumed subagent is admitted again before it runs: a held
  credential is kept, and a helper with none registers as a new one
  does, so a helper whose registration failed or was lost is not
  resumed.
- The child-store wrapper documents that it forwards only what the
  engine uses on a child store.
- Parallel branches and Team-tool members are tested through the real
  wiring, not only subagents.
- MoveHelpers visits helpers in a fixed order, so its test exercises
  the parent-first move every run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A resumed subagent runs the default explorer today, so the design no
  longer says it keeps its original definition; #2548 does that.
- Members of a team created over the API register with the root's main
  agent as a stand-in creation parent; the design now says so.
- system/member covers any member that runs no named definition.
- The failure table, the walkthrough, and the test list cover the
  definition in check 7 and the parent host session (D5).
- Shortcut notes for registration lineage records (#2541) and resuming
  a named subagent (#2548).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The default and writable explorers, parallel branches, and generic team
members now get the session's MCP gateway tools, so their gateway calls
carry their own agent identity. They get only gateway routes, which
present the acting agent's credential; any other broker route acts as
the session, so a helper gets none. Each helper gets the bare route,
without the protected wrapper's authorization methods: a gateway call
never needs the MCP broker's authorization, and a helper's run cannot
present one.

A team created over the API gives its generic members the root's
resident gateway tools that the root's authority allows, and adds them
to the members' authority. Helpers that run a named definition get none
until #2842.

Closes #2555.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A gateway tool whose name a helper catalog already holds, such as a
  server-global MCP tool in a no-FS catalog, is skipped with a warning
  instead of panicking the process.
- A team created over the API gives its members no gateway tools when
  its root has no bound authority, rather than every resident one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The API team tests reuse the package's identity broker fixture.
- The RunTeam member factory is one closure, with and without a root's
  gateway tools.
- withHelperToolNames uses slices.Clone and slices.Sort.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Helpers that run a named definition get no gateway tools until #2842;
the code now says so where the helper tools are threaded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rdimitrov
rdimitrov force-pushed the feat/helper-registration branch from f37c302 to fbe979f Compare November 20, 2026 13:38
@rdimitrov
rdimitrov force-pushed the feat/helper-broker-tools branch from 6d6c93d to 7990e8d Compare November 20, 2026 13:38

@ChrisJBurns ChrisJBurns left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See the inline comments.

teamHelperTools treated a failed load of the team's root session like a
team with no gateway tools, so a transient store failure started the
members without them and logged nothing. It now logs the root and the
error and returns it, and buildTeamForOperation fails the start so it
can be retried: a missing root is not found, any other failure internal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Base automatically changed from feat/helper-registration to feat/per-agent-registration November 20, 2026 14:30
#2912 and #2913 were squash-merged into the base. Their trees match the
commits this branch was built on, so every conflict resolves to this
branch's side and the merged tree is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rdimitrov
rdimitrov merged commit 8320c9d into feat/per-agent-registration Nov 20, 2026
44 checks passed
@rdimitrov
rdimitrov deleted the feat/helper-broker-tools branch November 20, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants