Skip to content

fix: surface routing-rule trigger as leading external event#1008

Merged
icholy merged 3 commits into
masterfrom
fix/routing-rule-trigger-event-first
Jun 15, 2026
Merged

fix: surface routing-rule trigger as leading external event#1008
icholy merged 3 commits into
masterfrom
fix/routing-rule-trigger-event-first

Conversation

@icholy-bot

Copy link
Copy Markdown
Collaborator

Fixes #1007.

When a routing rule creates a task, the triggering event now appears as the first event in the timeline — as a rich external event, the same way it does when an event wakes an existing task (the attach path) — and it precedes the Created lifecycle event it triggered.

Before

The create path recorded the trigger only as a link event, emitted after the Created lifecycle event:

Created -> Link -> Instruction

This left the "Events" lane empty (no external event) and buried the cause of the task below the lifecycle event it caused.

After

The create path now emits an ExternalPayload event first, carrying the webhook description/URL/data, matching the wake path:

External -> Created -> Link -> Instruction

The subscribed link row (task_links) and its link event are still created for subscription/Links-lane purposes — only the leading external trigger event is added.

Changes

  • internal/eventrouter/eventrouter.go: emit the external trigger event before the Created lifecycle event in the create path.
  • internal/eventrouter/eventrouter_test.go: assert the new External -> Created -> Link -> Instruction ordering and that the external event carries the webhook payload.

go test ./internal/eventrouter/ passes.

When a routing rule creates a task, the timeline now emits the triggering
external event first, before the Created lifecycle event, so it appears the
same way it does when an event wakes an existing task (the attach path). The
create path previously recorded the trigger only as a link event after the
Created event, leaving the Events lane empty and burying the cause of the
task below the lifecycle event it triggered.

The timeline now reads External -> Created -> Link -> Instruction.
@icholy

icholy commented Jun 15, 2026

Copy link
Copy Markdown
Owner

@icholy-bot the text/description for the created link doesn't need to do double-duty anymore. We should update that to just be the PR info.

…title

The created task's subscription link used the event description as its title
and pointed at the triggering comment URL, doing double-duty as the trigger's
label. Now that the external trigger event carries that description, point the
link at the canonical resource (the issue/PR) and drop the title so it surfaces
the resource itself.
@icholy-bot

Copy link
Copy Markdown
Collaborator Author

Good call — updated in 6eb8007. The created subscription link no longer carries the event description as its title (that text now lives on the external trigger event). The link now points at the canonical resource (the issue/PR, via RoutingKey) instead of the triggering comment URL, and its title is left empty so it surfaces the resource itself.

So the split is now clean: the external event is the specific trigger (comment URL + description + body), and the link is the subscription to the underlying issue/PR. Let me know if you'd rather the link carry a human-readable title (e.g. owner/repo#N) instead of just the resource URL. (task 896)

Comment thread internal/eventrouter/eventrouter.go Outdated
Address review: the subscription link should keep input.URL (the triggering
comment/event URL), not the canonical resource key. Only drop the redundant
title, which now lives on the external trigger event.
@icholy icholy merged commit d464413 into master Jun 15, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 15, 2026
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.

When a task is created as a result of a routing rule, the event should be the first event

2 participants