Skip to content

feat(inbox): Make Automation alerts Review items with an owner - #3856

Merged
BYK merged 17 commits into
mainfrom
feat/automation-alert-review-items
Nov 20, 2026
Merged

BYK merged 17 commits into
mainfrom
feat/automation-alert-review-items

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Automation alerts in Inbox To do were not Review items. The Inbox read them from the Automations attention list and snoozed them in localStorage only. 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_id becomes owner_kind + owner_id in all of these: access, hydrate, the API schema, the MCP tools, Inbox grouping, auto-archive, To-dos, Briefs, Conversation status and counts, and snoozes. Migration 0139_review_item_owner renames added_by_conversation_id to owner_id, drops its foreign key, and adds owner_kind with a 'conversation' default, which backfills every existing row. It also lets the reserved automation: dedupe keys past the action request CHECK, as plugin: keys are. Migration 0140_review_item_owner_index adds an (owner_kind, owner_id) index, built concurrently.

Automation alerts

  • chat/automations/alert-items.ts syncs 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 an automation:<id>:<hash> dedupe key, which agents can't use.
  • A new alert closes the old item and opens a fresh one.
  • When a person dismisses an alert, no alert of that Automation shows again until it recovers: it is active, its last run succeeded, and its trigger is available. A pause is no recovery. The next problem then opens a new alert. A new column, junior_automations.alert_recovered_at_ms, records the recovery. An alert that core closed on recovery hides nothing.
  • A failed-run alert offers Run again and Pause, and core takes the step (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.
  • The heartbeat syncs the alerts of event Automations whose triggers can't work, because a plugin change writes nothing to the Automation. It also syncs dismissed event alerts, so a trigger that works again counts as a recovery, and adds the first alert for Automations that were already blocked or failing before this change.
  • Agents can't change or close an Automation's alert. The Review item tools say so.

Dashboard

  • Alerts render as normal Inbox item rows. The card has Resume (blocked), Run again and Pause (failed run), Open last run, and Open editor, and the row opens with "Open automation". Snooze and Dismiss use the server like any item, and a snooze subject can be just { reviewItemId }.
  • The Automations page lists its To do from the viewer's open alerts, read with a new owner=automation filter on the Review item list.
  • The Automations badge counts the same open alerts, so a dismissed or snoozed alert leaves both.
  • Run again and Pause show in the Inbox and the classic Inbox. They have no Other…, because core reads no words.
  • The classic Inbox drops its "Blocked automations" group, because those alerts are items now.
  • automationAlerts.ts and its junior:inbox:automation-alerts storage 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.

Light Dark
To do, 1440
Snoozed, 1440
To do, mobile
Snoozed, mobile

via @BYK.

--

View Session [Sentry]

sentry-junior Bot and others added 3 commits November 20, 2026 10:34
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]>
@sentry-junior
sentry-junior Bot requested a review from BYK November 20, 2026 11:21
@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 20, 2026 10:16pm UTC

Request Review

@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 20, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

421 screenshot changes — 0 changed · 421 added · 0 removed

Review screenshots in Frameshift

…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]>
…-review-items

Co-Authored-By: BYK <[email protected]>

# Conflicts:
#	packages/junior/migrations/meta/0138_snapshot.json
#	packages/junior/migrations/meta/_journal.json

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

… 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 BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should have an index on owner_id and owner_kind fields (probably a combined index?)

Comment thread design/automations.md Resolved
@BYK
BYK enabled auto-merge (squash) November 20, 2026 18:53
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.
@sentry-junior

sentry-junior Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Added in cf25755: migration 0140_review_item_owner_index builds a combined (owner_kind, owner_id) index concurrently. It covers the alert sync, the heartbeat sweep, and the owner=automation list.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

…-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

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

* 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.
*/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 79be237. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

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….

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ 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";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 842a0ab. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@BYK
BYK merged commit 8b608e8 into main Nov 20, 2026
80 of 82 checks passed
@BYK
BYK deleted the feat/automation-alert-review-items branch November 20, 2026 22:32
dcramer added a commit that referenced this pull request Nov 21, 2026
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]>

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 842a0abc Deployed Nov 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant