Skip to content

DO NOT MERGE — merge train: 4402,4401 - #4430

Closed
trinity-ability wants to merge 14 commits into
devfrom
train/20261110-0028
Closed

trinity-ability wants to merge 14 commits into
devfrom
train/20261110-0028

Conversation

@trinity-ability

Copy link
Copy Markdown
Contributor

Integration surface for #4402, #4401. Never merged; members merge individually once green.

🤖 Generated with Claude Code

Trinity Agent (trinity) and others added 14 commits November 9, 2026 15:03
… settings (ent#1174 A)

- manifest: person_seats entries accept holder: member (primary only, one per
  agent); an email still refused, the refusal now names holder: member (T1, T6)
- dependencies.can_seat_member: a person (JWT or own user key) who passes the
  admin gate (operator ruling T2)
- services/reserved_settings: a module-owned settings key is refused on the
  generic PUT/DELETE and hidden from a key caller's GET/list (E3); OSS names
  no key

Refs abilityai/trinity-enterprise#1174

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (ent#1174 B)

- assignment_provider: optional member_seat_status / seat_member hooks and
  their wrappers; neither carries a person (S1)
- seats: holder: member planned as op member_seat_set (seat_missing) when the
  caller may write it, else seat_filled / member_seat_differs /
  member_not_recorded / seat_requires_interactive_admin reports; partial is
  written again; landed writes audited (action share, via apply_member_seat,
  no address)
- system_service: snapshot reads the member seat for members to create too
  (E1); member_writer = can_seat_member; a key writes it only on a member this
  run creates or one its owner owns (E4); op ordered after seat_set

Refs abilityai/trinity-enterprise#1174

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…text, docs (ent#1174 C)

- tests/unit/test_ent1174_journey.py: AC4 + AC2 end to end with the real
  assignments module on the real seam — apply with an admin-owned user key
  seats and shares the recorded member, the Workspace roster lists the agent,
  the door mints a code and hands the account to /login; admin-role and
  user-role members keep their role (operator ruling R31). Skips on OSS.
- MCP apply_system manifest parameter names holder: member (description
  budget unchanged, 77/77 MCP tests)
- requirements roadmap/mcp + system-manifest flow; tests/registry.json

Refs abilityai/trinity-enterprise#1174

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… destination shape (abilityai/trinity-enterprise#1158)

Checkpoint 1 of 5.

- The Workspace answer path refuses 409 `destination_unreadable` when a
  credential ask names a destination `destination_of` cannot read. Before
  this, such a row fell through to a write into the asking agent's own
  `.env`. New predicate `credential_destination.carries_destination`.
- `credential_destination.validate` accepts a second shape,
  `{instance, agent_name}`: the name or id of an outbound A2A registry
  entry. It is resolved through `a2a_outbound.resolve_endpoint` for the
  asking agent and reduced to metadata (`instance_entry`). It is stored as
  `{instance, endpoint_id, instance_url (origin), agent_name}`.
- Raise refusals: `destination_invalid` (`ambiguous_shape`/`missing_field`),
  `destination_instance_invalid`, `destination_not_approved`/`instance_unknown`,
  `destination_instance_no_credential` (`no_credential`/`aauth`/`payment_token`).
- `_origin` no longer checks the path. The base-URL check stays in
  `validate_instance_url`, and the new `origin_of` normalises an entry's
  A2A URL to its origin. The userinfo message no longer names key_env.

Delivery for the instance shape lands in checkpoint 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… one audit row per delivery (abilityai/trinity-enterprise#1158)

Checkpoint 2 of 5.

- `credential_sink._resolve_instance_key` is the resolve point: the registry
  entry by its STORED id, through `a2a_outbound.resolve_endpoint` for the
  asking agent, every delivery (a rotation applies to the next one).
  Refusals in order: `destination_not_approved`/`instance_unknown`,
  `destination_not_approved`/`instance_moved` (the entry's origin changed
  since the ask), `destination_instance_no_credential`
  (`no_credential`/`aauth`/`payment_token`, the raise's own `entry_problem`),
  `destination_key_invalid` (not header-safe). Carries the ent#1200 grant
  seam comment.
- `_deliver_remote` branches on `instance`: the switch, then the resolve
  point (it subsumes the origin-registry check for this shape, so a moved
  entry is named `instance_moved`, not `not_registered`). The asking agent's
  `.env` is never read.
- One `credential_instance_delivery` audit row in a `finally` over the whole
  instance path, with the outcome (`delivered` or the refusal code) and
  `may_have_written`; never a value or key. The ent#1109
  `credential_delivery_attempt`/`credential_delivered` rows stay for
  `key_env` only. A names-only log line is written before the send.
- `destination_key_refused` names "the key registered for that Trinity" on
  the instance path.
- ent#1066 AST guard: `_deliver_remote_once` joins the value's allowed
  delivery steps; a new key guard covers `_resolve_instance_key`,
  `_read_key_by_name` and the send (names `key`/`found`/`credential`/
  `headers`/`item` and any `.credential`), with a planted-leak self-test;
  `asdict`/`vars`/`astuple` are refused in the sink and destination modules.
- `credential_destination._metadata` is now public as `entry_metadata`.

Mutation check: disabling the `instance_moved` branch turns 4 tests red;
disabling the audit row in the `finally` turns 10 red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ai/trinity-enterprise#1158)

A credential ask whose destination names key_env failed only at delivery,
after a person had typed the secret. The raise route now reads the asking
agent's own .env first:

- credential_sink.classify_key is the one ok/missing/invalid decision for
  both the raise check and delivery (_read_key_by_name), so they cannot
  drift. Whitespace-only or header-unsafe is "invalid" on both sides (T7).
- credential_sink.key_env_state returns only the label, never the key: the
  Docker lookup runs off the event loop, the whole read sits inside a 5 s
  budget, and anything it cannot tell is None (T2: fail open, delivery
  re-checks). _agent_client gains a timeout= parameter.
- raise_my_ask reads key_env only for a credential ask with a shape-valid
  key_env destination (never an instance destination) and passes the label
  as raise_ask(destination_key_state=), default None for gate/file callers.
- raise_ask applies it after the replay and every earlier refusal (caps,
  rate, deadline, re-ask, replace, no_person), before the chat attachment
  and the create: 422 destination_key_env_missing / destination_key_invalid,
  naming destination.instance as the way forward.

Delivery change from the shared classifier: a quoted whitespace-only key is
now destination_key_invalid at delivery (was destination_key_missing).

Red first: tests/unit/test_ent1158_key_env_raise_check.py (44 tests). With
the raise_ask call and the route passthrough removed, three go red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…MCP tool (abilityai/trinity-enterprise#1158)

- file-guardrail: a .env / .env.* denial now names ask_for_credential with
  destination.instance as the way to hand a credential to an agent on another
  Trinity; other protected paths keep their reason. Ships in the base image, so
  running agents show the old text until rebuilt and recreated.
- platform prompt: one sentence beside the protected-paths line carries the
  same pointer, on every runtime and tier (environment block stays under its cap).
- MCP ask_for_credential: destination accepts exactly {instance, agent_name}
  (instance 1..200) or {instance_url, agent_name, key_env} via superRefine; the
  handler forwards only the matched shape's declared fields; the description
  leads with instance and lists the raise refusals.

Red first: test_ent792 .env reason, test_ent945 protected-paths sentence,
operator_queue.test.ts schema/forwarding/description (4 failing) — all green now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rinity-enterprise#1158)

Journey test (tests/unit/test_ent1158_credential_key_journey.py): an admin
registers an instance with its key through the real upsert_endpoint and a
real encrypted envelope, the asking agent raises over the real raise_my_ask
route naming destination.instance (201), the person answers through
provide_credential, the remote instance receives one merge inject under the
entry key, the ask is provided, one credential_instance_delivery row, the
asking agent's .env byte-identical. Variants: the entry key cleared before
the answer (destination_instance_no_credential, nothing sent) and a key_env
destination without the variable (destination_key_env_missing at raise).

Red at base 13d32e2 with the six backend files reverted (3 failed: the
instance shape refused missing_field; the key_env raise not refused), and
with only credential_sink.py reverted (3 failed: KeyError key_env at
delivery; no key_env_state). Green on this branch.

Docs: the credential-in-chat flow, requirements/credentials.md 3.11,
requirements/security.md, architecture/mcp-server.md and backend.md lead
with the instance form, keep key_env as the older form, list the named
refusals, state both key-reuse cases and that the entry key needs inject
rights on the receiving instance, and the rollback caveat. The ent#1109
"its own credential is never used" / "asking agent's own key" wording is
corrected. tests/registry.json registers the three ent#1158 files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
M1: the delivery-key AST guard now watches classify_key {key, found} and
key_env_state {env_text}, and a second pass scans
credential_destination.entry_metadata for any carried .credential. A
logger.info("leak %s", key) planted in classify_key turns
test_the_sink_module_never_interpolates_a_delivery_key red; it was green
before.
L1: the ask_for_credential destination description names the delivery-time
refusals (instance_moved, destination_unreadable, destination_key_refused),
pinned in operator_queue.test.ts; mcp-server.md says what it lists.
L2: credential-in-chat.md says the instance delivery runs check_switch plus
resolve-by-id and origin equality, not check_deliverable.
I3: set_env_value docstring covers the instance shape.

No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nt_shared (ent#1174)

- assignment_provider: `entitlement_missing` is a member-seat state; the
  provider's own entitlement name rides on it as `entitlement_missing:<name>`
  (id-shaped only), so OSS names no module's entitlement.
- seats._plan_member_seat reports `entitlement_missing` with a note naming it,
  instead of `seat_unobserved`.
- seats.run_member broadcasts the share route's `agent_shared` event through
  routers.sharing.manager when the write shared the agent — identifiers only
  ({name}, #918), so rosters and sharing panels refresh.
- Tests: named/unnamed/malformed entitlement, the broadcast (and none without
  a new share), create mode (deploy_system) never reads or writes
  `holder: member` under a session, a user key or an agent key.
- docs: flow notes; mcp.md's stale apply_system length (1,983 -> 2,033).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…telegram backfill load (ent#1174)

test_telegram_webhook_backfill loads routers/settings/generic.py by file
spec over stub modules. ent#1174 made generic.py import
`is_interactive_principal` from `dependencies` and `reserved_settings`
from `services` inside the settings routes; the stubs had neither, so all
four tests failed with ImportError (reproduced at 6f90345, seed 12345).

Add `is_interactive_principal` to the dependencies stub and stub
`services.reserved_settings` (managed_by -> None). Fixing that exposed a
second, pre-existing gap: generic.py's module-level
`from services.terms_service import SETTING_KEYS` resolved only by
borrowing a real module an earlier file had imported, and fails when the
file runs alone. Stub it too. Both go in _STUBBED_MODULE_NAMES so they
are restored after each test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…i/trinity-enterprise#1158)

The raise path caps an agent's pending asks at 25 (`_max_pending`), counted in
the session's DB through `ask_service.db`. Every raise in this file leaves a
pending ask for ASKER and none is ended, so under a shuffled order the count
passes 25 and the next raise is `queue_full` — red on the file ALONE with
`-p randomly --randomly-seed=12345` (the exact 7 CI failures), not only with
neighbours. The `ask` fixture now ends ASKER's pending asks in `svc.db`, the
store the raise counts in, before each test. Test-only, no product change.

Red before (seed 12345, with ent1109/ent611/the other ent1158 files): the 7
named tests; green after; 0 failures in this file across 20 seeds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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