Skip to content

fix(event-automations): Run events about one object in one conversation - #2084

Draft
sentry-junior[bot] wants to merge 10 commits into
mainfrom
fix/event-automation-object-conversations
Draft

sentry-junior[bot] wants to merge 10 commits into
mainfrom
fix/event-automation-object-conversations

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Opening #2081 fired one repository-level event automation about 17 times. The events were opened + ready_for_review, a Vercel comment, and one checks.recovered per passing check suite. Each delivery got its own agent-dispatch:<id> conversation, so the runs went in parallel with no shared history. Four of them posted the same closing review.

This change keys each automation run by automation + destination + Event object, so events about one PR share one conversation.

Runtime

  • EventInput gets an optional objectIdentifier. The GitHub plugin sets it to the PR or issue on the repository copies of PR and issue events, because those copies replace identifier with the repo.
  • ingestEventAutomations gives each dispatch a fixed event-automation:<hash> conversation id. It also delays the wake by EVENT_WAIT_MS, so a burst of events lands in one mailbox batch.
  • The dispatch worker accepts several pending dispatches for one conversation and runs their input, in mailbox order, as one Turn. The other dispatches complete as coalesced once the input is saved. Later events run as a new Turn that sees the earlier history.
  • The owning dispatch records joinedDispatchIds. When a Turn resumes after a redelivery, it completes only the dispatches it recorded. A dispatch that arrived after the Turn started stays in the mailbox and runs in the next Turn (deferred), so it is not dropped.

Tests (agent test fixture)

  • run([githubWebhook(...), ...]) sends a burst of deliveries and fails unless they start exactly one Conversation. conversation.continue(githubWebhook(...)) delivers a later event to an automation Conversation and fails if that event starts another Conversation.
  • evals/integration/coding/event-automations/delivery.eval.ts replays the fix(performance): Optimize automations list collection query #2081 shape as signed webhooks: PR opened (which also sends ready-for-review), a vercel[bot] comment, and three passing check suites. It expects one completed Turn and one reply (Update 1). A late check suite must continue the same Conversation and reply Update 2, which shows it saw the history. A second PR must get its own Conversation (Update 1).
  • A component worker test covers the redelivery race. The resumed Turn completes only the joined dispatch it recorded, and the late dispatch stays pending until the next Turn.

Not in this PR: checks.recovered still fires for every successful check suite, not only when checks go from failing to passing. Those events now join the PR's conversation instead of starting new runs, but a late suite still wakes one more Turn. The fix needs earlier check state, so it comes in a separate PR.

Verification

  • pnpm lint passes, and tsc passes for junior and junior-evals.
  • junior-github tests: 225 passed.
  • junior event automation, events, and dispatch worker tests pass, except delivers the current automation card…, which also fails on main.
  • The full junior suite had 14 failures. I reran the failing files on main, and they fail there too.
  • The new eval did not run in the sandbox: eval egress (Quick Tunnel) fails during setup. CI must confirm it.

via David Cramer.

--

View Junior Session [Sentry]

sentry-junior Bot and others added 2 commits October 9, 2026 00:18
Event automations created one conversation per webhook delivery, so one
opened pull request (#2081) fanned out to about 17
parallel runs and four duplicate reviews.

Key each automation run by automation, destination, and Event object.
GitHub repository copies of pull request and issue Events now carry
objectIdentifier. Dispatches share that conversation, wait for the
event burst window, and run pending dispatches as one Turn. A resumed
Turn completes only the dispatches it recorded, so later events wait for
the next Turn.

Extend the agent test fixture so run() accepts a GitHub webhook burst and
continue() delivers a later event to an automation conversation, and
cover the #2081 scenario in the event automation delivery eval.

Co-Authored-By: David Cramer <[email protected]>
Keep joined input in mailbox order, simplify the running transition,
and drop diff noise.

Co-Authored-By: David Cramer <[email protected]>
@vercel

vercel Bot commented Oct 9, 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 Oct 9, 2026 1:15am UTC

Request Review

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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

Review screenshots in Frameshift

Code Repository · Desktop
Code Repository · Desktop
Changed
Conversation Event Log · Desktop
Conversation Event Log · Desktop
Changed
Conversation Image Reply · Desktop
Conversation Image Reply · Desktop
Changed
Conversation Outbox Author · Desktop
Conversation Outbox Author · Desktop
Changed
Location Detail · Mobile
Location Detail · Mobile
Changed
Locations · Mobile
Locations · Mobile
Changed
Show 1 more changed screenshot
System Cache Tokens · Desktop
System Cache Tokens · Desktop
Changed

@sentry-evals

sentry-evals Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Sentry Evals

junior-behavioral

Run Status Passed Failed Errored Cost Tokens Duration
Head Complete 64 3 0 $0.59 0 307.70s

Base commit a08faa2 has no eval run to compare against.

junior-guardian

Run Status Passed Failed Errored Cost Tokens Duration
Head Complete 45 0 3 $0.01 0 14.42s

Base commit a08faa2 has no eval run to compare against.

junior-integration

Run Status Passed Failed Errored Cost Tokens Duration
Head Complete 83 0 0 $0.35 0 433.08s

Base commit a08faa2 has no eval run to compare against.

junior-router

Run Status Passed Failed Errored Cost Tokens Duration
Head Complete 12 0 0 $0.00 0 0.20s

Base commit a08faa2 has no eval run to compare against.

The behavioral evals recorded these model responses in https://github.com/getsentry/junior/actions/runs/37864537548.
The evals of this commit replay them in strict mode.

Eval-Suite: behavioral
The GitHub plugin records pull request outcomes from opened webhooks and
requires the id, merged, and updated_at fields that GitHub always sends.
The behavioral evals recorded these model responses in https://github.com/getsentry/junior/actions/runs/37865558218.
The evals of this commit replay them in strict mode.

Eval-Suite: behavioral
The behavioral evals recorded these model responses in https://github.com/getsentry/junior/actions/runs/37866615736.
The evals of this commit replay them in strict mode.

Eval-Suite: behavioral
Each event automation delivery waits for the event burst window, so three
deliveries in one eval exceeded the 120 second eval timeout. Cover the
burst and its later event in one eval, and separate pull requests in
another.
The behavioral evals recorded these model responses in https://github.com/getsentry/junior/actions/runs/37867847355.
The evals of this commit replay them in strict mode.

Eval-Suite: behavioral
The integration evals recorded these model responses in https://github.com/getsentry/junior/actions/runs/37867847496.
The evals of this commit replay them in strict mode.

Eval-Suite: integration

This branch was successfully deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants