Skip to content

fix(asks): an answer to an approver ask needs the approver seat - #4181

Merged
vybe merged 1 commit into
devfrom
feature/ent1053-approver-fence
Nov 2, 2026
Merged

vybe merged 1 commit into
devfrom
feature/ent1053-approver-fence

Conversation

@vybe

@vybe vybe commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes abilityai/trinity-enterprise#1053. An ask addressed to: approver can now be answered only by a person seated as approver, the same way asks addressed to a role id already are.

What

  • ask_service._seat_fenced: the clause is to_role == "approver" and _resolved_people(row). An admin outside the seat is refused with 403 not_addressee and a message naming the role and the remedy.
  • Rows with an empty seat snapshot, raised before seats existed, stay answerable as today. A new ask cannot have one: the resolver refuses an unfilled approver seat.
  • Cancel is not narrowed, so anyone with access can clear an ask nobody seated will answer.
  • The card goes read-only before the click, from the same predicate.
  • Docs and the ask_operator to description now say the seat routes and restricts.

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

Fence by snapshot, not by date; cancel unfenced; refusal through role_message; the addressed view from the shared predicate.

Review + security

/review (Fable, report-only): MERGEABLE. Every answer door reaches the one predicate; /cso --diff clean. Recorded: drop_addressee could empty a snapshot after raise and reopen a row (hypothesis, its only caller is gate-only); the answering MCP tool's description does not list not_addressee.

Tests

test_ent1053_approver_answer_fence.py, 18 through the real router and Workspace door, 7 red on base. 476 + 740 across the neighbours; 15 ask_service suites shuffled, green. Not run here: full island (CI), live tiers.

Before merge

  • Behaviour change on live installs: an admin who answered approver asks outside the seat is now refused. It needs a release-note line.
  • A read-only check of what legacy approver rows hold on a live install: NULL and [] stay open, and an unparseable value already breaks the row reader.

🤖 Generated with Claude Code

Release notes (added at merge-train, 2026-11-02)

  • Behaviour change on live installs. Pending to: approver asks that have a non-empty seat snapshot become seat-only at deploy. An admin outside the seat, who could answer them before, is now refused with not_addressee, but can still cancel. Legacy approver rows with a NULL or [] snapshot stay open to anyone with access.

…seat (trinity-enterprise#1053)

An ask an agent addressed `to: approver` was delivered only to the people
seated as approver, but anyone with access to the agent could answer it.
`ask_service._seat_fenced` -- the one predicate `may_end` (every answer door)
and `addressed_view` share -- now fences that answer to the raise-time
`resolved_to` snapshot, as ent#1042 did for `role:<id>` asks.

- Carve-out by snapshot: a legacy `approver` row with an empty or unreadable
  snapshot stays answerable by any person with access. A new one cannot be
  empty (an unfilled seat is refused `role_unassigned` at raise).
- Cancel and bulk cancel are not narrowed; an admin outside the seat may
  cancel, never answer.
- The refusal names the approver role through `role_message`
  (`_fenced_role_of`), at the Operations and Workspace doors; the MCP
  respond tool inherits the Operations route.
- `addressed_view` widens through the shared predicate: the card goes
  read-only before the click.

Tests: new route-executing `tests/unit/test_ent1053_approver_answer_fence.py`.
Red before the change (7 failed: a person outside the seat got 200, the
refusal and the view were missing); the empty-snapshot rows were green before
and after. The three `approver` parametrizations in
`test_ent1042_role_answer_fence.py` are dropped, because `approver` is no
longer unfenced. Docs: requirements/security.md, feature-flows/operating-room.md,
user-docs approvals, and the MCP `ask_operator` `to` description.

Release note: on live installs, pending `approver` asks with a seat snapshot
become seat-only to answer at deploy; rows without a snapshot are unaffected.

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

@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 — APPROVE

Lane B (ask_service.py; tests/ contains deleted lines, the three approver cases moving out of the 1042 file) · no schema · surface touched (src/mcp-server/src/tools/), so Step 6.6 applies.

Category Status Notes
Base / size / commits ✅ dev, 8 files (+443/−23), conventional message citing the issue
Issue link ✅ Fixes abilityai/trinity-enterprise#1053 resolves (P2, status-ready, ruling recorded on the issue). Cross-tracker: no auto-promote, so set status-in-dev by hand after merge and close it manually at the release cut
Requirements / flows / user docs ✅ requirements/security.md, feature-flows/operating-room.md, user-docs/automation/approvals.md and the ask_operator to text all say the approver seat routes and restricts, with the empty-snapshot carve-out
Security §4.1–4.10 ✅ no keys, emails, IPs, host paths or mode changes; enterprise-docs-guard pattern over added lines: 0 hits
Build / config packaging ➖ no new package, no new env var
Structural review ✅ /review report-only run on this tip: MERGEABLE; /cso --diff clean
Merge gate (Tier 1) ✅ every PR check green, incl. pytest (head, seed 12345) and regression diff; dev-ci on dev: success; no open dev-ci red issue
Test adequacy ✅ 18 new tests go through the real Operations route and the Workspace door; non-happy paths covered (outside-seat person, admin outside the seat, legacy NULL/[] rows, cancel not narrowed, single and bulk)
Product fit ✅ Built to the recorded ruling. One predicate is extended, not a new home; the refusal is a named 403 not_addressee; the card goes read-only from the same predicate

Execution coverage (§5.4), checked independently in the PR worktree

changed symbol executed by live consumer verdict
_approver_seated / _seat_fenced clause TestRoute::*, TestProjection::* may_end → /respond, /cancel, bulk-cancel, Workspace answer; addressed_view → queue person view ✅
_fenced_role_of test_a_shared_person_outside_the_seat_is_refused, TestPortalDoor::test_the_workspace_sink_layer_names_the_role answer() and cancel() refusals ✅
ask_operator to description — schema served over MCP description text

Mutation: branch → test_ent1053… + test_ent1042…: 51 passed. With ask_service.py reverted to the base commit, test_ent1053… gives 7 failed / 11 passed. The 7 red tests are exactly the fence tests: outside-seat ×2, approver question, admin answer refused, Workspace refusal wording, both projection cases. The 11 green tests cover the behaviour the ruling keeps unchanged.

Warnings (non-blocking)

  • Fail-open on an emptied snapshot. "Empty snapshot ⇒ legacy ⇒ unfenced" also matches a seated row whose snapshot is emptied after the raise (drop_addressee → resolved_to = kept or None). Then anyone with access can answer it again. That function has no caller in this tree, so this is only a hypothesis here. If a caller ever uses it on approver rows, a raise-time marker would be safer than snapshot emptiness for telling the two cases apart.
  • The answering MCP tool's description (respond_to_operator_queue) does not list not_addressee yet; that's a small follow-up.

Before merge (carried from the PR body, still open)

  • Release-note line: pending to: approver asks that have a non-empty seat snapshot become seat-only at deploy. An admin outside the seat, who could answer them before, is now refused with not_addressee, but can still cancel.
  • Read-only check of legacy approver rows on a live install: confirm they hold NULL / [] (these stay open) and nothing unparseable (the row reader already rejects that).

@vybe
vybe marked this pull request as ready for review November 2, 2026 17:31
@vybe
vybe merged commit c4ec75f into dev Nov 2, 2026
27 checks passed
webmixgamer added a commit that referenced this pull request Nov 13, 2026
… the agent, and is refused by name when none can (#4501) (#4506)

An ask addressed `to: approver` was filed for whoever the seat provider
named, with no reach check. Since the approver answer fence (#4181) only the
people recorded at the raise may answer, so a seated approver the agent is not
shared with became the one person allowed to decide an ask they could never
see: 201 with `resolved: true`, a 404 for them, `403 not_addressee` for
everyone else.

The raise now records only the seated approvers who can open the agent
(`role_addressing.resolve_approver_for_ask`, the rule `role:<id>` asks and
gated-skill approvals already apply) and refuses `422 role_cannot_open_agent`
when none can. Nothing is filed; the refusal names the role and is logged.

Mutation: with the call in `ask_service._address` reverted to the plain
resolution, six tests in `tests/unit/test_4501_approver_reach.py` go red.

Fixes #4501

Co-authored-by: Claude Fable 5.2 <[email protected]>
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