Repository navigation
fix(review-items): Assign the Owner when a Turn without a person asks - #3015
Conversation
An event Turn, such as a watched pull request that merged, has a system Actor. addReviewItem then saved the item with no assignees, so no person saw it on the review desk, in the count, or in a dashboard Conversation. Fall back to the Owner of the Conversation, refuse an item that no person would see, and show a Conversation's items to the people who take part in it. Co-Authored-By: BYK <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b3acc89. Configure here.
|
186 screenshot changes — 0 changed · 186 added · 0 removed |
The Owner fallback picks the Owner, but the private assignee check allowed only participant rows. An Owner whose Identity got its User after the Conversation started has no row, so the add failed.
| * person with a Junior User. The system Identity of an Automation run or a | ||
| * plugin dispatch is not a person, so it returns undefined. | ||
| */ | ||
| export async function conversationOwnerUserId( |
There was a problem hiding this comment.
I'd rather not. It's an indexed lookup of at most one row, and it runs only in rare cases: when no person is in the Turn (defaultAssignees), or once for each linked Conversation in the private assignee check. That's at most three small queries per addReviewItem call.
A cache across calls would also go stale in exactly the case Bugbot flagged: the Owner's Identity gets its User linked after the Conversation started. AGENTS.md also rules out mutable runtime globals. Deduping the two lookups inside one call would mean passing the Owner through requireReviewItemAssignees, which is more plumbing than one saved query is worth. I can do it if you want it anyway.
…3021) A Conversation has no owner. Each Turn has an Actor, and a Conversation's Participants are the Users among those Actors. A Participant is active or inactive depending on whether they are subscribed. `TERMINOLOGY.md` defined an **Owner** (from the #2439 plan), and some code gave the root Actor rights that no other Participant had. This PR removes both. **Behavior** - **Access, feeds, and archive** read only Participant rows. Before, the root Actor also got access by Identity, or by a matching verified email when no row existed. The feed `union`, `viewerConversationMembership`, and the root Actor fallback in `hasSubscriber` are gone. - **Review item defaults:** when a Turn has no person and no Automation creator (for example, an event Turn), the default assignees are now the *active* Participants, not the Owner (#3015). Assignee checks and defaults also resolve a child id to its root. Before, they looked up participants by the child id. - **Forged trees:** a row that has a parent no longer matches its own participant id, so a cyclic root does not grant access. The old test missed this because its viewer was fake. **Keeping root Actors as Participants** - The root write already adds the root Actor as a Participant when its Identity has a User. When an Identity gets its User later, `upsertIdentityRecord` now adds that User as a Participant of each root the Identity started. - Migration `0093` backfills those rows for Identities that were linked before this change. - `actor_identity_id` stays as the root Actor. It only records who started the Conversation. People stats come from Turns (#3023). **Docs and tests** - `TERMINOLOGY.md` drops Owner and adds Participant. - The `actor-identity-end-state` plan now says root Actor where it said Owner, and it records the "no owner" decision. - Many tests used `testViewer()`. Its fake User id only passed access through the email fallback that this PR removes. Those tests now use a persisted viewer (`signedInViewer`), and `createConversationFixture` signs its Actor in the same way that the web harness does. **Not covered:** a later-linked Identity does not get rows backfilled for non-root Turns it authored while it had no User. The event rows do not record whether a message was Turn input or thread context. Today's behavior for those authors does not change. `any-resource-event-automations` and the S3 storage tests also fail on `main` in my sandbox. I did not run evals. <!-- junior-request-attribution:start --> via @dcramer. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0B595QDZLL%3A1794240020.053329 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC0B595QDZLL%3A1794240020.053329) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0B595QDZLL%3A1794240020.053329/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: David Cramer <[email protected]>
A channel member who is not a participant got "only participants can answer this" when they clicked an answer button on a question in a public Conversation. The dashboard also hid the answer form from viewers of a public Conversation who are not participants. ## New rule Anyone who can see a public question can answer it: - In Slack, that is a member of the public channel the Conversation is bound to. - On the web, that is any signed-in viewer allowed to see the public Conversation (the same rule as "Continue here" in #3304). A public question is an open action item with a request, linked to a public Conversation that owns it. The person who answers becomes the actor of the answer. Their answer goes in as their own message, so the single-actor Turn rule (#2574) applies as before. These keep the assignee rule: - Private items, even in a public Conversation (#3015). They also stay hidden. - To-dos, plugin items, and Automation alerts. - Dismiss and Take. A viewer can answer, but cannot close or claim someone else's question. - Thread replies. A reply from someone who is not an assignee still does not close an item. Only card buttons and the dashboard form take the wider rule. The Slack checks are unchanged. `resolveSlackActingUser` still enforces workspace membership and allowed domains, so a Slack Connect user and a guest from a domain that is not allowed still cannot answer. ## Changes - `canAnswerInboxItem` in `inbox-items/access.ts`. Submits in `actions.ts` and the Slack answer form use it. Readers of a public Conversation can now read its public action items. - The API adds `canAnswer` to each inbox item. The dashboard shows the answer form when `canAct || canAnswer`, and Dismiss and Snooze only when `canAct`. - `design/inbox.md`: the answer rule now separates private items from public questions. - The Slack card tests and one API test moved into new files with a shared fixture, to stay under the file-length limit. - `inboxData.tsx` waits for the first Conversation feed page before it reads missing Conversation titles. Before, an Inbox list that loaded before the feed read the title of every linked Conversation. The System People request-budget e2e test now holds back the feed to cover this. ## Screenshots A question in a public Conversation, seen by a signed-in viewer who is not a participant. Before: no form, only "Waiting on…"  After: the answer form with Send, and no Dismiss or Snooze  <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:local%3Aweb%3A1901e6569f26c781ab5fe01e --> -- [View Session](https://junior-prod.sentry.dev/conversations/local%3Aweb%3A1901e6569f26c781ab5fe01e) [[Sentry]](https://sentry.sentry.io/explore/conversations/local%3Aweb%3A1901e6569f26c781ab5fe01e/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <[email protected]> Co-authored-by: BYK <[email protected]>

addReviewItemsometimes succeeded, but nobody ever saw the item it added. An event Turn (for example, a watched pull request that merged) and an<agent-result>from a child that such a Turn started both run as the system Actor. That Actor has no User, sodefaultAssigneessaved the item with no assignees. Three things then hid it:GET /api/review-itemsreads asreviewItemReaderForUser, which ignores the link to the Conversation.local/web, and no viewer identity has that tenant. So the item never matched as a public item either.The agent still told the person "I asked on your review desk."
This PR changes three things:
ToolInputErrorand tells the agent to setassignees. This includes an Automation run whose creator has no Junior User. Before, that run added an item with no assignees, and that item never showed in anyone's count.conversationId(dashboard and MCP), the item detail, and actions. Being able to view a public Conversation is not enough: a private item stays private when its Conversation becomes public. The MCP testrefuses another person's private Review itemcaught this case when I first triedcanViewPrivateContent.The tool description now names the Owner fallback. I did not run evals.
Out of scope:
any-resource-event-automations,scheduled-automation-tools, and S3 storage tests fail onmainin my sandbox too.via @BYK.
--
View Session in Sentry