Skip to content

feat(aauth): graduate the agent identity for Trinity-to-Trinity calls — flag split, Settings surface, outbound endpoint UI (abilityai/trinity-enterprise#862, PR1) - #3699

Merged
vybe merged 1 commit into
devfrom
feature/ent862-aauth-graduate
Oct 14, 2026
Merged

vybe merged 1 commit into
devfrom
feature/ent862-aauth-graduate

Conversation

@vybe

@vybe vybe commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Part 1 of 3 for abilityai/trinity-enterprise#862 (plan approved 2026-10-13 after strategy/engineering/security reviews and an independent Gemini critique). PR2 brings the core inbound aauth: allow-list + per-agent toggle; PR3 the execution-record attribution.

  • Flag split (N3): new aauth_enabled (system_settings → AAUTH_ENABLED → off) governs Flows 1–4 and is the single input of config.active_issuer(); aauth_prototype_enabled is narrowed to the person-token / resource-calling prototypes, gated once at aauth_person.require_live on both switches. Forwarded in docker-compose.yml / .prod.yml / .hosted.yml as ${AAUTH_ENABLED:-} (empty default, so the Settings row stays the observable source — verified with docker compose config on all three) and set outright in the two-instance harness. aauth_available on GET /api/settings/feature-flags.
  • GET/PUT /api/settings/aauth: admin on read; admin and require_interactive on write (agent-, user- and system-scoped keys all 403); the body carries only the fields changed; 422 {reason: invalid_issuer | invalid_person_server | invalid_resource_allowlist} named, never repaired; audited aauth_config_change. The generic PUT/DELETE /api/settings/{key} refuses all five aauth_* keys.
  • Settings → Integrations: AAuthPanel (toggle + issuer, "On, inactive" when the issuer is invalid, env-sourced values shown read-only, confirm before changing a live issuer, a four-item federation-readiness checklist each naming its next step, the stated limits) and A2AEndpointsPanel over the OSS registry (/api/settings/a2a-endpoints): register/update by name with auth_scheme (the aauth choice hides the credential field and warns a stored one is dropped), remove asks first, bounded table, the outbound kill switch. MCP register_a2a_endpoint gains auth_scheme and refuses a credential with it before any round trip.
  • Docs: requirements §32.8 FR-1 rewritten + FR-8, §32.9/§32.10 status; the feature flow; backend/frontend catalogs; flows index; learnings fragment; /cso diff report.

Security review

/cso --diff — 1 finding, MEDIUM, pre-existing on dev, independently verified, closed in this PR: aauth_person_server / aauth_resource_allowlist were writable through the admin-only generic catch-all (which admits an admin's user-/system-scoped MCP key); both now live on the interactive-only route and the catch-all refuses them. Report: docs/security-reports/cso-diff-2026-10-13-ent862-aauth-settings.md.

/review — one outside-the-diff writer of a newly refused key (scripts/dev/aauth_prototype/demo.sh) found and moved to the route; learnings fragment captures the class.

Changes

Backend: services/aauth/{config,settings}.py, routers/settings/{aauth,generic,flags,__init__}.py, routers/aauth_person.py, models.py, services/aauth/{resource_allowlist,whoami}.py · MCP: tools/a2a.ts, client.ts · Frontend: components/settings/{AAuthPanel,A2AEndpointsPanel}.vue, stores/a2aFederation.js, utils/aauthSettings.js, views/Settings.vue · Deploy: three compose files, compose.b.yml, .env.example, demo.sh · Docs + tests.

Test Plan

  • cd tests && pytest unit/test_ent862_aauth_settings.py -v — 51 pass (flag matrix, require_live 4-arm, route principal matrix, five-key generic-door refusals, compose wiring)
  • AAuth / settings-package / auth-guard suites: 421 + 144 pass (test_ent623_*, test_ent878_*, test_ent879_*, test_1028_settings_package, test_293, test_2996, test_1310, test_186, test_2094, test_ent435)
  • MCP: npm test 936 pass, tsc --noEmit clean
  • Frontend: npm run test:unit 5,868 pass incl. 29 new (two mounted panel specs — each proven able to go red by mutating the component; raw-color / loading-gate / source-text ratchets unchanged)
  • AAUTH_ENABLED=true docker compose -f <each> config renders the variable on all three stacks
  • Manual: toggle both panels in light and dark and watch what moves (design-contract principle 29) — not yet done by a human
  • Full backend unit island on the final tree — running at PR-open time; result posted as a comment

Cross-repo: the issue stays open (closing keywords do not cross trackers); it is closed at release after PR3.

Part of abilityai/trinity-enterprise#862

🤖 Generated with Claude Code

… — flag split, Settings surface, outbound endpoint UI (Abilityai/trinity-enterprise#862, PR1)

Two switches now: `aauth_enabled` governs Flows 1–4 (well-knowns, signing,
inbound verification, card) and is the single input of `active_issuer()`;
`aauth_prototype_enabled` is narrowed to the person-token and resource-calling
prototypes, gated once at `require_live` on BOTH switches. Forwarded in every
backend compose file with an empty default so the Settings row stays the
observable source; `aauth_available` on the feature-flags surface.

`GET/PUT /api/settings/aauth`: admin on read, admin AND interactive on write
(no MCP key of any scope), diff-only body, named 422 for an invalid issuer,
person server or resource allow-list, audited `aauth_config_change`. The
generic `PUT/DELETE /api/settings/{key}` refuses all five `aauth_*` keys —
the two Flow 5–6 keys were the one MEDIUM `/cso --diff` found (pre-existing;
cso-diff-2026-10-13-ent862-aauth-settings).

Settings → Integrations gains an AAuth panel (honest "On, inactive" state,
env-sourced values read-only, confirm before changing a live issuer, a
federation-readiness checklist, the stated limits) and an outbound A2A
endpoints panel over the OSS registry with `auth_scheme`; MCP
`register_a2a_endpoint` takes `auth_scheme`. The two-instance demo script
moves its generic settings writes to the dedicated route.

Tests: tests/unit/test_ent862_aauth_settings.py (flag matrix, route principal
matrix, generic-door refusals, compose wiring); mounted vitest specs for both
panels (each proven red by mutation); MCP a2a.test.ts auth_scheme cases.

Part 1 of 3 for Abilityai/trinity-enterprise#862.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@vybe vybe added the ui PR touches the frontend UI — triggers Playwright e2e tests label Oct 14, 2026
@vybe

vybe commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Full backend unit island on the final tree (python3 -m pytest unit, serial, 22 min): 26,811 passed, 99 skipped, 14 xfailed, 8 failed, 2 errors.

All ten are host-environment, and the identical set reproduces on a clean origin/dev scratch worktree (7 failed, 2 errors in the same three files; the eighth needs the full run to appear):

  • test_2996_route_census_runtime.py ×2 errors — the census subprocess can't import main here (No module named 'opentelemetry.exporter'); the static test_2996_human_only_routes.py is green with the new routes.
  • test_3434_removed_routes.py ×1 — same live-route-table subprocess.
  • test_ent679_payments_pin_parity.py ×6 — local venv versions vs the image pins (no pin changed in this PR).
  • test_1310_auth_consolidation.py::test_admin_sites_admit_admin[avatar.generate_default_avatars] — tries to create /data/avatars on the host (read-only /data); avatar router untouched.

CI runs these with the image's dependency set and /data, so the per-PR job is the verdict for those ten.

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

Validated via /validate-pr (Lane C: compose files). Tier 1 green incl. pytest head + regression diff; PR-side journey-smoke and e2e green; dev-ci success on the dev tip. Local: 154 tests pass across the new suite and the auth/settings guards; mutation of the generic-catch-all refusal and the interactive gate each turn the new tests red.

@vybe
vybe merged commit cf39aca into dev Oct 14, 2026
28 of 30 checks passed
@vybe

vybe commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

PR Validation Report (/validate-pr)

Lane: C (compose files: docker-compose.yml, .prod.yml, .hosted.yml) · no schema flag · 41 files (+2088/−45)

Category Status Notes
Commit Messages ✅ single conventional feat(aauth): commit
Base Branch ✅ dev
PR Size ✅ 41 files, under the split threshold
Status Auto-Promotion ➖ Part of abilityai/trinity-enterprise#862 by design (PR1 of 3; issue closes at release after PR3)
Roadmap ✅ ent#862 resolves: priority-p1, type-feature, status-in-progress
Requirements ✅ docs/memory/requirements/mcp.md §32.8 FR-1/FR-8, §32.9/§32.10
Architecture ✅ architecture/backend.md, architecture/frontend.md catalogs
Feature Flows ✅ a2a-aauth-agent-identity.md + index entry (pre-existing flow keeps its Flow 1–6 layout rather than the template headings)
Security Check ✅ §4.1–4.6 clean; enterprise-docs-guard pattern: no hits on added lines
Infrastructure ✅ compose: AAUTH_ENABLED=${AAUTH_ENABLED:-} on all three stacks, justified in body
Build Packaging ➖ no new top-level src/backend/ directory
Config Packaging ✅ AAUTH_ENABLED wired in docker-compose.yml, docker-compose.prod.yml, .env.example (and .hosted.yml); pinned by test_every_backend_compose_file_forwards_the_flag_with_no_default
File Modes / Host Paths ✅ none
Structural Review ✅ author's /review + /cso --diff (report in docs/security-reports/cso-diff-2026-10-13-ent862-aauth-settings.md)
Merge Gate ✅ Tier 1 green incl. pytest (head, seed 12345) + regression diff; Lane C: journey-smoke + e2e green on the PR; dev-ci success on 11db30e before merge
Test Adequacy ✅ non-happy paths: non-admin 403, agent/user/system MCP keys 403, invalid issuer/person-server/allowlist 422 by name, generic PUT/DELETE refusal ×5, LoadFailed on failed fetch, confirm-cancel sends nothing
Code Quality ✅ Router → Service split (Invariant #1), models in models.py (#14), route registered before the /{key} catch-all (#4), require_interactive on the grant route (#2996)
Requirements Trace ✅ ent#862 plan N3 flag split

Execution coverage (§5.4)

changed symbol / test file executed by live consumer verdict
config.active_issuer / prototype_active_issuer / is_prototype_enabled test_ent862::test_flows_5_and_6_need_both_switches, test_require_live_gates_* (4-arm) routers/aauth_person.py::require_live; routers/settings/flags.py ✅
settings.get_state / apply_update test_ent862 GET/PUT via TestClient (22 tests) routers/settings/aauth.py ✅
generic.update_setting / delete_setting refusal test_the_generic_{put,delete}_refuses_the_aauth_switches ×5 live route ✅
AAuthPanel.vue / A2AEndpointsPanel.vue mounted jsdom specs (*.mount.spec.js) driving the rendered panel and asserting the request bodies views/Settings.vue ✅
utils/aauthSettings.js aauthSettings.spec.js AAuthPanel.vue ✅
MCP register_a2a_endpoint.auth_scheme a2a.test.ts ×3 (forwarded, refused with credential, schema enum) client.ts ✅

Mutation (run locally in the PR worktree): disabling the generic catch-all refusal → 5 tests red; swapping require_interactive for get_current_user on the PUT → 2 tests red (user- and system-scoped keys; the agent key is still caught by assert_admin). Restored, 51/51 green; 154 pass across the new suite + test_1028, test_2996, test_ent435, test_293.

Issues Found

  • Critical: none
  • Warnings: none
  • Suggestions: the manual light/dark toggle check in the Test Plan is still unticked; the pre-existing aauth_prototype_enabled=true installs lose Flows 1–4 until aauth_enabled is set (intended by N3; worth one line in the release notes).

Recommendation: APPROVE — merged as cf39aca4. ent#862 stays status-in-progress (PR1 of 3; cross-tracker, manual close at release).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ui PR touches the frontend UI — triggers Playwright e2e tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants