Repository navigation
feat(credentials): a credential ask can name a destination agent on another Trinity, delivered by merge under the asking agent's own key (abilityai/trinity-enterprise#1109) - #4262
Conversation
…nother Trinity, delivered by merge under the asking agent's own key (Abilityai/trinity-enterprise#1109) ent#1066's masked ask sinks the value into the asking agent's own `.env` and never shows it to the agent, so a hub Regent could not forward a secret to the agent it is building on the person's own instance. * `ask_for_credential` takes an optional `destination` `{instance_url, agent_name, key_env}` (`services/credential_destination.py`): the URL passes the outbound A2A gate (HTTPS, public or admin-trusted, no path) and is stored normalised; `key_env` is the NAME of the variable in the asking agent's own `.env` that holds its key to that instance — the key itself never travels through the ask or the tool call. Named 422s: `destination_invalid`, `destination_url_invalid`, `destination_agent_invalid`, `destination_key_env_invalid`, `destination_on_non_credential`. The receipt, the Workspace projection and the wake say where in plain words (agent + host, never the key name). * The sink's `_deliver_remote`: asking agent running, key read by name through its own read endpoint (`destination_key_missing`), URL re-validated at delivery and the connection pinned to the resolved address, one `POST {instance}/api/agents/{agent}/credentials/inject` with `{mode: "merge", env: {NAME: value}}` under that key; after a 2xx the staged value is removed — nothing rests here. Failures are plain retries: `destination_unreachable` (503; a timeout after the request left says `may_have_written`), `destination_key_refused`, `destination_agent_missing`, `destination_refused`. Audit `credential_delivered` carries host, agent and name — never the value or the key. The ent#1066 AST guard covers the new branch. * `POST /api/agents/{name}/credentials/inject` gains `mode: "merge"` with `env` (default `replace` unchanged): the sink's read-patch-inject leaf, so a delivery sets one line in place instead of rewriting the file. * `SystemAgentConfig.credentials` accepts a list of variable NAMES (the manifest member declaring what it needs; the map form stays unknown so a value is never read from a manifest). * MCP tool, types and tests; Workspace secret field reads "for your agent X on your Trinity at host" and "Nothing is kept here after delivery". The Regent's conversational wording and its pre-apply_system prompting are skill work outside this repo. Red first: 51 of 53 tests in `test_ent1109_credential_handover.py` fail on behaviour before the change; with the sink's destination branch removed, 11 delivery tests go red. Closes Abilityai/trinity-enterprise#1109 Co-Authored-By: Claude Fable 5.1 <[email protected]>
…bilityai/trinity-enterprise#1109) The receipt gained one key, `credential_destination` ({agent_name, host} | None), the way it gained `agent_ending` for ent#901. Three suites pin the receipt shape as a frozen literal and went red on Tier 1 (test_3247_replace_ask, test_ent611_native_ask, test_ent901_withdraw_ask — six tests). The shape change is the feature; the pins move with it. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…endpoint, under the outbound kill switch (Abilityai/trinity-enterprise#1109) The operator's ruling on the review: a credential ask could name ANY public HTTPS host as its destination, and delivery never consulted the outbound A2A switch. Now: * A destination's origin (scheme + host + port, the A2A client's own `_same_origin` normalisation) must equal that of an endpoint in the admin's outbound A2A endpoint registry (`a2a_outbound.list_endpoints`, through the EFFECTIVE provider so a module that scopes endpoints per agent counts) — at raise (`destination_not_approved`, 422, telling the agent an admin registers it under Settings → Integrations → Outbound A2A endpoints) and again at delivery (the same named 422; nothing read, nothing sent, the value unstaged). The registry entry is the approval only: `key_env` — the asking agent's own key — stays the credential; the entry's own is unused. * The outbound A2A kill switch (`a2a_outbound_service.is_outbound_enabled`: setting, then env, default OFF) governs this path at both points (`destination_outbound_disabled`, 422). * No resolver call at raise time (W4): `raise_ask` is synchronous under an async route. The registry entry was resolved when registered; delivery resolves off the loop through `a2a_client.validate_endpoint` and is the point that refuses a host that no longer passes (private address, DNS). * Normalisation keeps an IPv6 literal bracketed and keeps a trusted-network `http://` endpoint's scheme (W8). * The delivery transport (W1, W2, W3, W5, W6): an audit row `credential_delivery_attempt` is written BEFORE the request leaves; the request goes through the A2A client's capped reader (`_read_capped`, `A2A_ERROR_BODY_MAX_BYTES`, redirects refused, error bodies never read) under its total wall-clock deadline (`_with_deadline`); a 5xx from the destination is `destination_unconfirmed` — "may or may not have been stored", the value kept staged, like the timeout; a key that cannot travel as a header (whitespace, control or non-ASCII) is a named `destination_key_invalid` before any request; and the transport is pinned by a test that goes red if `follow_redirects` becomes True or `verify` becomes False. The mock destination in the suite is now a real `httpx.AsyncClient` over a `MockTransport`, so what the sink builds is what httpx would send. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ever echoed (Abilityai/trinity-enterprise#1109) A value pasted where a variable name belongs came back verbatim in the parse error (W7). The refusal now names the entry's position and the rule it broke. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…st", never "your" (Abilityai/trinity-enterprise#1109) Nothing on this instance ties the destination host to the person reading the sentence — the admin's endpoint registry ties it to the platform — so the card, the secret field's caption, the refusal copy, the wake and the docs drop "your". A mount test pins the PortalAsks sentence (W13). Co-Authored-By: Claude Fable 5.1 <[email protected]>
… the outbound switch; key_env is a stored name (Abilityai/trinity-enterprise#1109) Requirements (§3.11, security §20.11), the feature flow, the backend catalog entries, the sink's module docstring and the MCP tool's description now say what the code does: a destination must match an admin-registered outbound A2A endpoint, the outbound kill switch governs the path at raise and at delivery, no resolver runs at raise time, the attempt is audited before the request, and a 5xx is "may or may not have been stored". W10: security.md overstated — `key_env` is a NAME stored on the ask row's context like the rest of the ask (an admin reading the raw operator-queue row sees it); it is withheld from the person's projection, the receipt, the logs and the audit rows. The key's VALUE reaches nothing a reader sees. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Pushed by the merge train (lane C, operator ruling applied) — head
W12: AC3/AC6 (skill side) are stated as a follow-up in the PR body; no issue opened. Verification: ent1109 suite 75 pass; the six Tier 1 tests + their suites 289 pass; the touched/neighbouring backend suites 2185 pass (1 failure + 2 errors are local-environment only — |
…tial-handover # Conflicts: # src/backend/client_portal/asks/models.py # src/backend/client_portal/asks/service.py # src/mcp-server/src/types.ts # tests/registry.json # tests/unit/test_3247_replace_ask.py # tests/unit/test_ent611_native_ask.py # tests/unit/test_ent901_withdraw_ask.py
|
merge-train: merged |
trinity-ability
left a comment
There was a problem hiding this comment.
merge-train: lane C (/validate-pr + /review + /cso --diff at e054a57); the critical and every warning fixed on the branch per the operator's ruling — a destination is limited to admin-registered outbound A2A endpoints, the outbound kill switch governs delivery, copy no longer vouches for the host. Tier 1 green on 2b47aa5.
Summary
ent#1066's masked ask sinks the value into the asking agent's own
.envand never shows it to the agent, so a hub Regent could not forward a secret to the agent it is building on another instance. This is the platform half.ask_for_credentialtakes an optionaldestination {instance_url, agent_name, key_env}(services/credential_destination.py). A destination is limited to admin-registered instances: its origin (scheme + host + port, the A2A client's own_same_originnormalisation) must equal an endpoint in the outbound A2A endpoint registry — Settings → Integrations → Outbound A2A endpoints — read through the effective provider, so a module that scopes endpoints per agent counts. The registry entry is the approval only;key_env— the NAME of the variable in the asking agent's own.envthat holds its key to that instance — stays the credential, and the entry's own credential is unused. The outbound A2A kill switch governs the path (a2a_outbound_enabledsetting →A2A_OUTBOUND_ENABLED→ default OFF). Both are checked at raise and again at delivery. No resolver runs at raise time (raise_askis synchronous under an async route); delivery resolves off the loop viaa2a_client.validate_endpoint. Named 422s:destination_not_approved,destination_outbound_disabled(each tells the agent where an admin registers the instance),destination_invalid,destination_url_invalid,destination_agent_invalid,destination_key_env_invalid,destination_on_non_credential. Stored normalised (canonical host, default port dropped, an IPv6 literal kept bracketed, a trusted-networkhttp://scheme kept). Receipt, Workspace projection and the wake say where in plain words — "the agent X on the Trinity at host", never "your" (nothing here ties the host to the person; the admin's registry ties it to the platform) — and never the key's variable name._deliver_remote: switch + registry re-checked (nothing read, nothing sent on refusal), asking agent running, key read by name through its own read endpoint (destination_key_missing;destination_key_invalidwhen it cannot travel as a header value — whitespace, control or non-ASCII), URL resolved off the loop and the connection pinned to the resolved address (Host + SNI = the registered host), an audit rowcredential_delivery_attemptwritten BEFORE the request leaves, then onePOST {instance}/api/agents/{agent}/credentials/injectwith{mode: "merge", env: {NAME: value}}under that key througha2a_client._read_cappedunder_with_deadline(the client's byte cap, redirects refused, error bodies never read). After a 2xx the staged value is removed andcredential_deliveredis audited. Failures are plain retries:destination_unreachable(503; a connect failure unstages, a timeout after the request left saysmay_have_written),destination_unconfirmed(503; a 5xx or an unreadable answer — "may or may not have been stored", the value kept staged, since the receiving route's own 503 means exactly that),destination_key_refused(401/403),destination_agent_missing(404),destination_refused(other, or a redirect). Audit rows carry host, agent and name — never the value or the key. The ent#1066 AST guard covers the new branch; a test pins the transport (red iffollow_redirectsbecomes True orverifybecomes False).POST /api/agents/{name}/credentials/injectgainsmode: "merge"withenv(defaultreplaceunchanged;require_personuntouched — a user-scopedtrinity_mcp_*key already satisfies it): the sink's read-patch-inject leaf, so a delivery sets one line in place instead of rewriting the file.SystemAgentConfig.credentialsaccepts a list of variable NAMES; the map form stays unknown so a value is never read from a manifest; a bad entry is refused by position, never echoed.key_envis a NAME stored on the ask row'scontextlike the rest of the ask — an admin reading the raw operator-queue row sees it; it is withheld from the person's projection, the receipt, the logs and the audit rows.Follow-up (not in this PR)
AC3 (the Regent's conversational wording) and AC6 (its pre-
apply_systemprompting for eachcredentials:name) are skill work outside this repo, tracked under abilityai/trinity-enterprise#1109 itself; no new issue is opened here.Test plan
tests/unit/test_ent1109_credential_handover.py— 75 tests (registry approval at raise and delivery incl. the effective-provider path, the kill switch at both points, no resolver at raise, off-loop resolution at delivery, IPv6/http normalisation, the attempt audit, 5xx unconfirmed, redirect refused, oversized answer bounded, pinned transport, non-ASCII key, W7)test_3247_replace_ask,test_ent611_native_ask,test_ent901_withdraw_ask): the frozenRECEIPT_KEYSliterals gaincredential_destination— 289 pass/dataread-only foravatar.generate_default_avatars;opentelemetry.exportermissing for the route census)npm test: 1155 pass; the 2 failingtool-visibility.test.tsops-scope subtests are untouched by this PR (operator_queue.test.ts92 pass)portalCredentialField.mount.spec.js+ ratchets: 39 passCloses abilityai/trinity-enterprise#1109 (cross-repo: close manually at release)
🤖 Generated with Claude Code