Skip to content

Report a failed run back to the Slack thread that started it - #212

Merged
artempartos merged 1 commit into
developfrom
feat/slack-trigger-failure-notification
Sep 5, 2026
Merged

artempartos merged 1 commit into
developfrom
feat/slack-trigger-failure-notification

Conversation

@artempartos

Copy link
Copy Markdown
Contributor

A run launched by @mentioning the bot is fire-and-forget for whoever typed the mention: they see whatever the agent chose to post back, and nothing at all when the run dies before the agent could post anything — which is exactly when the failure most needs saying out loud.

What changed

  • Slack triggers now reply in the same thread when a run they started fails, naming the failed step and its error (truncated — the run page has the full thing), or the account that ran out of credits, plus a link to the run.
  • trigger_bindings.notify_on_failure, default true. A switch on the Slack trigger form; the MCP trigger tools (create_workflow_trigger / update_workflow_trigger) take it too.
  • Only Slack-born runs carry the reply coordinates, so the flag is a no-op on every other trigger kind.

Where the hook lives

On the fail transition, not in WorkflowService.fail — that is not the only way a run ends up failed. The stale-run sweeper calls fail! straight on the record, and a run reaped as stale is precisely the kind of failure nobody is watching for.

The post itself runs in Slack::NotifyRunFailureJob, so a Slack outage can never turn a failed run into a failed state transition. RunFailureNotifier returns false on every unhappy path rather than raising.

Deliberately quiet

  • A run with Slack context but no dispatch behind it (a re-run started by hand from a Slack-born run inherits shared_context) — nobody asked for a notification on it.
  • The reply goes through the same workspace install the run came from, mirroring InternalTools::SlackPostMessage#slack_integration.

Checks

docker compose exec -T web make check_all — green, including schema_parity_test.

🤖 Generated with Claude Code

…rted it

A run launched by @mentioning the bot is fire-and-forget for whoever typed the
mention: they see whatever the agent chose to post back, and nothing at all when
the run dies before the agent could post anything — which is exactly when the
failure most needs saying out loud.

Slack triggers now answer in the same thread when a run they started fails,
naming the failed step and its error (or the account that ran out of credits),
with a link to the run. `notify_on_failure` defaults to true and is a switch on
the Slack trigger form; the MCP trigger tools take it too.

The hook is on the `fail` transition rather than in WorkflowService.fail, because
that is not the only way a run ends up failed — the stale-run sweeper calls
`fail!` straight on the record, and a run reaped as stale is precisely the kind
of failure nobody is watching for. Posting happens in a job, so a Slack outage
can never turn a failed run into a failed state transition.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
@artempartos
artempartos force-pushed the feat/slack-trigger-failure-notification branch from 8971251 to ca6d6ef Compare September 5, 2026 22:07
@artempartos
artempartos merged commit edb2a5e into develop Sep 5, 2026
7 checks passed
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.

1 participant