Repository navigation
feat(workspace): tagging a person in a conversation reaches their Inbox (abilityai/trinity-enterprise#631) - #3517
Conversation
…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]>
…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]>
…hown per door; learnings fragment (Abilityai/trinity-enterprise#631) Co-Authored-By: Claude Opus 5.5 <[email protected]>
/review ReportBranch: feature/ent631-person-mention → dev (merge-base
Execution coverage (Step 2.5)
Fix mutation: all 5 new regression tests failed on the PR head before the fixes ( Critical Findings — all FIXED in 578a7c4[C1] Auth boundary: an agent could forge a person tag, and hide its own ask, by writing [C2] Information disclosure: [C3] Information disclosure (#78): a Workspace-session reader was shown room content their door cannot open (Confidence: 8/10) Informational Findings[I1] Fixed in 578a7c4 — respond/cancel answered a tag id with 400 "status 'delivered'" while GET answered 404 (Confidence: 7/10). [I2] Agent delete removes tags anchored on it (Confidence: 8/10). [I3] [I4] The picker exposes the emails of other sharees and admins to any person who can reach the agent (Confidence: 7/10). [I5] Performance: [I6] Send-time Clean Categories
Tests run (after fixes)
Summary
🤖 Generated with Claude Code |
# Conflicts: # src/backend/db/operator_queue.py
|
merge-train: merged |
Summary
Typing
@and a colleague's name in a Workspace chat or room used to do nothing:resolve_mentionsonly matches agent participants, so the name showed up in the message and nothing else happened. With this PR the colleague is told. A tag is a pointer, not a seat:operator_queue, the store behind the ent#610 Inbox). There is no new store, no new notification path and no schema change.Journey Impact: new: J20
(The epic called this journey "J12-a-colleague-joins-the-work", but J12 through J19 were already taken in
tests/journeys/catalog.yaml, so it ships as J20. The catalog entry and astrict=Truexfail skeleton are in this PR.)Design
Ledger row, outside the ask lifecycle.
db/queue_mentions.pywrites a row withtype='mention',addressed_to_emailset to the tagged person, and a platform-writtencontext.mention({conversation, message_id, seq, tagged_by, person}). The status goesdelivered→readand neverpending. Every depth cap, expiry sweep, delivery flag, ending observer and operator badge readspending, so starting outside it keeps all of that machinery blind to the row by construction. The id ismention-<h(conversation)>-<h(message)>-<h(email)>. Because it is deterministic, the(agent_name, request_id)conflict turns a repeat into a no-op: the same person named twice, a retried turn, or a re-delivery is still one item.mention-is a platform-reserved id prefix and also in the about-a-person subset:is_platform_mintedkeeps the row out of the agent's file and its answer wake;The operator door (
_list_conditions,get_stats,GET /api/operator-queue/{id}) leavesmentionrows out. Otherwise any sharee of the agent could see who tagged whom.Rules in one place.
services/person_mention_service.pyholds them, shared by rooms and the 1:1 chat:tagger_for/tagger_for_portaltake the tagger from auth, never from the request body. They refuse:agents_cannot_tag, checked first, because an agent key resolves to its owner);tagging_unavailable).taggable_peopleandresolve_tagsuse one predicate (db.users._taggable_conds): an account with an email, not suspended, that is an admin, owner or sharee of one of the conversation's agents. This is the ent#450 shape:unknown_person(withname),cannot_tag_yourselfandtoo_many_tags(more than 10). "No account" and "no access" give the same refusal, so it can't be used to probe which accounts exist.Stored apart from the wake. The message's
mentionsstay the agents to wake, computed from the text exactly as before. Tags travel beside the text (tags: [email]on the post) and are never parsed out of it. The person pointer is stored on the ledger, keyed to the message.Rooms.
RoomMessageCreate.tags, plus a newGET /api/rooms/{id}/people?q=for the picker.failedon the tagger's marks and never fails the post.get_roomreturnsown_tagsfor the whole room (only the caller's own tags), so the 3 s incremental poll still shows an older tag turning read.1:1 chat.
PortalChatRequest.tagson/chatand/chat/stream. Tags are resolved and refused before the turn, then threaded throughstart_portal_turn→portal_chat._persist_user_turnreturns the stored row.tagson the reader's own messages, plus a newGET …/agents/{name}/people?q=for the picker.The tagged person's door (
client_portal/mentions/router.py, portal principal):GET /mentions,GET /mentions/{id}, andPOST /mentions/{id}/read(person only)._room_accessdecidescan_see: the reader must be a live participant, or an admin on the platform door only (Payment settings: Update button disabled after changing Plan/Agent ID, API key disappears #78; a portal session for an admin's address does not get admin visibility).can_see=falseandcan_let_you_inis the tagger.Frontend.
portalMentions.jsholds the pure rules, andusePeoplePickeris shared by both composers.@typeahead the heading becomes "Agents and people" and people rows follow the agents. If nothing matches, it shows the named refusal: No one called "zed" can be tagged here — you can tag people who work with scout.PortalTagMarksshows each tag with an icon and a word.mention:<id>item type:came;PortalMentionCardhandles loading, failure, can't-see and can-see states;Retention. A read tag is now swept with the ledger's terminal rows (#1142). An unread one is never swept, like
pending.MCP. The
post_to_roomdescription now says an @mention wakes an agent participant and that agents cannot tag people.Gating shape
OSS core, ungated, the same edition as rooms (ent#443) and the Inbox (ent#610). No entitlement check was added or widened. CLAUDE.md says enterprise-tracker features are gated by default unless decided otherwise, so this is decision 1 below.
Product decisions taken (please confirm)
@that again does nothing for people. The open-core question the epic raises (decision 1, team installs) applies to the seat, which this PR doesn't touch.open_for_readerif you'd rather have it.@Bobthat wasn't picked from the popup is plain text, as before. Deleting the inserted name before sending untags.delivered/readon the ledger instead ofpending, and a read tag is pruned with the ledger's retention window.agent_nameis NOT NULL). An agent rename cascades the row; deleting that agent removes it./wsfor a portal client.Tests
tests/unit/test_ent631_person_mention.py: 29 tests on a realinit_schemaSQLite. They cover:mentionsagent-only;test_ent169_shared_sessions::test_the_sender_cannot_be_set_from_the_request_bodynow allowstags. It names recipients, never the sender, and the tagger is still resolved from auth.GET /api/rooms/{id}/peopleasDELEGATED, backed bytest_an_agent_key_cannot_list_people_to_tag.DECLARED_JOURNEY_COUNTis now 20.test_3246/test_2372:mention-is a known non-alert reserved family (likegate-), reserved after the Operator queue: acknowledging a platform-minted alert leaves itrespondedforever — the write-back re-injects it into the agent's queue file and the #1631 guard rejects it on every boot #2372 heal shipped.test_ent163_portal_delegated_identity.py(ensure_schema_tablesfromconftest) also happens without this change, and the file passes 7/7 when run on its own.pytest unit/ -n 8): 25217 passed, 4 failed on the first run.test_3246::test_every_reserved_prefix_is_a_known_platform_family, andtest_2372::test_frozen_prefixes_cover_every_live_reserved_prefix(the shipped heal migration is left alone;mention-is named as reserved after it).test_3470_subscription_walk::…earliest_over_all_idswas flaky under load and passes when run on its own.test_1160_migration_atomicity::test_concurrent_boot_rebuild_is_safefails the same way on a cleanorigin/devcheckout on this machine (a concurrent-boot timing test under load), so it predates this change.npm run test:unit): 334 files / 5480 tests pass, up from 332 / 5450, including the raw-colour, loading-gate and source-text ratchets.portalPersonMention.spec.js(19 tests, pure rules).portalPersonMention.mount.spec.js(9 tests, jsdom). It covers the room picker (offer, Tab, the send carries the address, a deleted name untags, the named refusal, a refused send keeps the text), the tagger's marks, the card (can't see / can see / failed), and the Inbox read-once.npm run check:tokenspasses, andvite buildis clean.Not done / follow-ups
usePeoplePickerandportalMentionswith the mounted room composer.Fixes abilityai/trinity-enterprise#631
🤖 Generated with Claude Code