Skip to content

fix(automations): Link runs to their Automation when they start - #2174

Closed
sentry-junior[bot] wants to merge 4 commits into
mainfrom
fix/automation-run-link-at-start
Closed

sentry-junior[bot] wants to merge 4 commits into
mainfrom
fix/automation-run-link-at-start

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

An Automation run's Conversation now records which Automation and run it belongs to as soon as the run is enqueued. Before, the only link was the run history row, and that row is written only when the run finishes.

The link uses the existing origin_type, origin_id and origin_run_id columns on junior_conversations. Until now these columns were always written as null. In enqueueAgentDispatch, the recordActivity call that creates the run's Conversation now passes an automationRun (Automation id, kind, and run id). Event runs use the dispatch id as the run id. Scheduled runs use the scheduled run id. The store writes:

  • origin_type: the Source kind, event_automation or scheduled_automation
  • origin_id: the Automation id
  • origin_run_id: the run id

The origin upsert is now set-once (coalesce(current, excluded)), the same as source. Before, every later write replaced origin_type with the conversation source ("plugin"), which would have overwritten the link. Nothing reads origin_type today, and for other Conversations it already matched the set-once source. So the only behavior change is for Automation runs.

readAutomationTitlesByConversationId (from #2169) now uses the Conversation's origin first. Runs created before this change have no origin, so it falls back to run history for them. As a result, the Automation-name title fallback also works while a run is still in progress.

Run history (junior_task_executions) is unchanged. It is still a log of finished runs. This PR has no migration and no new status.

via David Cramer.

--

View Junior Session [Sentry]

@vercel

vercel Bot commented Oct 16, 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 16, 2026 11:43pm UTC

Request Review

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

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 16a2ca5. Configure here.

createTask left the title empty, so the create tool asked the live title
model through AI Gateway. The gateway host is on the test allow-list. In a
sandbox with gateway credentials the model returned a title. In CI the call
failed, generation returned undefined, and readers fell back to the first
instruction line. Two tests depended on which side they ran on.

Set an explicit title in the fixture and assert one exact title.

@dcramer dcramer 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.

at some point we're going to have to figure out how to simplify this

Runs created before the start-time link have no origin_id. Run history
still names them. Remove the fallback after those runs age out.

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

This branch was successfully deployed

1 active deployment
Preview – junior-docs — b80fc142 Deployed Oct 16, 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