Repository navigation
feat(inbox): Make Automation alerts Review items with an owner - #3856
Conversation
Give every Review item an owner { kind, id }: the Conversation that
added it, or an Automation. The owner sets visibility, tenant and Inbox
stacking. Core adds, updates and closes an Automation's alert at each
run outcome and status write, and the heartbeat syncs event trigger
alerts with the plugins. Alerts use server snoozes like any item, so the
browser-only alert snooze goes away.
Co-Authored-By: BYK <[email protected]>
…-review-items Co-Authored-By: BYK <[email protected]> # Conflicts: # TERMINOLOGY.md # design/inbox.md # design/review-desk.md # packages/junior-dashboard/src/client/conversations/ConversationPage.tsx # packages/junior-dashboard/src/client/inbox/automationAlerts.ts # packages/junior-dashboard/src/client/inbox/inboxQueries.ts # packages/junior-dashboard/src/client/shell/conversations/ConversationPage.tsx # packages/junior-dashboard/src/client/shell/pages/automations/AutomationsPage.tsx # packages/junior-dashboard/src/mock-reporting/review-items.ts
… rename Scope the alert row actions to their row, since rows now keep their actions in the page, and simplify the trigger check of the alert sweep. Co-Authored-By: BYK <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
421 screenshot changes — 0 changed · 421 added · 0 removed |
…blocked group The Automations page now lists the viewer's alerts with a new owner=automation filter on the Review item list, so an alert past the Inbox's first page still shows in To do. The classic Inbox no longer lists blocked Automations on their own, because their alerts are items. Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]>
…-review-items Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/junior/migrations/meta/0138_snapshot.json # packages/junior/migrations/meta/_journal.json
… the classic Inbox The heartbeat now also syncs each blocked or failed Automation that has never had an alert, so Automations that needed attention before the cutover get one. The classic Inbox names an Automation alert's source as its Automation. Co-Authored-By: BYK <[email protected]>
BYK
left a comment
There was a problem hiding this comment.
I wonder if we should have an index on owner_id and owner_kind fields (probably a combined index?)
A person's dismiss now hides every alert of that Automation until it recovers: it is active and needs no alert. Core stamps the recovery on the Automation, and the heartbeat also checks event Automations whose dismissed alert waits on a fixed trigger. Add an (owner_kind, owner_id) index for owner reads.
|
Added in cf25755: migration |
…-review-items # Conflicts: # design/inbox-stacks.md # packages/junior-dashboard/src/client/inbox/InboxRow.tsx # packages/junior-dashboard/src/client/inbox/inboxSnoozes.ts # packages/junior/src/api/schema/inbox-snooze.ts # packages/junior/src/chat/inbox-snoozes/viewer.ts # packages/junior/tests/fixtures/snoozes.ts
| * delete. It locks the Automation row, so concurrent calls for one | ||
| * Automation run one after another. It writes nothing when the alert is | ||
| * already right. | ||
| */ |
There was a problem hiding this comment.
Scheduled automations skip alert sync
High Severity
syncAutomationAlert is documented to run after every status write, edit, and delete, but it is only called from run outcomes, the event-automation store, and the heartbeat. The heartbeat then only refreshes event Automations that already have an alert. A scheduled Automation that is paused, resumed, completed, or deleted therefore keeps a stale Inbox alert: Resume on the card will not clear it, and a deleted Automation can leave an item that still opens.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 79be237. Configure here.
There was a problem hiding this comment.
Not a bug: every scheduled write (save, pause, resume, complete, delete, block) goes through writeScheduledAutomation in scheduled-automations/tasks.ts, which calls syncAutomationAlert. The integration test resumes a scheduled Automation and sees its alert close.
The Automations badge now counts the viewer's open Automation alerts, the same items that the Automations To do lists, so a dismissed or snoozed alert leaves both. The heartbeat checks a dismissed event alert for recovery only while its Automation is active.
A dismissed alert now hides the Automation's alerts until it is not blocked and its last run succeeded, as the Dismiss rule says.
An Automation alert has no Conversation, so its transcript query stays disabled and pending. The item view now shows its fallback, which links to the Automation.
A failed-run alert now asks for a step, and core takes it: Run again queues a run now through the run-now path, and Pause pauses the Automation. An event Automation runs only on its events, so its alert offers only Pause. An alert that a person closed stays closed, and only a dismiss hides the Automation's other alerts until it recovers. The Inbox and the classic Inbox show the steps without Other….
A paused Automation needs no alert, so a pause stamped recovery when the last run had succeeded. A resume then opened a new alert for the same unfixed problem that a person had dismissed. Recovery now needs an active Automation.
…-review-items Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/junior-dashboard/e2e/inbox/inbox-snoozes.spec.ts # packages/junior-dashboard/src/client/inbox/ReviewItemTurnMessage.tsx # packages/junior-dashboard/src/client/inbox/inboxSnoozes.ts # packages/junior/src/api/schema/inbox-snooze.ts # packages/junior/tests/fixtures/snoozes.ts
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 842a0ab. Configure here.
| // its trigger is available. A paused Automation needs no alert, but its | ||
| // problem can still be there, so a pause is no recovery. | ||
| const recovered = | ||
| !needed && row.status === "active" && row.lastRunStatus === "completed"; |
There was a problem hiding this comment.
Never-run automations cannot recover
High Severity
Recovery requires lastRunStatus === "completed" on top of an active Automation that needs no alert. !needed already means the last run did not fail or block, so this extra check leaves a dismissed alert hidden after the Automation is healthy if it has never completed a run. Later failures, blocks, or trigger problems then never open a new alert.
Reviewed by Cursor Bugbot for commit 842a0ab. Configure here.
There was a problem hiding this comment.
Keeping this as is. The approved rule is that an Automation recovers when it is active, its last run succeeded, and its trigger is available. A dismiss means "hide this until it works again", and only a successful run shows that it works. A never-run Automation with a dismissed alert recovers at its first successful run, and later problems open new alerts after that. design/inbox.md and design/automations.md state this rule.
Daily design docs audit for the commits on `main` up to f98658436. It checked `attention`, `automations`, `cache-warming`, `context-compaction`, `child-agents`, `github`, `sandbox-credentials`, `google`, `inbox`, and `inbox-stacks`. One goal is clarified and two rules are added. ### New gaps - `attention.md`: an Automation alert shows only in the dashboard Inbox. The alert has no linked Conversation (`packages/junior/src/chat/automations/alert-items.ts`, `conversationIds: []`), and Slack cards post only to the threads of linked Conversations (`packages/junior/src/chat/slack/review-item-card-sync.ts`). A blocked Automation also gets a plain DM (`packages/junior/src/chat/automations/blocked-notice.ts`). This breaks "Slack and the dashboard ask for attention for the same things". - `inbox.md`: an alert for a blocked Automation or for an unavailable trigger is `kind: "action"` with no `request` (`alert-items.ts`, `automationAlert` and the content it builds). It asks no question, but it counts as needing the creator. This breaks "a notice tells a person about something that they must fix". ### Intent changes - `child-agents.md`: a parent wakes only when a child messages it. A `reply`, a `messageAgent` message, a blocked report, a failure, and the notice that a paused child dropped Watch Events (#3898) are all messages. Before, the goal named only `reply`, blocked reports, and failures. - `google.md`: new rules for what Junior reads from a colleague's calendar. These state the current behavior (`list-events.ts`, and `readCalendar` in `find-meeting-times.ts` from #2252). They do not change it. ### Gap changes - `attention.md`: a blocked Automation is no longer listed as an ask that adds no Review item. #3856 gave it an Automation alert. The Slack-only part moves to the new gap above. ### Cuts - `automations.md`: the Automation alert rule listed behavior and repeated `inbox.md`. Its "offers Run again and Pause" was also wrong for event Automations, which get only Pause. It now points to the Inbox. - `inbox.md`: removed the step list and the history from the alert rules. - `inbox-stacks.md`: "tenant", the server-snooze mechanism, and the alert visibility clause that `inbox.md` owns. Rewrapped two long lines. - `context-compaction.md`: removed the warmup price math that `cache-warming.md` owns. - `attention.md`: removed "When Junior is blocked, it says what the person must do", which repeats the Intent. "push notifications" becomes "a push", as `TERMINOLOGY.md` says. - `github.md`: removed the repeats of "never a direct push to the default branch" and "A person merges it". - `google.md`: merged the two Google group lines and removed the repeat of "never uses the Google credentials of the people it helps". <!-- junior-request-attribution:start --> via [automation `sched_5076e4cb686a5e474279137daf734019`](https://junior-prod.sentry.dev/automations/sched_5076e4cb686a5e474279137daf734019) · Run ID `sched_5076e4cb686a5e474279137daf734019:1795280400000`, @dcramer. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0CHB3YHES2%3A1795281742.386739 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC0CHB3YHES2%3A1795281742.386739) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0CHB3YHES2%3A1795281742.386739/?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]>


Automation alerts in Inbox To do were not Review items. The Inbox read them from the Automations attention list and snoozed them in
localStorageonly. This change makes them real Review items, so counts, the Inbox list, versions, and server snoozes (#3392, #3567) treat them like any other item. It follows up on #3567.Owner
Every Review item now has a required owner,
{ kind, id }:conversation: the Conversation that added the item. Every existing item gets this owner in a backfill.automation: an Automation, for its alerts.The owner sets the item's visibility, tenant, and Inbox stack. Conversation-owned items work as before. An Automation's alert takes its visibility from the Automation's Destination (a public channel makes it public) and stacks under the Automation as its own row. The shape can take more kinds later. Only these two exist now.
This is a hard cutover with no compatibility layer.
added_by_conversation_idbecomesowner_kind+owner_idin all of these: access, hydrate, the API schema, the MCP tools, Inbox grouping, auto-archive, To-dos, Briefs, Conversation status and counts, and snoozes. Migration0139_review_item_ownerrenamesadded_by_conversation_idtoowner_id, drops its foreign key, and addsowner_kindwith a'conversation'default, which backfills every existing row. It also lets the reservedautomation:dedupe keys past the actionrequestCHECK, asplugin:keys are. Migration0140_review_item_owner_indexadds an(owner_kind, owner_id)index, built concurrently.Automation alerts
chat/automations/alert-items.tssyncs one Automation's alert with its state: blocked, a trigger that the enabled plugins can't serve, or a last run that failed or blocked. It runs after each run outcome and status write (block, resume, pause, complete, delete, edit). The alert is assigned to the creator and uses anautomation:<id>:<hash>dedupe key, which agents can't use.junior_automations.alert_recovered_at_ms, records the recovery. An alert that core closed on recovery hides nothing.review-items/automation-answer.ts). Run again queues a run now through the same path as the run-now tool (runAutomationNow). Pause pauses the Automation. Either step closes the alert, and that alert doesn't open again. An event Automation runs only on its events, so its alert offers only Pause.Dashboard
{ reviewItemId }.owner=automationfilter on the Review item list.automationAlerts.tsand itsjunior:inbox:automation-alertsstorage are removed.Docs:
TERMINOLOGY.md(Owner, Automation alert),design/inbox.md,design/inbox-stacks.md,design/automations.md.Screenshots (mock data)
A failed-run alert in To do, and the same alert in Snoozed.
via @BYK.
--
View Session [Sentry]