Skip to content

feat(a2a): outbound A2A control is OSS-core (ent#761) - #3191

Merged
vybe merged 4 commits into
devfrom
feature/ent761-a2a-outbound-oss
Oct 3, 2026
Merged

vybe merged 4 commits into
devfrom
feature/ent761-a2a-outbound-oss

Conversation

@vybe

@vybe vybe commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Fixes abilityai/trinity-enterprise#761 — a single PR off dev (not stacked). Draft until the operator merges it.

Outbound A2A control works on every edition by ruling. The three MCP control tools still proxied the entitlement-gated management router, though, so an unlicensed instance answered { not_entitled: true }. The only store the runtime call_a2a_agent resolves against is the platform-wide endpoint store under /api/settings/a2a-endpoints (#736), and every build already has it. This PR points the control tools at that store. The inbound plane (exposure, inbound allow-list, full config read, served card) is untouched.

What

  • MCP server (src/mcp-server/src/): client.ts — register/list/removeA2AEndpoint hit PUT/GET/DELETE /api/settings/a2a-endpoints and no longer take an agent name, because the store is platform-scope. tools/a2a.ts — new failOutbound mapper that branches on status only, so not_entitled cannot come out of it. agent_name is optional and documented as ignored. register_a2a_endpoint reports outbound_enabled and names the admin step when the switch is off. It also refuses clear_credentials + credentials together. list_a2a_endpoints refuses agent-scoped keys in the tool, and get_agent_a2a_config gains outbound_endpoints_note. tools/a2a_call.ts — its description was correct before the repoint but is wrong after it, so it is updated. access.ts — the three ledger rows now name the gate that actually applies.
  • Backend (src/backend/routers/settings/): the __init__.py # mcp: header names a2a.ts and the three covered routes, and every other route in the package stays a human-only grant surface (Invariant security: implement safe tar extraction with symlink/hardlink validation #8 / feat: SMARTS trading pipeline with Telegram notifications and Miro visualization #13). integrations.py — PUT /api/settings/a2a-endpoints returns enabled, the runtime outbound switch state the GET has reported since feat: add call_a2a_agent MCP tool for outbound A2A protocol calls #736. Gates, routes and schema are unchanged.
  • Tests: tests/unit/test_ent761_outbound_control_oss.py runs its own FastAPI app with no resolver provider registered. It pins the header and walks the three handlers' AST to assert they have no entitlement gate and keep assert_admin plus the human-only guard. It runs register → list → resolve-as-two-agents → remove and pins the 403 detail text the TS mapper matches on. src/mcp-server/src/tools/a2a.test.ts (+20 node:test cases). tests/registry.json.
  • Docs: user-docs/integrations/a2a-protocol.md (availability split by direction; MCP path next to curl; why the tier is admin), requirements/mcp.md §32.3/§32.5, architecture/{mcp-server,api-endpoints}.md, feature-flows/a2a-outbound-call.md.

Rulings carried (orchestrator, on the operator's behalf — plan file)

All four taste decisions were accepted as the planner recommended, with no deviations:

  • (a) agent_name is optional on the three outbound tools and described as ignored, because the registry is platform-wide.
  • (b) Writes stay admin + human-only and the routes are unchanged. A registration is a fleet-wide grant of a credentialed egress target. The issue's AC1 "owner/admin" wording is amended to admin by comment on the issue.
  • (c) The MCP outbound control tools manage the OSS store on every build, and get_agent_a2a_config signposts which list a call resolves against.
  • (d) call_a2a_agent behaviour is unchanged (only its description sentence is fixed), and the outbound kill switch still defaults OFF.

Review + security

/review (claude-fable-5-1, report-only, range 69ef0575..191fb445): MERGEABLE — 0 critical, 4 informational. These rider checks hold:

  • one store per question
  • the PUT enabled contract
  • the admin + human-only gate, with the kill switch default OFF
  • the seam rule (mechanism only)
  • .claude and src/backend/enterprise untouched across the range

Fixed in f6676650: I1 (bare a2a.ts pointer in the # mcp: header) and I4 (feature-flow wording). I2 is note-only: the A2A tab's per-agent panel is a separate registry, followed up under Handoffs. I3 was accepted: the sibling-fixture sys.path insert has 3 precedents. /cso --diff: 0 security findings.

Tests

Before merge

  • AC1 live check needs a running stack: register an endpoint through the MCP tool on an unlicensed instance, turn the outbound switch on, and run call_a2a_agent against it. The mechanism has a unit-level guard here; the live call does not.
  • File the follow-up for the A2A tab's separate per-agent registry (retire it or wire it to this store). The orchestrator ruled it must be filed before merge.
  • Re-run the merge-tree / single-head check if dev takes a migration first.

Handoffs

🤖 Generated with Claude Code

Trinity Agent (trinity) and others added 4 commits October 2, 2026 16:05
…ent#761, checkpoint A)

Outbound A2A control is available in every edition by ruling, but the three
MCP control tools proxied the entitlement-gated management router, so on an
unlicensed instance they answered `{ not_entitled: true }` — while the only
store the runtime outbound call resolves against is the platform-wide endpoint
store under /api/settings (#736), which every build already has.

Checkpoint A repoints the TypeScript layer at that store. No backend route,
service, schema or gate changes; the inbound plane (exposure, inbound
allow-list, the full config read, the served card) is untouched and keeps its
entitlement-aware mapper.

- client.ts: `registerA2AEndpoint(body)` → PUT /api/settings/a2a-endpoints
  (now carrying `clear_credentials`), `listA2AEndpoints()` → GET (endpoints +
  the outbound switch state), `removeA2AEndpoint(ref)` → DELETE by id or name.
  Each drops the agent-name argument it never sent: the store is platform-scope.
- a2a.ts: a second error mapper, `failOutbound`, on which `not_entitled` is
  structurally unreachable. The existing mapper infers that flag from the body
  text, so any 403 whose body mentions "a2a" told the operator to buy a licence
  for what was really an admin-tier or human-only refusal. The new one branches
  on status only.
- `agent_name` becomes optional on the three tools and is described as ignored
  on this build: a required-but-ignored argument invites a caller to register
  under one name, list under another, see the same rows and report a leak.
- `register_a2a_endpoint` reports `outbound_enabled` and, when the switch is
  off, names the one admin step that makes a registered endpoint callable —
  the switch default is unchanged. It also refuses `clear_credentials` together
  with `credentials` client-side, which the store would otherwise accept while
  silently dropping the supplied secret.
- `list_a2a_endpoints` refuses agent-scoped keys itself instead of running a
  `{self} ∪ permitted` lookup: its route is human-only rather than
  self-scoped, so that check denied a strict subset of what the backend denies
  while costing a round trip.
- `get_agent_a2a_config` gains `outbound_endpoints_note` and a description
  clause saying which of the two lists a call actually resolves against, so
  the divergence is signposted rather than silent.
- a2a_call.ts: its description claimed `list_a2a_endpoints` reads a different
  store and cannot name a callable target. That is false after the repoint.
- access.ts: the three ledger rows named an enterprise route; they now name the
  gate that really holds the line.

Tests (node:test, src/mcp-server): 656 pass, up from 636. Mutation-verified —
reverting the outbound mapper to the entitlement-aware one, re-adding the
"Enterprise feature" sentence to a description, and pointing the list method
back at the enterprise router each turn a specific test red; sources restored
byte-identical. `npm run build` (tsc) clean.

Checkpoints B (backend `# mcp:` header, PUT response `enabled`, pytest guard)
and C (docs) follow separately.

Refs abilityai/trinity-enterprise#761

Co-Authored-By: Claude Opus 5 <[email protected]>
…(ent#761, checkpoint B)

Backend half of the repoint: the three MCP outbound control tools now drive the
OSS `/api/settings/a2a-endpoints` routes, so the backend has to say so and has
to answer the question a write provokes.

- `routers/settings/__init__.py` line 1: `# mcp: none` was true when nothing
  external drove this package and is now false in the direction that hides a
  live surface from the only audit that looks for it. The header names the
  covering tool module and the exposed routes; every other route in the package
  stays a human-only grant surface (Invariant #8, #13).
- `PUT /api/settings/a2a-endpoints` returns `enabled`, the runtime-resolved
  outbound switch state the GET has reported since #736. The switch defaults
  OFF, so an operator who registers an endpoint on a fresh install otherwise
  gets a complete-looking registration and a dead call path; the tool layer
  turns `enabled: false` into the one admin step that fixes it. No gate change,
  no new route, no schema change.
- `tests/unit/test_ent761_outbound_control_oss.py`: own FastAPI app over the
  settings router with a real `models.User` admin principal and NO resolver
  provider registered, because that is the configuration the claim is about.
  Pins the header, walks the AST of the three handlers to assert they carry no
  entitlement gate and keep `assert_admin` + the human-only guard, exercises
  register -> list -> resolve (two different agents, same platform-scope row) ->
  remove, and pins the 403 detail text the TS mapper matches on.

Mutation-checked: reverting the header to `none` reddens the header pin;
dropping the `enabled` key reddens both switch cases. Both restored
byte-identical.

Co-Authored-By: Claude Opus 5 <[email protected]>
Docs half of the repoint. Checkpoints A and B made the three MCP control
tools drive the OSS platform-wide endpoint store; every doc that described
them as part of the entitlement-gated management plane was now false in the
direction that tells an operator a working capability is unavailable.

- user-docs/integrations/a2a-protocol.md: the Availability note splits by
  direction — inbound exposure needs the A2A capability, outbound control and
  calling work on every edition behind their own switch. The MCP tool table
  row says platform-wide (not per-agent) and names the list call_a2a_agent
  resolves against; Part 3 gains the MCP path beside the curl one, plus why
  the tier is admin rather than owner: the list is platform-wide, so a
  registration is a fleet-wide grant of a credentialed egress target, which
  Trinity keeps human-only. The A2A tab's own panel is labelled a separate
  per-agent registry in both places a reader meets it, because that is the
  divergence a licensed build still has.
- requirements/mcp.md: §32.3 records that outbound control left the entitled
  plane (admin-tier, every edition, a mapper on which not_entitled is
  unreachable, agent_name accepted and ignored) and amends the #736 read-gate
  bullet for list_a2a_endpoints only — against a platform-scope list
  "sibling" has no meaning, so the in-tool refusal replaces a check that
  denied a strict subset of the backend. §32.5 FR-2 records one store per
  question and why the PUT reports the switch state.
- architecture/mcp-server.md: the a2a.ts row is one module with two planes
  and two mappers; a2a_call.ts no longer claims its sibling is wholly
  entitlement-gated.
- architecture/api-endpoints.md: the a2a-endpoints cell is MCP-covered
  (Invariant #13), and these are the only routes in the settings package
  with a surface.
- feature-flows/a2a-outbound-call.md: the owner note asking whether per-agent
  scoping was monetization is replaced by the ruling that answers it; the
  registry layer row fixes a pre-#1028 path (routers/settings.py ->
  routers/settings/integrations.py); layers and Testing gain the control
  tools and their two test files.

Verified: the enterprise-docs-guard pattern is clean over all five files, no
"Enterprise feature"/"not licensed" text survives near the three tool names,
every in-page anchor resolves, and `npm run build` in src/mcp-server passes.
faq/collaboration.md was checked and needed no change — it already describes
outbound as admin-registered with no entitlement claim.

Co-Authored-By: Claude Opus 5 <[email protected]>
…rinity-enterprise#761)

/review findings I1 and I4, both one-line and non-functional.

I1 — `routers/settings/__init__.py:1` carried the only `# mcp:` pointer in
`src/backend/routers/**` spelled as a path (`tools/a2a.ts`); the other 24 use
the bare module name, and plan finding E7 had adopted the bare spelling. A
future tooling pass that resolves a pointer as `src/mcp-server/src/tools/<name>`
would have read `tools/tools/a2a.ts`. Now names the three covering tools and the
routes they cover. Every existing pin stays green: the header still begins
`# mcp:`, still contains `a2a.ts` and `a2a-endpoints`, and still carries no
`none` (test_ent761_outbound_control_oss.py::
test_settings_package_header_names_the_covering_tool_module).

I4 — the feature-flow test table said the F8 addition made management *reads*
(plural) gate agent-scoped keys. After ent#761 only `get_agent_a2a_config`
gates; `list_a2a_endpoints` refuses agent keys outright, which the same row's
ent#761 clause and requirements/mcp.md §32.3 already say. Reworded to "the
config read gates agent-scoped keys" so the one remaining fragment a reader
could misread is gone.

No code behaviour change. I2 (frontend per-agent store, orchestrator handoff
H3) and I3 (sibling-fixture `sys.path` insert, accepted as precedented) are
noted in the review with no action.

Co-Authored-By: Claude Opus 5 <[email protected]>
@vybe
vybe marked this pull request as ready for review October 3, 2026 08:02

@trinity-ability trinity-ability 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.

/validate-pr: Lane B, APPROVE. Tier 1 is green and dev-ci is green. Security greps are clean. Mutation checks went red as expected: pytest PUT enabled (2 red) and node failOutbound→fail (3 red). The backend routes are admin + human-only on GET/PUT/DELETE. The H3 follow-up is filed as abilityai/trinity-enterprise#779. The AC1 live-stack check was not run.

@vybe
vybe merged commit ec95bcc into dev Oct 3, 2026
26 checks passed
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