Workflows
YAML recipes that say what Mendloop does when an issue is created, spikes, regresses or CI fails.
A workflow says what Mendloop does when something happens. It is a YAML file with a trigger and a list of steps. You edit it in Workflows → builder, as a diagram or as YAML, test it in test mode, and publish it. Admins publish.
An example#
name: Crash to PR
trigger:
any:
- issue.created: { environment: production }
- issue.regressed: { environment: production, severity: [P0, P1] }
steps:
- id: triage
action: issue.triage # severity and owner
- id: rca
action: ai.investigate # root-cause analysis
- id: approval
gate: approval
with: { approvers: owner, min: 1, plan: "{{ rca.plan }}", channels: [slack, email, in_app] }
- if: "{{ approval.approved }}"
then:
- id: ticket
action: ticket.create
with: { priority: "{{ issue.severity }}" }
- id: fix
action: code.fix_and_prTriggers#
issue.created, issue.spiked, issue.regressed, sentry.issue.created (the Sentry webhook or a Sentry SDK),
sdk.error, ci.failed and manual.
Filters narrow them: project, environment, severity, platform, level, kind, source, release. Use
any: (the default) or all:, and add - if: "{{ … }}" for anything else. A version reacts only to events after
it went live.
Steps#
| Step | What it does |
|---|---|
action: name |
Calls a registered action. with: passes parameters; retry: (2, or {max_attempts, backoff, factor, max_backoff}), timeout: (30s, default 15 minutes) and continue_on_error: apply. |
ai: { tier, prompt, system?, json?, max_tokens? } |
One model call by tier (fast, balanced, strongest). The tier map in Settings → Models picks the model; a workflow never names one. Output: text (and data with json: true), tier, model, tokens, cost. |
if: … then: […] else: […] |
Runs one branch. The other branch's steps show as skipped. |
gate: approval |
Creates an approval request (approvers, min, remind, escalate, expire, plan, channels) and waits for a decision. Output: approved, decision. |
wait_for: event |
Waits for an event, such as git.pr.merged for { pr: "{{ fix.pr_url }}" }. timeout: in with (default 30 days), on_timeout: fail or continue. |
delay: 10m |
Waits for a while. |
parallel: [branch, branch] |
Runs branches at the same time and continues when all finish. |
stop: { reason, status } |
Ends the run here (status: failed to fail it). |
Any step can have id, name and if.
Templates in values#
Values use {{ … }}: issue (with project, slug, url), owner, earlier steps by id
({{ triage.severity }}), trigger, run, workflow, policy and mode. A whole-value template keeps its type:
{{ rca.plan }} stays a mapping.
The builder checks your YAML as you type, underlines each error at its line and column, and draws the steps as a diagram. Click an error to jump to it.
Versions#
Each save creates or updates a draft. Mark a draft test to have test mode run it (otherwise test mode runs the newest draft, then the live version). Publish (Admin) makes a version live and archives the previous one; rollback (Admin) brings an archived version back. Only drafts can be edited.
Turning a workflow off (its kill switch, with a reason) stops new runs and pauses runs in progress before their next step. See Kill switches.
Runs#
The run timeline shows every step with its status, attempts, tier, model, tokens, cost and error. Open a step for its input, output, tool calls and logs, with secrets masked. While a run is going, the page updates by itself.
You can cancel a run, retry a failed step (the run resumes from it), and dry-run a version against an issue: reads are real, writes are simulated.
Test mode runs never write to real targets: a write goes to the test target (Settings → Test targets) or is simulated, and the step shows what it would have sent.
How runs survive#
Every run and step is kept in Postgres; Redis only wakes workers.
- A run that stopped anywhere resumes on any worker. Steps already recorded are replayed, not re-run.
- At an approval gate the run is stored as waiting and holds no worker: a week-long approval costs nothing. A decision wakes it within about a second.
- If a worker dies mid-step, another delivers the same attempt again with the same idempotency key, so a write action returns the record it already made instead of writing twice.
- Failed attempts retry with backoff; a step that times out counts as a failed attempt.
Starting templates#
| Template | What it does |
|---|---|
| Crash to PR | Triage, investigate, owner approval, ticket, fix and pull request, wait for the merge, close the ticket |
| RCA only | Posts the root cause; no tickets or code |
| Triage and ticket | No AI |
| CI failure fixer | Starts from a ci.failed trigger |