Repository navigation
feat(asks): admin seat, re-address by rule, and refusals that name who a card waits for (abilityai/trinity-enterprise#1096) - #4559
Conversation
… (abilityai/trinity-enterprise#1096, C1)
The decider order (primary → owner → instance admin) had no answering path
for its third arm: a gate approval with an empty snapshot waited on nobody.
OSS sink half:
- R1: a gate raise may address nobody only with the platform's new
`workspace_decider_seat = admin` stamp (a `_PLATFORM_CONTEXT_KEYS` member,
stripped from agent content).
- R8: `may_end`'s admin arm decides a stamped, empty gate approval only for
a principal passing the admin gate and the person rule; `addressed_view`
reports the same answer plus `waiting_on_seat` on stamped rows.
- R4: `readdress_item` compares stamps, a None stamp removes its key; an
`actor` makes the audit row carry the admin and `has_reason`.
`ADMIN_READDRESSED` joins the readdress reasons.
- R5: answer/cancel on a seat-fenced row compare the stored address in the
CAS; a lost compare is `AskConflict("readdressed")`.
- R6: `bulk_cancel` skips fenced rows the actor is not addressed on
(`Ending.skipped_fenced`).
- R7: `AskNotAddressee` carries `waiting_on`/`seat`; the message names the
person for gate approvals only; role refusals stay person-free.
- R9: the admin arm records `admin:<username>` for an admin with no email.
- Resolver registry (`register_readdress_resolver`) for platform families
under `gate-`; R12 docstring on `readdress_role`.
Tests: tests/unit/test_1096_admin_seat_fence.py (62); the ent#715 reader
table classifies the two new row readers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… refusals (abilityai/trinity-enterprise#1096, C2)
- POST /api/operator-queue/{id}/readdress {to: rule|admin, reason}:
require_admin + require_person (grant-vs-use: human-only), row visibility
as the read's, `ask_service.admin_readdress` re-runs the rule that raised
the card (registered family resolver, or the role) or takes a registered
family's gate approval to the admin seat (R2/T2, no person picker; a
skill-gate approval is refused the admin seat, T3). 409
audience_unchanged names who it waits for; 422 unknown_family.
- /cancel: an admin ending a fenced card they are not on must give a
reason (422 reason_required, `AskReasonRequired` in the sink).
- /bulk-cancel returns `skipped_fenced` (R6).
- 403 not_addressee on Operations and Workspace carries `seat` and, except
on role refusals (the ent#1042/#1053 "never a person" contract),
`waiting_on`; admin verbs on Operations only (R11). An ending that lost
to a re-address is 409 `readdressed` (people named on Operations only).
- R14: `# mcp:` header names readdress as a human-only admin verb.
Re-pinned in this checkpoint: test_ent751_gate_dispatch (admin cancel now
needs a reason), test_ent611_ask_endings (bulk body gains skipped_fenced),
test_ent715_queue_person_fields (new door + readers classified).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts for (abilityai/trinity-enterprise#1096, C3) The server's 403 `not_addressee` now names the seat and the person (C2). `notAddresseeMessage(err)` prefers `detail.message` and keeps the generic line when the server sends none (an older backend); the desktop store keeps it beside `notAddresseeItemId` for QueueCard, and /m uses it directly. One string path, no new component; raw-color counts unchanged (QueueCard 28/59/0, MobileAdmin 0/4/130 — equal to the baseline). Re-pinned: mobileAdminNotAddressee.spec (the server's message, plus the fallback case); queueCardNotAddressee.spec gains the named and fallback mount cases; new operatorQueueNotAddressee.spec for the helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves tests/registry.json by keeping dev's test_4475 entry and both 1096 entries (both sides appended at the tail). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…person (abilityai/trinity-enterprise#1096, M1) readdressed_detail built its message from waiting_on for every seat-fenced row, so a role, approver or project row's 409 named people and carried waiting_on, while the same row's 403 stays person-free. It now returns the AskNotAddressee.detail shape for those rows: the role message and seat, no waiting_on, no email. New role:cfo case in test_1096_admin_seat_fence was red before the change (waiting_on present, email in the message). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d-set (abilityai/trinity-enterprise#1096, S1) No test reached the window the CAS exists for: a re-address landing after the service read the address and before the ending's UPDATE. Two db-level tests take the expectation the service builds, move resolved_to while addressed_to_email stays NULL ([alice,bob] -> [alice,carol]), then call respond_to_operator_queue_item / cancel_operator_queue_item with expect_address: each returns _status_conflict and the row stays pending. Mutation: dropping resolved_to from the respond CAS turns test_an_answer_read_before_the_move_does_not_land red; dropping it from the cancel CAS turns test_a_cancel_read_before_the_move_does_not_land red. Both reverted byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… id is refused (abilityai/trinity-enterprise#1096, L1) admin_readdress looks a registered resolver up before the skill-gate shape, so a prefix of hex digits only (gate-a...) would match gate-<40 hex> ids and let to: admin put a skill-gate approval on the admin seat. The registration now raises ValueError for any prefix fully matching gate-[0-9a-f]*. New parametrized test was red (DID NOT RAISE) before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rule_refused (abilityai/trinity-enterprise#1096, L3) admin_readdress trusted the registered family rule: a resolver that raised surfaced as a 500, and one that returned a primary or owner seat with no people wrote a card nobody could decide. Both now return 409 rule_refused and leave the row untouched; only the admin seat may be empty. Two new route tests (raising rule; primary/owner seat with nobody) were red before (an uncaught RuntimeError, and 200 instead of 409). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/validate-pr — APPROVEValidated at Merge gate ✅. Tier 1 is green: the four required contexts, Checks
Execution coverage. Mutations run in the PR worktree for this validation, each reverted:
The three frontend specs mount the real components. Standalone behaviour. With no resolver registered, Warnings (not blocking)
Suggestion. A registered resolver that returns seat Not run: full suites (CI ran them), the PR-side This is posted as a comment, not a GitHub review, so merge order stays the maintainer's call. |
Union resolution of the two #4546 conflicts: bulk_cancel keeps the branch's skipped_fenced ending and adds dev's actor_user_id; the operator-queue platform keys keep both _WORKSPACE_DECIDER_SEAT_KEY and _CONTINUES_TURN_KEY. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Resolve by running |
…ervice/__init__.py is back at the 800-line cap (#4559) test_3785's size threshold failed the regression diff at 804 lines. Comment only; no code change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
merge-train: two commits pushed to this branch (
Local at |
What
Approval cards that ask a person can be stranded today: when the seat they were addressed to empties or moves, nobody can answer them, and the refusal does not say who the card is waiting for. This PR gives the platform the pieces to fix that (part of abilityai/trinity-enterprise#1096):
adminand has no named people can be decided by an instance admin who is a person. Agents cannot write the stamp (it is a platform context key, stripped from agent-authored context). A row without the stamp stays undecidable, as before.POST /api/operator-queue/{id}/readdress(require_admin+require_person, human-only, no MCP tool). Body{to: rule|admin, reason}. It re-resolves the card's audience by the rule that raised it — there is no free person picker. An extension package may register a resolver for its own ask family (ask_service.register_readdress_resolver(prefix, fn); a prefix that could start a skill-gate id is refused). Unchanged audience → 409audience_unchanged; a rule that raises or yields an empty primary/owner seat → 409rule_refused, row untouched.resolved_to,addressed_to_email, and the seat stamp on admin-seated rows). A card re-addressed in between ends neither way: 409readdressed.reason_required); bulk cancel skips such rows and counts them inskipped_fenced.notAddresseeMessage), falling back to the old string on older backends./readdressis API-only for admins until a per-card admin UI ships. No schema change: everything lives in existingoperator_queuecolumns.Review + security
Reading review: MERGEABLE AFTER FIXES, 0 critical; both must-fix items (a role row's 409 body named a person;
tests/registry.jsonconflict with dev) and the cheap items are fixed ind31941c2c,4c2ad01a8,55f098556,318804b39. Evidence sweep: one surviving mutation (droppingresolved_tofrom the ending compare-and-set) is now killed by two db-level tests (12e1177d8), shown red for the answer and the cancel path separately./cso --diff: 0 findings..claudeandsrc/backend/enterpriseuntouched.Tests
At
318804b39, one file per process, foreground: 19 backend files, 1012 passed, 0 failed (the two newtest_1096_*files, the operator-queue / ask neighbours,test_2338registry reader,test_2996human-only routes,test_293admin gate). Frontend: the three not-addressee specs. Not run locally, left to CI:test_3785_operator_queue_package(timed out locally), the full pinned-guard list.Before merge
getattr, so either side alone degrades to today's behaviour.src/backend/services/operator_queue_service/__init__.py(both add platform context keys) — merge-order call; whichever lands second keeps both keys.tests/registry.jsonconflicts with fix(access): a platform continuation turn stands as the turn it continues (abilityai/trinity-enterprise#1225) #4546 already against dev (tail append, keep both).contexton admin-seated rows; narrowed to the seat key if a later writer adds context to those rows.🤖 Generated with Claude Code