Skip to content

DO NOT MERGE — merge train: 3513,3515,3514,3517 - #3528

Closed
trinity-ability wants to merge 28 commits into
devfrom
train/20261011-0752
Closed

trinity-ability wants to merge 28 commits into
devfrom
train/20261011-0752

Conversation

@trinity-ability

Copy link
Copy Markdown
Contributor

Integration surface for #3513, #3515, #3514, #3517. Never merged; members merge individually once green.

#3515 and #3517 both add a constant block after the same line in src/backend/db/operator_queue.py; resolved keep-both here (and again on #3517's branch after #3515 lands).

🤖 Generated with Claude Code

trinity-ability and others added 28 commits October 10, 2026 15:04
…ansport (Abilityai/trinity-enterprise#692)

Adds §21.5.1: MCP tools for source management, admitted for the principals
require_admin already admits; agent and connector keys stay refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…them (Abilityai/trinity-enterprise#816)

role_addressing.resolve names a single Workspace addressee only when exactly
one person resolved, so an ask to a role two people fill was stored with
addressed_to_email NULL. The Workspace list filtered on addressed_to_email =
viewer, so the ask rendered in nobody's Inbox while the receipt said
resolved: true.

Per the operator ruling of 2026-10-07 in the issue thread: the ONE ask is
delivered to every person the role resolves to (fan-out on read, no
duplicate rows), the first answer wins, and Dismiss/Discuss are refused on a
shared ask for now.

- db/operator_queue: "addressed to this person" is addressed_to_email =
  viewer OR viewer in resolved_to, as a SQL condition (JSON-quoted,
  LIKE-escaped, case-insensitive; same on SQLite and PostgreSQL), so the
  list and its count page over exactly what is shown (#3059).
- client_portal/asks/service: _is_addressed_to is the Python twin used by
  every per-ask door (answer, dismiss, discuss, context), so a non-addressee
  still gets the uniform 404 (Invariant #8). The projection carries
  `shared`; a co-addressee's answer reads ended_by=someone_else with
  answered_by; Dismiss and Discuss on a shared ask are 422 `shared_ask`.
- The receipt's `resolved` is now truthful for the multi-person case: a
  person's Workspace shows the ask.

Tests: tests/unit/test_ent816_shared_asks.py (18). Mutation check: with the
db/operator_queue.py change reverted, 13 of 18 go red, including
test_an_ask_to_a_role_two_people_fill_lands_in_both_inboxes
(assert [] == [<ask id>]).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…answered it (Abilityai/trinity-enterprise#816)

PortalAsks hides Dismiss and Discuss on a shared ask (the server refuses both
with `shared_ask`); queueEnding reads ended_by=someone_else as the
projection's answered_by, and the Inbox list's badge says "Answered · <name>".

Tests: tests/unit/portalSharedAsk.mount.spec.js (3, mounted). Mutation check:
with PortalAsks.vue and utils/operatorQueue.js reverted, all 3 go red,
including "offers neither Dismiss nor Discuss, but can still be answered".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…status (Abilityai/trinity-enterprise#692)

- POST /api/skills/sources/apply: register-or-update keyed on the
  repository URL (201 created / 200 updated|unchanged / 409
  ambiguous_source), same URL boundary as create, same admin gates.
- POST /api/skills/sources accepts an optional priority.
- GET /api/skills/library/status carries last_fleet_reinject, counts
  only; the per-agent failures map stays on the admin routes.
- routers/skills.py # mcp: header names the new skill_sources.ts tools.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…em (Abilityai/trinity-enterprise#816)

ask_operator's description now says what `resolved` means and that a
multi-person role reaches every person; operating-room flow, workspace and
backend area files record the fan-out-on-read rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…/trinity-enterprise#692)

list_skill_sources, register_skill_source (idempotent apply),
update_skill_source, delete_skill_source, sync_skill_source and
sync_skill_library: thin proxies over the require_admin source routes.
canAccess is an allow-list of user/system scope, re-checked in-tool;
agent and connector keys are never advertised them and the backend
refuses them regardless. Sync tools report ran / refused_busy / failed
and where a started fleet re-inject's outcome lands.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…se#692)

architecture/mcp-server.md tool table + count, api-endpoints.md apply
route, skills-library-sync feature flow, user-doc tool counts and rows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… marked outcome_unknown (Abilityai/trinity-enterprise#844)

The expiry sweep (mark_expired, every poll cycle) ends a pending ask on its
deadline alone and wrote every timeout identically (expired / timeout, no
reason). Only a gated-skill approval names an action the platform holds;
for every other approval the agent holds the action, so "the approval went
stale and nothing happened" and "the approval was skipped and the action
went ahead" left the same trace.

Both timeout writers (mark_expired and the #3247 replace path's
in-transaction expiry) now write disposition_reason = 'outcome_unknown' for
an approval that is not a gate's, from one SQL CASE inside the same
compare-and-set, so only the winning writer records it. Questions, alerts
and gate approvals stay NULL; rows that ended earlier are never rewritten.
The expired audit row carries outcome_unknown: true for those rows. No
schema change: the existing disposition_reason column carries the fact.

Test: tests/unit/test_ent844_expired_approval_outcome.py. Mutation check
(disposition_reason=_TIMEOUT_REASON reverted to None in both writers): 5
red - test_an_approval_the_platform_did_not_hold_expires_as_outcome_unknown
[agent-mcp, agent-file, None-None], test_the_replace_path_expires_the_same_way_as_the_sweep,
test_the_expiry_audit_row_names_an_unknown_outcome_and_only_that; restored, 9 green.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s outcome is unknown (Abilityai/trinity-enterprise#844)

queueEndingText - the one rule ResolvedCard, the queue detail and /m share -
words disposition_reason 'outcome_unknown' on a timeout as "Expired - nobody
answered in time; whether the action went ahead is unknown"
(TIMEOUT_ENDING_REASONS; an unknown token falls back to the plain wording).
ResolvedCard no longer prints a timeout's reason token as a note.

Test: src/frontend/tests/unit/operatorQueueOutcomeUnknown.spec.js (3 red
before the change, 7 green after; full npm run test:unit green).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ilityai/trinity-enterprise#844)

Operating-room feature flow (ledger + new paragraph), database.md column
comment, MCP type comment, and test registry entries for the two new suites.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…never a wake (Abilityai/trinity-enterprise#631)

Service-layer tests against a real init_schema SQLite: a tag in a room is
exactly one Unread ledger item; the same person twice is one item; an unknown
name is refused by name before any write; the agent wake list is unchanged;
a reader who cannot see the room gets 'can't see' and who can let them in,
never content; agents and external clients cannot tag; the tagger sees
delivered then read; the operator door never lists a person's pointer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ox (Abilityai/trinity-enterprise#631)

A person tag is a pointer, not a seat. It rides the queue-item ledger behind
the Inbox's doors (operator_queue, ent#610) as type 'mention', status
'delivered' -> 'read' -- never 'pending', so no ask budget, expiry, ending
observer or operator badge can see it. No schema change.

- services/person_mention_service: who may tag (a platform person; agents,
  system keys and external Workspace clients refused by name), who may be
  tagged (the ent#450 shape: accounts that exist, are not suspended and can
  reach one of the conversation's agents; query required, capped), named
  refusals before any write, idempotent delivery keyed on
  (conversation, message, person), and the reader's door: the tagged message
  with context only to a reader who can already see the room; otherwise
  can_see=false and who can let them in. Admin every-room visibility only on
  the platform door (#78).
- db/queue_mentions + users taggable queries; 'mention-' is a reserved,
  about-a-person id prefix; the operator door's list/stats/item read leave
  mentions out.
- rooms: RoomMessageCreate.tags, GET /api/rooms/{id}/people, own_tags marks
  on the tagger's messages. resolve_mentions (the wake list) is unchanged.
- 1:1 chat: PortalChatRequest.tags on /chat and /chat/stream, delivered after
  the user row lands; history carries the tagger's marks;
  GET .../agents/{agent}/people.
- Workspace door: GET/POST /api/enterprise/client-portal/mentions[/{id}[/read]].

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…read it in the Inbox (Abilityai/trinity-enterprise#631)

- Composer (room and 1:1): the @ typeahead also offers PEOPLE, read from the
  server once there is a query (usePeoplePicker over the room / chat people
  routes — never a directory). Picking inserts @name and remembers who; the
  send carries the addresses beside the text (tagsInText), so deleting the
  name untags. An unknown name is refused by name with the reason. A 403
  (an external client) leaves the picker agents-only. The 1:1 escalation to
  a room carries the tags with the message.
- Tagger's marks: PortalTagMarks under the sender's own message —
  in their Inbox (in-app only) / read / not delivered; icon + word.
- Inbox: a tag is an Unread item (mention:<id>), never Action; counted as
  one thing that came back on the pinned row; kept in place drawn read;
  PortalMentionCard shows the tagged message with context only when the
  server says the reader can see the conversation, otherwise 'you can't see
  this' and who can let them in; read once its card is on screen.
- Pure rules in portalMentions.js; node + mount specs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…J20 skeleton; truthful post_to_room (Abilityai/trinity-enterprise#631)

- requirements/core-agent.md 5.42 WORKSPACE_PERSON_TAG
- architecture/workspace.md: Person tags — a pointer, not a seat; backend.md
  catalog entries for person_mention_service and db/queue_mentions
- feature-flows/workspace-person-tag.md (+ index)
- J20 'a colleague joins the work' (the epic's J12 id was taken): catalog
  entry + strict xfail skeleton, JOURNEYS.md regenerated
- MCP post_to_room: an @mention wakes an AGENT participant; agents cannot tag
  people

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…agger's marks read through the agent index (Abilityai/trinity-enterprise#631)

A read person tag is settled history: the #1142 terminal sweep now includes
status 'read' (an unread 'delivered' tag is never swept, like 'pending'), so
tags do not grow without bound. The tagger's marks pass the conversation's
agents so the prefix read is served by the (agent_name, request_id) index.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ettles (Abilityai/trinity-enterprise#631)

One narrow history read, only for a message that tagged someone, copies the
server's delivered/read marks onto the message on screen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lert, outside the #2372 heal (Abilityai/trinity-enterprise#631)

- test_3246: a person tag is a platform-raised row that is not an alert,
  like the skill gate's asks — named beside GATE_ASK_ID_PREFIX.
- test_2372: the heal's prefix list is frozen at its ship date; 'mention-'
  was reserved after it and its rows never sit in 'responded' (a tag never
  enters the ask lifecycle), so it is named as reserved-after-heal rather
  than appended to a shipped migration.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ong-typed re-inject report (Abilityai/trinity-enterprise#692)

Two review findings on the source-apply / library-status changes:

- `apply_skill_source`: when the matched row is deleted between the match
  and the update, `update_skill_source` answers None. The service reported
  `("updated", None)` and the router 500'd on `source.id` in the audit call.
  It now re-resolves (bounded), so the declared source is re-created.
- `_read_last_fleet_reinject`: a parseable dict with a wrong-typed field
  (null/string count, non-string timestamp) passed the isinstance check and
  failed `FleetReinjectSummary` at response validation, 500-ing the open
  `GET /api/skills/library/status`. The blob is now validated against that
  model inside the fail-soft read and degrades to null.

Both tests were red before the change (6 failures) and are green after.
Learnings fragment added for the response_model-projection class.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…wn outcome too (Abilityai/trinity-enterprise#844)

Review finding: both timeout writers stamp disposition_reason='outcome_unknown',
but only the sweep's `expired` audit row carried `outcome_unknown: true`. The
#3247 replace path in raise_ask built its own inline audit row without it, so
the same bypass read differently in the audit trail depending on which writer
the clock used. One builder (`_expired_audit`) now serves both. The new test
drives the replace path through ask_service.raise_ask and goes red without the fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n included (Abilityai/trinity-enterprise#844)

Review finding: QueueItemDetail rendered queueEndingText only for a platform
ending, so an expired approval fell through to the person-answer branch
("by  · …") and the outcome_unknown marker never reached the detail panel,
which is one of the surfaces the PR and AC3 rely on. A clock ending now renders
through the shared ending rule. The mounted spec goes red without the fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he shared replace link (Abilityai/trinity-enterprise#816)

Pre-landing review of #3513:

- `_ending_of` mapped ANY ending by a person in `resolved_to` to
  `someone_else` and `_answered_by` then named them. A co-addressee who is
  also an operator and cancels the shared ask from the Operating Room is an
  operator's ending: it read "Cancelled by <name>" in the other person's
  Inbox and carried `answered_by` on a cancel, against the projection's own
  contract (operator endings stay coarse and unnamed). Now only an answer
  reads `someone_else`.
- The `_linked_request_id` widening (replace links on a shared ask) had no
  test; a mutation reverting it stayed green. Two tests now pin it, including
  the withheld case (the replaced ask was never the viewer's).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n type; the room is shown per door (Abilityai/trinity-enterprise#631)

Pre-landing review fixes for PR #3517:

- A row is a tag only when it has the reserved `mention-` id AND
  `type='mention'`. The `type` column is agent-authored: queue-file
  ingest only bounds its length, and the addressee can be any roster
  email. Before this fix, an agent could write a `type: mention` row
  and it showed up in a sharee's Inbox as "Alice mentioned you". The
  same row was also hidden from the operator. Every tag read and the
  read CAS now use `queue_mentions.is_tag_clause`.
- The operator door now leaves tags out unconditionally. `type` is a
  query parameter of GET /api/operator-queue, so with the old
  "unless the caller names the type" exception, any sharee could list
  who tagged whom by adding `?type=mention`.
- respond and cancel now return the same 404 for a tag id that GET
  returns, instead of a 400 that names the tag's status.
- `_room_access` now follows the room's own membership rule for each
  door. A Workspace session for a platform member's address, including
  one minted by a portal_delegate key, gets a 404 on the room through
  `_require_membership`, so it is no longer shown the room's content
  through the tag either.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n the ent692 client (Abilityai/trinity-enterprise#692)

test_duplicate_create_still_409s failed in CI's full-suite regression diff:
a file that evicts db.* after routers.skills is imported leaves the router
catching a stale DuplicateSkillSource, so the facade's raise escaped as a raw
exception instead of a 409. Reproduced locally with a forced eviction; the
client now rebinds DuplicateSkillSource/DefaultSourceExists to the module the
facade raises from.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	src/backend/db/operator_queue.py
@vybe vybe added the ui PR touches the frontend UI — triggers Playwright e2e tests label Oct 11, 2026
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