Repository navigation
ref(inbox): Name each Inbox item by its subject kind and id - #4164
Open
sentry-junior[bot] wants to merge 97 commits into
Open
sentry-junior[bot] wants to merge 97 commits into
sentry-junior[bot] wants to merge 97 commits into
Conversation
A To-do that an agent assigns to a person now shows in that person's Inbox as a "To do for you" row, in the stack of its Conversation. Core owns the backing Inbox item and syncs it with each To-do change, in the same transaction. The item is private and links no Conversation, so only its assignee sees it. Done marks the To-do done, and the agent sees the change in its next <todo-delta>. The row has no Dismiss. Snooze, the Inbox counts, Needs you, and the Conversations feed treat it like any action for the person. Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]> # Conflicts: # design/inbox-stacks.md # design/inbox.md # packages/junior-dashboard/src/client/inbox/InboxItemActions.tsx # packages/junior/migrations/meta/0145_snapshot.json # packages/junior/migrations/meta/_journal.json # packages/junior/src/chat/todos/store.ts
A To-do for a person waits on that person alone. Its Inbox item made the Conversation read needs_input for everyone who can see it. Leave To-do items out of the shared status, so only the assignee's tree state shows that the Conversation waits on them. Co-Authored-By: BYK <[email protected]>
A To-do's item showed to its assignee for as long as the item was open, also after they lost access to its Conversation. The assignee now sees and acts on it only while they can see the Conversation's private content, under the same rule as the Conversation itself. Co-Authored-By: BYK <[email protected]>
Done checked the assignee on a snapshot of the Inbox item, then set the To-do by id. If the agent gave the To-do to someone else in between, the first person still closed it, along with the new assignee's item. The update now also needs the To-do to be open and assigned to the person, under the To-do lock.
# Conflicts: # design/inbox-stacks.md # packages/junior-dashboard/src/client/inbox/RowHoverActions.tsx
Main moved Open off the hover actions of a row with one ask, so the e2e test now opens the row and uses the card's link.
# Conflicts: # design/inbox.md # packages/junior/migrations/meta/0147_snapshot.json # packages/junior/migrations/meta/_journal.json # packages/junior/src/api/inbox-items/routes.ts # packages/junior/src/chat/inbox-snoozes/store.ts
The SQL access check joined the owner to its stored root, so it skipped a root with a null root id. conversationAccessFromRows treats such a root as its own, so sync wrote the item and the Inbox then hid it. The SQL now follows the same rule.
Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/junior/migrations/meta/0148_snapshot.json # packages/junior/migrations/meta/_journal.json
The open card's Done imported RowDoneButton from RowSnoozeDismiss, which pulled that module into the shared card chunk and added about 600 B gzip to the Inbox first load. The card now uses the plain Button, as Take and Dismiss do. RowDoneButton serves only the row's quick action. Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/junior-dashboard/src/client/inbox/InboxItemActions.tsx # packages/junior-dashboard/src/client/inbox/RowHoverActions.tsx # packages/junior-dashboard/src/client/inbox/RowSnoozeDismiss.tsx # packages/junior-dashboard/src/mock-reporting/inbox-items.ts # packages/junior/migrations/meta/0149_snapshot.json # packages/junior/migrations/meta/_journal.json
…ot start The Lead home e2e expects its checkout latency card to read Working. A To-do for the viewer there made it read Needs you, so the mock To-do now sits in the Dashboard QA Conversation (To-do 43).
# Conflicts: # packages/junior/migrations/meta/0159_snapshot.json # packages/junior/migrations/meta/_journal.json
# Conflicts: # design/inbox.md
Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/junior/migrations/meta/0160_snapshot.json # packages/junior/migrations/meta/_journal.json
A "To do for you" row and card now carry Dismiss, Snooze, and Done, with Done as the main action. Dismiss drops the To-do and closes its item as dismissed. A snooze that resolves on an Event now covers To-do rows too: its Event marks the To-do done for the person who snoozed it, alone or in a stack. The agent sees either change in its next To-do delta. Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/junior/migrations/meta/0161_snapshot.json # packages/junior/migrations/meta/_journal.json
Record the confirmed rules: a "To do for you" item closes with Done or Dismiss, and a snooze that resolves on an Event marks the To-do done. Raise the inbox bundle baseline to the measured size. Co-Authored-By: BYK <[email protected]>
… a tab (#4092) Stacked on #3969. **Why:** All is the default, so it goes to the right edge, after the filters that narrow the list. #3969 adds To-do items to the Inbox. With a tab of their own, they stay apart from Resume and the rest in Other. **What changes** - **Inbox:** Other · PRs · Decisions · To-dos · Pinned · All - **Conversations and a repository's Conversations tab:** Done · Watching · Working · Needs you · Pinned · All - **Automations:** Mine / All keeps its order. - **Tab order:** follows the order on screen. The URL state (`?type=`, `?state=`, `?pinned=1`) stays the same, with the new value `?type=todos`. - **To-dos tab:** uses the `ListTodo` icon that the To do rows already load. Other keeps Resume and the rest, and like any type it hides at 0. The type counts still add up to All. - **Count API:** `GET /api/inbox-items/count` gets a `todos` field: the waiting items that show a To-do. While later pages load, the client counts the unloaded To-dos as To-dos, not Other. - **Phone:** `ScopeTabs` uses less padding and a smaller gap, so all six Inbox tabs and the "Inbox" title fit one header row at 390 px, also with a two-digit count on every type. Automations' Mine / All tightens with it. - **Design doc:** `design/inbox.md` lists the new order and the To-dos type. ## Screenshots Mock data. Mobile is 390 px, shown at 2×. | | Dark | Light | | --- | --- | --- | | Inbox, desktop |  |  | | Inbox, mobile (two-digit counts) |  |  | | Conversations, desktop |  |  | | Conversations, mobile |  |  | | Automations, desktop |  |  | | Automations, mobile |  |  | <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A0e0c9f21f9f884e850892453d4b9bee5 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A0e0c9f21f9f884e850892453d4b9bee5) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A0e0c9f21f9f884e850892453d4b9bee5/?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]> # Conflicts: # design/attention.md # design/inbox.md # packages/junior/migrations/meta/0162_snapshot.json # packages/junior/migrations/meta/_journal.json # packages/junior/src/chat/inbox-items/access.ts # packages/junior/src/chat/inbox-items/tools/add.ts # scripts/dashboard-bundle-size-baseline.json
A resolve trigger cancelled the snooze in one transaction and then marked the To-do done. If that step failed, the Event was spent and the To-do stayed open. Change the To-do first, so a failure leaves the snooze to fire again, and a repeat changes nothing.
Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]> # Conflicts: # design/attention.md # design/inbox.md # package.json # packages/junior-dashboard/e2e/inbox/inbox-filters.spec.ts # packages/junior-dashboard/e2e/inbox/inbox-fyi.spec.ts # packages/junior-dashboard/e2e/inbox/inbox-todos.spec.ts # packages/junior-dashboard/tests/inboxCounts.test.ts # packages/junior-github/src/webhooks/pull-request-action.ts # packages/junior-github/tests/pull-request-review-again.test.ts # packages/junior/migrations/meta/0163_snapshot.json # packages/junior/migrations/meta/0164_snapshot.json # packages/junior/migrations/meta/0165_snapshot.json # packages/junior/migrations/meta/0166_snapshot.json # packages/junior/migrations/meta/0167_snapshot.json # packages/junior/migrations/meta/_journal.json # packages/junior/src/api/inbox-items/routes.ts # packages/junior/src/chat/conversations/sql/status.ts # packages/junior/src/chat/inbox-items/access.ts # packages/junior/src/chat/inbox-items/actions.ts # packages/junior/src/chat/inbox-items/plugin.ts # packages/junior/src/chat/inbox-items/store.ts # packages/junior/src/chat/inbox-items/tools/add.ts # packages/junior/src/chat/inbox-items/waiting.ts # packages/junior/src/chat/inbox-snoozes/store.ts # packages/junior/src/chat/inbox-snoozes/triggers.ts # packages/junior/src/chat/inbox-snoozes/viewer.ts # packages/junior/src/chat/todos/inbox-items.ts # packages/junior/src/db/schema/inbox-items.ts # packages/junior/tests/integration/inbox-item-tools.test.ts # packages/junior/tests/integration/plugin-inbox-items.test.ts
One github:pull_request item per pull request, with its ask read live from the pull request. The subject kind and id replace the dedupe key, Inbox search matches code change titles through the subject, and the subject preview is back to how main has it. Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…udience Everyone means the people who can see the item's owner. An agent can now assign a private item to Everyone, and the members of its private Conversation see it up for grabs. People who cannot see the Conversation still do not see it. A person's Inbox reader reads the items for Everyone whose owner they can see, and the single-item read checks the same. Co-Authored-By: BYK <[email protected]>
The owner rule for items for Everyone also matched public owners, so a person of another workspace got a public item for Everyone in their Inbox. The rule now covers only private items. A public item reaches Everyone through its workspace, as before. Co-Authored-By: BYK <[email protected]>
The To-do branch of the assignee check used the owner expression for every subject kind, so it also planned the question lookup. It now reads the owner from the To-do's subject id, which is all a To-do item needs. Co-Authored-By: BYK <[email protected]>
The read now costs about 1,010. An Inbox item's owner comes from its subject on purpose, since the item stores no owner, so each owner check costs one more index lookup than a stored owner column. Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]> # Conflicts: # design/inbox.md # packages/junior-github/src/webhooks/pull-request-action.ts # packages/junior-github/tests/pull-request-action.test.ts
The release before this one still reads and writes dedupe_key, title, body, owner_id and visibility, so this release keeps their NOT NULLs and the kind, owner, tenant and visibility checks. A trigger writes those columns for new code from the owner that it names for its transaction. Question items keep their copy of the content, and a notice keeps its link in subject_url. The visibility check stays, so a private item cannot be assigned to Everyone yet. Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/junior-github/src/webhooks/pull-request-action.ts # packages/junior-github/tests/plugin-harness.ts # packages/junior-github/tests/pull-request-action-harness.ts
Main's #4398 changed the review-again text, which this branch keeps in pull-request-item.ts. The comment-only review test uses the item subject. Main has two migration leaves (conversation_kind_root_thread_backfill and conversation_event_message_role_seq_index). The Inbox item migrations move after both, and the first one follows both leaves, so there is one leaf.
This release keeps the old visibility check for rollback, so it still refuses Everyone on an item from a private Conversation. The follow-up release that loosens the old checks removes this Gap. Co-Authored-By: BYK <[email protected]>
Contributor
A Participant who left a private Space no longer sees its items for Everyone or for no one, matching Conversation access.
A card read that GitHub answered before a review webhook no longer stores the old review decision.
…lease An edit changes the question before the item, so the item copy gets the new content, and a close keeps the answer on the item.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort 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 ee48698. Configure here.
A close that lands between the question write and the item write no longer leaves the question changed on a closed item.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-v2-3x.png)

Inbox items carried fields that only one source used:
automation_id, a GitHub title parse insubject_title_parts,subject_title, andsubject_url. They also packed the meaning of the source intodedupe_keyprefixes (plugin:,automation:,reply:,todo:), which a check constraint and the dashboard then parsed. That copied GitHub state into our database and went stale. It also made a pull request's review ask and merge ask two items, so a snooze or pin of the review was lost at the merge.Now an Inbox item is a pointer to its subject, a
{ kind, id }pair, plus the state that every item has, such as its status and assignees. Junior reads the title, state, link, owner, and visibility from the subject, live.The subject
Kinds. Core kinds are
question,automation,reply, andtodo. A plugin kind starts with the plugin name, such asgithub:pull_request. A plugin registers its kinds with a label and an owner map. It can also registerask(card, viewer), which names the viewer's current ask from the live card, andcodeChange, which says that the subject id is a code change's provider id.Identity.
(subject_kind, subject_id)names one open item, across all workspaces (junior_inbox_items_open_subject_key_uidx). It replacesdedupe_key. The plugin API dropsdedupeKeyfrom upsert, close, conversation changes, and the answered hook. They takesubjectnow.Owner and visibility. An item stores no owner. A question belongs to the Conversation that asked it, a reply and a To-do to their Conversation, an Automation alert to its Automation, and a plugin item to the Conversation that the plugin's owner map names. The item is public when its owner's Destination is public, and it follows the Destination when that changes. A To-do is always private.
Plugin owner map. For each subject kind, a plugin names one of its tables and the columns that hold the subject id and the owner Conversation id (
owner: { table, subjectId, conversationId }). Core reads the owner through that map in access checks, counts, search, and paging.extend/build-a-plugin.mddescribes it.Everyone. Everyone means the people who can see the item's owner. Reads already work that way: the members of a private Conversation see its unassigned items up for grabs, and people who cannot see the Conversation do not. This release still refuses Everyone on a private item ("A private item cannot be assigned to Everyone. Assign Users instead."), because the old visibility check stays for rollback.
design/inbox.mdrecords this as a Gap. The follow-up release removes the refusal and the Gap.Retired columns.
dedupe_key,owner_kind,owner_id,visibility,provider, andprovider_tenant_idleave the Drizzle schema, and no code reads them. They keep theirNOT NULLs and the old kind, owner, tenant, and visibility checks for one release, so the release before this one can still read and write every row after a rollback. A trigger,junior_inbox_items_legacy_write, fills them for new code. It uses the owner thatinsertInboxItemsets for its transaction (junior.inbox_item_owner_kindandjunior.inbox_item_owner_id). A question item also keeps a copy of its title and body, and an action keeps a copy of its request (withevidence), which the old kind check needs.GitHub
github:pull_requestitem per pull request. Its id is GitHub's numeric pull request id (databaseId), which is alsojunior_code_changes.provider_id. A repository rename or transfer does not change it, and the link comes from the code change records, so it follows the rename.junior_github_pull_request_requesters(pull_request_id→conversation_id). A partial unique index allows one opener row per pull request id. When a row was written without the id, or the repository was renamed, the backfill and the legacy trigger fall back to the code change with that number that the Conversation opened, when only one matches.reviewDecision, or the latest writers' reviews when the repository requires none). The decision comes frommain's pageprefetch: itsPullRequestCardsquery also readsreviewDecisionand the latest reviews, and stores them asreviewin the shared pull request cache entry. Webhooks keep that field.review: nullmeans read with no decision. An open pull request's entry with noreview, such as one that only webhooks or a REST read wrote, counts as missing, so the next page reads it. A review webhook (pull_request_reviewsubmitted or dismissed, orpull_requestreview_requestedorreview_request_removed) clears the field, so "Ready to merge" shows on the next page load after any review change. That is one GraphQL query per page, only while a pull request on it has an unread review. Issue cards usemain's cached REST reads, and pull request title parts read the repository's release config, cached for 1 h. A failed GraphQL query no longer blanks cards. When GitHub can't be read, the row shows the item's own title and the kind's label.assigneeIdentityIds) and the people whom this event asks (askedIdentityIds). A person joins the item only when an event asks them, so someone who left does not come back until a new ask. A person whose ask ends, such as a reviewer who reviewed, leaves the item, and their snooze and push end. A person who joins again starts with none of their old web push rows for the item, so a push that was cleared when they left does not close the new notification. The item closes when nobody is left, also when the only asks left are for people Junior can't assign.review_requestedfor the reviewer, or the approval that makes it ready to merge for the requester. The same item pushes again when the event asks again, so moving from review to merge pushes the requester while the snooze and pin stay. Content changes alone push nobody. Nothing records the last pushed ask.github:merge_conflictitem, with the same pull request id. It closes as done when GitHub reports the conflict gone, and with the pull request item's reason when the pull request merges or closes, also when the daily reconcile finds an end that sent no webhook. Junior still asks once per Resume, and a Dismiss stops those asks.Questions
junior_questions: its Conversation, Turn, title, body, request, and answer. The item points at it with{ kind: "question", id }. EachaddInboxItemcall asks a new question,ask:<tool call id>, so a retry of the same call adds no second item.addInboxItemreturns the item with itsid. To change a question, its form included, an agent callsupdateInboxItemwith that id. There is no key to reuse.<open-questions>block in its task: "Earlier runs of this Automation asked these questions, and they are still open. To ask one of them again, change it by its id.", then one- <id>: <title>line per question. An Automation alert, such as a failed run, staysautomation:<id>and belongs to the Automation.request.relatedlinks. They show on the card, but they never decide the card or add related work to another item. A notice'srequestholds only related links. The Inbox payload sends it, and the notice card lists them in its Related list. A question's subject is the question, so it has no subject link, object preview, or Slack title link. The Slack card lists a question's or a notice's related links as one line of plain links below the body. A repeated link shows once, and links that would make the line too long for the card are left out. A snooze of a question still waits by default on what its first related link names, such as a pull request.Tool text
addInboxItemdropssubjectanddedupe_key, andrequest.evidencebecomesrequest.related.updateInboxItemgainsrequest. The question shape,request.questionandrequest.fields, is unchanged.addInboxItemdedupe_keyaddInboxItemrequestrelated. Ask for related input in one item. Write the question so it stands alone: a person who sees only the card must understand it.addInboxItemrequest.questionaddInboxItemrequest.fieldschoicefield for a simple decision. Required for an action. Not allowed for a notice.addInboxItemrequest.relatedurlor aconversation_id.addInboxItemrequest.related[].urlupdateInboxItemrequestquestionandfields. A notice may have onlyrelated. Omit to keep it.The input errors are:
requestwith aquestionandfields.requestholds onlyrelated. To ask, use kindaction.relatedentry with both or neither linkrelatedentry needs aurlor aconversation_id, not both.The system prompt rule for a blocked child agent now says: "When the same block repeats, change the open item that you added for it instead of adding another." It no longer builds a
dedupe_key.Reads and search
junior_questions. In/api/search, an item matches on its question's title and body, or when the title of its subject's code change matches.Automations
automation_idand its foreign key are dropped. The Automation of a run's question comes from the run that owns the question's Conversation. The run writers linkjunior_automation_runs.conversation_idas soon as the run's Conversation exists, so this read works during the run.Dashboard
replyNotice. The dashboard readssubject.kind === "reply", and the card looks the same.Migrations
Core:
20261126010100_inbox_item_subjectsaddssubject_kind.dedupe_keystaysNOT NULL. A trigger, which also fires on old workers' inserts, gives each legacy row its subject. GitHub keys map to the pull request id throughjunior_code_changes, with the Conversation fallback after a rename. One backfill pass fires it for every row, then closes the older of two open items that now share a subject, such as the review and merge asks of one pull request. A closed duplicate's assignees and snooze move to the item that stays open, and its sent pushes clear. A legacy question's http(s) subject link becomes its first related link. A legacy notice has no request, so its link stays insubject_url, and its question reads it from there. Links get the stored form,URL.hrefas far as SQL can: the scheme and host are lowercased, and a bare origin gets/. The unique open subject index is built in the same transaction, so an old worker's second open insert fails.…010103validates and setsNOT NULLon the subject.…010105builds the subject kind index concurrently.…010108indexes the run's Conversation.…010159is the schema snapshot.20261126010259_inbox_questionscreatesjunior_questions, deletes question items whose owner Conversation is gone, and copies each question item's content to its question. A trigger copies the content that old workers still write on the item. The question stores the request's links asrelated.…010301changes nothing, because the old kind check stays.…010343is the schema snapshot.20261126011025_inbox_item_ownersaddsjunior_inbox_items_legacy_write, which writes the old columns for new code. It closes all but the newest open item of a subject across tenants.…011048builds the unique open subject index on(subject_kind, subject_id)concurrently.…011051drops the owner and tenant indexes, and…011121is the schema snapshot.The first core migration follows both of
main's current migration leaves,20261125225142_conversation_kind_root_thread_backfilland20261126000151_conversation_event_message_role_seq_index.GitHub:
20261124230100_pull_request_requester_idsand…230103add and backfillpull_request_idon the requester rows, by name and number, else through the Conversation's one code change with that number.20261125013037_pull_request_opener_idskeeps the id on the oldest opener row of a pull request.…013040builds the partial unique index onpull_request_idfor opener rows.…013132is the schema snapshot.Follow-up release
A follow-up PR, after this release ships, loosens what this release keeps for rollback:
NOT NULLonjunior_inbox_items.dedupe_key,title,body,owner_id, andvisibility.junior_inbox_items_kind_check,junior_inbox_items_owner_check,junior_inbox_items_tenant_check, andjunior_inbox_items_visibility_check, and add a kind check that reads the subject.junior_inbox_items_legacy_write,junior_inbox_items_legacy_subject_question, andjunior_inbox_items_legacy_subject, their functions (junior_inbox_items_legacy_questionfor the question trigger), and thejunior_inbox_items_web_linkhelper.set_configininsertInboxItemand the item copy of a question's content.access.ts, change the tests back so that a member sees the item and a non-member does not, and delete the Gap line indesign/inbox.md.A later release then drops the retired columns:
subject_title,subject_url,subject_title_parts,automation_id,owner_kind,owner_id,visibility,provider,provider_tenant_id,dedupe_key, and thetitle,body,request, andanswerof question items.Enforcement
design/inbox.mdstates the subject, owner, question, and Automation rules.inbox-item-fields:checkfails when ajunior_inbox_itemscolumn or an Inbox item payload field is not inscripts/inbox-item-fields-baseline.json, and that list can only shrink.Rollout note
add_inbox_itemno longer takesdedupe_key, and itsrequest.evidenceis nowrequest.related. Both input schemas are strict. Stored Automation instructions in production, and skills in getsentry/junior-prod, may still mentiondedupe_keyorevidence. A run that passes either one gets a tool input error. To change an earlier question, a run updates it by the item id: the add result returns that id, and later runs list their open questions with it.Slack card with related links (rendered
markdownblock)Screenshots (mock data,
inbox-item-related-card)Notice with related links (mock data,
inbox-notice-related-card)via @BYK.
--
View Session [Sentry]