{
  "schemaVersion": 1,
  "machineId": "sentry-auto-solve",
  "name": "Sentry Auto-Solve",
  "description": "Polls Sentry on a schedule or wakes on webhook, replicates each issue first, solves and reviews it, and keeps a local commit, opens a PR, or auto-merges into your target branch.",
  "initialStateId": "check-issues",
  "contextSchema": {
    "type": "object",
    "properties": {
      "deliveryMode": {
        "type": "string",
        "enum": ["local", "draft-pr", "pr", "pr-auto-merge"],
        "readOnly": true
      },
      "targetBranch": {
        "type": "string",
        "maxLength": 200,
        "readOnly": true
      },
      "mergeMethod": {
        "type": "string",
        "enum": ["squash", "merge", "rebase"],
        "readOnly": true
      },
      "requireReproduction": {
        "type": "boolean",
        "readOnly": true
      },
      "requireReview": {
        "type": "boolean",
        "readOnly": true
      },
      "sentryTriage": {
        "type": "string",
        "enum": ["none", "comment", "resolve-next-release", "resolve"],
        "readOnly": true
      },
      "severityFilter": {
        "type": "string",
        "enum": ["all", "error", "fatal"],
        "readOnly": true
      },
      "onFailure": {
        "type": "string",
        "enum": ["skip-and-continue", "pause-for-review"],
        "readOnly": true
      },
      "dailyLimit": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100,
        "readOnly": true
      },
      "routeId": {
        "type": "string",
        "maxLength": 120,
        "readOnly": true
      },
      "runId": {
        "type": "string",
        "maxLength": 160
      },
      "activeRouteId": {
        "type": "string",
        "maxLength": 160
      },
      "issueKey": {
        "type": "string",
        "maxLength": 200
      },
      "issueId": {
        "type": "string",
        "maxLength": 64
      },
      "shortId": {
        "type": "string",
        "maxLength": 100
      },
      "issueTitle": {
        "type": "string",
        "maxLength": 400
      },
      "issueUrl": {
        "type": "string",
        "maxLength": 500
      },
      "issueSummary": {
        "type": "string",
        "maxLength": 8192
      },
      "worktreePath": {
        "type": "string",
        "maxLength": 1000
      },
      "branch": {
        "type": "string",
        "maxLength": 200
      },
      "baseBranch": {
        "type": "string",
        "maxLength": 200
      },
      "baseSha": {
        "type": "string",
        "maxLength": 64
      },
      "githubRepository": {
        "type": "string",
        "maxLength": 200
      },
      "reproCommand": {
        "type": "string",
        "maxLength": 2000
      },
      "rootCause": {
        "type": "string",
        "maxLength": 4000
      },
      "commitSha": {
        "type": "string",
        "maxLength": 64
      },
      "fixSummary": {
        "type": "string",
        "maxLength": 4000
      },
      "reviewSummary": {
        "type": "string",
        "maxLength": 4000
      },
      "reviewFeedback": {
        "type": "string",
        "maxLength": 4000
      },
      "reviewAttempted": {
        "type": "boolean"
      },
      "prNumber": {
        "type": "integer",
        "minimum": 0
      },
      "prUrl": {
        "type": "string",
        "maxLength": 500
      },
      "headSha": {
        "type": "string",
        "maxLength": 64
      },
      "mergeCommit": {
        "type": "string",
        "maxLength": 64
      },
      "lastOutcome": {
        "type": "string",
        "maxLength": 120
      }
    },
    "required": [
      "deliveryMode",
      "targetBranch",
      "mergeMethod",
      "requireReproduction",
      "requireReview",
      "sentryTriage",
      "severityFilter",
      "onFailure",
      "dailyLimit",
      "routeId",
      "runId",
      "activeRouteId",
      "issueKey",
      "issueId",
      "shortId",
      "issueTitle",
      "issueUrl",
      "issueSummary",
      "worktreePath",
      "branch",
      "baseBranch",
      "baseSha",
      "githubRepository",
      "reproCommand",
      "rootCause",
      "commitSha",
      "fixSummary",
      "reviewSummary",
      "reviewFeedback",
      "reviewAttempted",
      "prNumber",
      "prUrl",
      "headSha",
      "mergeCommit",
      "lastOutcome"
    ],
    "additionalProperties": false
  },
  "initialContext": {
    "deliveryMode": "draft-pr",
    "targetBranch": "",
    "mergeMethod": "squash",
    "requireReproduction": true,
    "requireReview": true,
    "sentryTriage": "comment",
    "severityFilter": "error",
    "onFailure": "skip-and-continue",
    "dailyLimit": 5,
    "routeId": "",
    "runId": "",
    "activeRouteId": "",
    "issueKey": "",
    "issueId": "",
    "shortId": "",
    "issueTitle": "",
    "issueUrl": "",
    "issueSummary": "",
    "worktreePath": "",
    "branch": "",
    "baseBranch": "",
    "baseSha": "",
    "githubRepository": "",
    "reproCommand": "",
    "rootCause": "",
    "commitSha": "",
    "fixSummary": "",
    "reviewSummary": "",
    "reviewFeedback": "",
    "reviewAttempted": false,
    "prNumber": 0,
    "prUrl": "",
    "headSha": "",
    "mergeCommit": "",
    "lastOutcome": ""
  },
  "states": [
    {
      "id": "watch",
      "kind": "wait",
      "title": "Watch Sentry",
      "subtitle": "10m poll + webhook",
      "triggers": [
        {
          "kind": "check",
          "everyMs": 600000
        },
        {
          "kind": "event",
          "eventType": "sentry.issue-received",
          "filter": {}
        },
        {
          "kind": "event",
          "eventType": "sentry.check-now",
          "filter": {}
        }
      ]
    },
    {
      "id": "check-issues",
      "kind": "command",
      "title": "Check Sentry",
      "subtitle": "fetch next issue",
      "action": {
        "argv": [
          {
            "literal": "omnyo"
          },
          {
            "literal": "sentry"
          },
          {
            "literal": "auto-solve"
          },
          {
            "literal": "check-issues"
          }
        ],
        "shell": false,
        "cwd": ".",
        "environmentId": null,
        "successExitCodes": [0],
        "retrySafety": "never"
      },
      "deadlineMs": 120000,
      "maxAttempts": 1,
      "effect": "external-read",
      "effectTarget": "Configured Sentry plugin route & repository",
      "annotations": {
        "category": "repository"
      }
    },
    {
      "id": "check-reproduce",
      "kind": "choice",
      "title": "Replicate?",
      "subtitle": "requireReproduction"
    },
    {
      "id": "reproduce",
      "kind": "agent",
      "title": "Replicate bug",
      "subtitle": "prove failure first",
      "action": {
        "prompt": "Replicate Sentry issue context.shortId (context.issueTitle) BEFORE editing any fix. Work ONLY inside the isolated worktree path in context.worktreePath on branch context.branch (never edit the primary checkout). Inspect context.issueSummary, context.issueUrl, and the code around the stacktrace. Write or run a deterministic failing test or harmless reproduction command that proves the trigger -> faulty state -> failure. Keep reproduction artifacts inside worktreePath (do not fix production logic yet). Submit omnyo_state_machine_result with 'reproduced' ({reproCommand, rootCause}), 'not-reproducible' ({reason}), or 'not-actionable' ({reason}).",
        "execution": null,
        "permissionMode": "full",
        "environmentId": null,
        "result": {
          "outcomes": [
            {
              "name": "reproduced",
              "fields": [
                {
                  "name": "reproCommand",
                  "schema": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "required": true
                },
                {
                  "name": "rootCause",
                  "schema": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  },
                  "required": true
                }
              ]
            },
            {
              "name": "not-reproducible",
              "fields": [
                {
                  "name": "reason",
                  "schema": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "required": true
                }
              ]
            },
            {
              "name": "not-actionable",
              "fields": [
                {
                  "name": "reason",
                  "schema": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "required": true
                }
              ]
            }
          ]
        }
      },
      "deadlineMs": 1800000,
      "maxAttempts": 1,
      "effect": "local-edit",
      "effectTarget": "Isolated worktree in context.worktreePath",
      "annotations": {
        "category": "repository"
      }
    },
    {
      "id": "solve",
      "kind": "agent",
      "title": "Solve issue",
      "subtitle": "fix, test & commit",
      "action": {
        "prompt": "Implement the smallest root-cause fix for Sentry issue context.shortId inside the isolated worktree context.worktreePath on branch context.branch. Use context.reproCommand, context.rootCause, and any context.reviewFeedback. Verify your regression test fails without the fix and passes with it, run the repository checks, and commit your exact changed files on branch context.branch in context.worktreePath. Do NOT push, open PRs, merge, deploy, or mutate Sentry state — downstream workflow steps handle those effects. Submit omnyo_state_machine_result with 'fixed' ({commitSha, summary}) or 'cannot-fix' ({reason}).",
        "execution": null,
        "permissionMode": "full",
        "environmentId": null,
        "result": {
          "outcomes": [
            {
              "name": "fixed",
              "fields": [
                {
                  "name": "commitSha",
                  "schema": {
                    "type": "string",
                    "minLength": 7,
                    "maxLength": 64
                  },
                  "required": true
                },
                {
                  "name": "summary",
                  "schema": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  },
                  "required": true
                }
              ]
            },
            {
              "name": "cannot-fix",
              "fields": [
                {
                  "name": "reason",
                  "schema": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "required": true
                }
              ]
            }
          ]
        }
      },
      "deadlineMs": 1800000,
      "maxAttempts": 1,
      "effect": "local-edit",
      "effectTarget": "Isolated worktree in context.worktreePath",
      "annotations": {
        "category": "repository"
      }
    },
    {
      "id": "check-review",
      "kind": "choice",
      "title": "Review?",
      "subtitle": "requireReview"
    },
    {
      "id": "review",
      "kind": "agent",
      "title": "Review fix",
      "subtitle": "independent check",
      "action": {
        "prompt": "Perform a read-only independent review inside context.worktreePath of git diff context.baseSha...context.commitSha for Sentry issue context.shortId. Verify the fix addresses the root cause, the regression test proves before/after behavior, and no unrelated changes, swallowed errors, or security issues exist. Do NOT modify files or push. Submit omnyo_state_machine_result with 'approved' ({summary}) or 'changes-required' ({feedback}).",
        "execution": null,
        "permissionMode": "full",
        "environmentId": null,
        "result": {
          "outcomes": [
            {
              "name": "approved",
              "fields": [
                {
                  "name": "summary",
                  "schema": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  },
                  "required": true
                }
              ]
            },
            {
              "name": "changes-required",
              "fields": [
                {
                  "name": "feedback",
                  "schema": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  },
                  "required": true
                }
              ]
            }
          ]
        }
      },
      "deadlineMs": 900000,
      "maxAttempts": 1,
      "effect": "local-read",
      "effectTarget": "Isolated worktree in context.worktreePath",
      "annotations": {
        "category": "repository"
      }
    },
    {
      "id": "check-review-retry",
      "kind": "choice",
      "title": "Retry fix?",
      "subtitle": "once per issue"
    },
    {
      "id": "choose-delivery",
      "kind": "choice",
      "title": "Delivery mode",
      "subtitle": "local / PR / auto-merge"
    },
    {
      "id": "create-pr",
      "kind": "command",
      "title": "Create PR",
      "subtitle": "push & open pull request",
      "action": {
        "argv": [
          {
            "literal": "omnyo"
          },
          {
            "literal": "sentry"
          },
          {
            "literal": "auto-solve"
          },
          {
            "literal": "create-pr"
          }
        ],
        "shell": false,
        "cwd": ".",
        "environmentId": null,
        "successExitCodes": [0],
        "retrySafety": "never"
      },
      "deadlineMs": 600000,
      "maxAttempts": 1,
      "effect": "external-write",
      "effectTarget": "Configured Sentry plugin route & repository",
      "annotations": {
        "category": "release"
      }
    },
    {
      "id": "check-merge",
      "kind": "choice",
      "title": "Auto-merge?",
      "subtitle": "deliveryMode"
    },
    {
      "id": "merge-pr",
      "kind": "command",
      "title": "Auto-merge PR",
      "subtitle": "wait CI & merge",
      "action": {
        "argv": [
          {
            "literal": "omnyo"
          },
          {
            "literal": "sentry"
          },
          {
            "literal": "auto-solve"
          },
          {
            "literal": "merge-pr"
          }
        ],
        "shell": false,
        "cwd": ".",
        "environmentId": null,
        "successExitCodes": [0],
        "retrySafety": "never"
      },
      "deadlineMs": 600000,
      "maxAttempts": 1,
      "effect": "external-write",
      "effectTarget": "Configured Sentry plugin route & repository",
      "annotations": {
        "category": "release"
      }
    },
    {
      "id": "wait-checks",
      "kind": "wait",
      "title": "Wait for CI",
      "subtitle": "every 2m",
      "triggers": [
        {
          "kind": "check",
          "everyMs": 120000
        }
      ]
    },
    {
      "id": "check-triage",
      "kind": "choice",
      "title": "Triage Sentry?",
      "subtitle": "sentryTriage"
    },
    {
      "id": "triage-sentry",
      "kind": "command",
      "title": "Triage Sentry",
      "subtitle": "comment / resolve",
      "action": {
        "argv": [
          {
            "literal": "omnyo"
          },
          {
            "literal": "sentry"
          },
          {
            "literal": "auto-solve"
          },
          {
            "literal": "triage-sentry"
          }
        ],
        "shell": false,
        "cwd": ".",
        "environmentId": null,
        "successExitCodes": [0],
        "retrySafety": "never"
      },
      "deadlineMs": 180000,
      "maxAttempts": 1,
      "effect": "external-write",
      "effectTarget": "Configured Sentry plugin route & repository",
      "annotations": {
        "category": "repository"
      }
    },
    {
      "id": "cleanup",
      "kind": "command",
      "title": "Clean up",
      "subtitle": "release worktree & reset",
      "action": {
        "argv": [
          {
            "literal": "omnyo"
          },
          {
            "literal": "sentry"
          },
          {
            "literal": "auto-solve"
          },
          {
            "literal": "cleanup"
          }
        ],
        "shell": false,
        "cwd": ".",
        "environmentId": null,
        "successExitCodes": [0],
        "retrySafety": "never"
      },
      "deadlineMs": 120000,
      "maxAttempts": 1,
      "effect": "local-edit",
      "effectTarget": "Configured Sentry plugin route & repository",
      "annotations": {
        "category": "repository"
      }
    },
    {
      "id": "handle-unfixable",
      "kind": "choice",
      "title": "Unfixable?",
      "subtitle": "onFailure"
    },
    {
      "id": "handle-error",
      "kind": "choice",
      "title": "On error",
      "subtitle": "onFailure"
    },
    {
      "id": "needs-person",
      "kind": "manual",
      "title": "Needs review",
      "subtitle": "paused on failure",
      "prompt": "Inspect the linked step chat, worktree (context.worktreePath), and PR (context.prUrl) before choosing how to continue the background watcher.",
      "decisions": [
        {
          "id": "retry-check",
          "label": "Recheck Sentry now",
          "evidenceRequired": false,
          "evidencePrompt": ""
        },
        {
          "id": "retry-solve",
          "label": "Retry solve step",
          "evidenceRequired": false,
          "evidencePrompt": ""
        },
        {
          "id": "skip-issue",
          "label": "Skip issue & continue",
          "evidenceRequired": false,
          "evidencePrompt": ""
        },
        {
          "id": "wait-next",
          "label": "Sleep until next check",
          "evidenceRequired": false,
          "evidencePrompt": ""
        }
      ]
    }
  ],
  "transitions": [
    {
      "id": "tr_found",
      "from": "check-issues",
      "to": "check-reproduce",
      "trigger": {
        "kind": "result",
        "outcome": "issue-found"
      },
      "guard": null,
      "contextPatch": [
        {
          "op": "set",
          "path": ["runId"],
          "value": {
            "root": "result",
            "segments": ["runId"]
          }
        },
        {
          "op": "set",
          "path": ["activeRouteId"],
          "value": {
            "root": "result",
            "segments": ["activeRouteId"]
          }
        },
        {
          "op": "set",
          "path": ["issueKey"],
          "value": {
            "root": "result",
            "segments": ["issueKey"]
          }
        },
        {
          "op": "set",
          "path": ["issueId"],
          "value": {
            "root": "result",
            "segments": ["issueId"]
          }
        },
        {
          "op": "set",
          "path": ["shortId"],
          "value": {
            "root": "result",
            "segments": ["shortId"]
          }
        },
        {
          "op": "set",
          "path": ["issueTitle"],
          "value": {
            "root": "result",
            "segments": ["issueTitle"]
          }
        },
        {
          "op": "set",
          "path": ["issueUrl"],
          "value": {
            "root": "result",
            "segments": ["issueUrl"]
          }
        },
        {
          "op": "set",
          "path": ["issueSummary"],
          "value": {
            "root": "result",
            "segments": ["issueSummary"]
          }
        },
        {
          "op": "set",
          "path": ["worktreePath"],
          "value": {
            "root": "result",
            "segments": ["worktreePath"]
          }
        },
        {
          "op": "set",
          "path": ["branch"],
          "value": {
            "root": "result",
            "segments": ["branch"]
          }
        },
        {
          "op": "set",
          "path": ["baseBranch"],
          "value": {
            "root": "result",
            "segments": ["baseBranch"]
          }
        },
        {
          "op": "set",
          "path": ["baseSha"],
          "value": {
            "root": "result",
            "segments": ["baseSha"]
          }
        },
        {
          "op": "set",
          "path": ["githubRepository"],
          "value": {
            "root": "result",
            "segments": ["githubRepository"]
          }
        },
        {
          "op": "set",
          "path": ["reproCommand"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["rootCause"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["commitSha"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["fixSummary"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["reviewSummary"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["reviewFeedback"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["reviewAttempted"],
          "value": false
        },
        {
          "op": "set",
          "path": ["prNumber"],
          "value": 0
        },
        {
          "op": "set",
          "path": ["prUrl"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["headSha"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["mergeCommit"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["lastOutcome"],
          "value": "investigating"
        }
      ],
      "priority": 0
    },
    {
      "id": "tr_idle",
      "from": "check-issues",
      "to": "watch",
      "trigger": {
        "kind": "result",
        "outcome": "no-issues"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 1
    },
    {
      "id": "tr_check_err",
      "from": "check-issues",
      "to": "handle-error",
      "trigger": {
        "kind": "failed"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_check_timeout",
      "from": "check-issues",
      "to": "handle-error",
      "trigger": {
        "kind": "timed-out"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_wake_timer",
      "from": "watch",
      "to": "check-issues",
      "trigger": {
        "kind": "timer"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_wake_webhook",
      "from": "watch",
      "to": "check-issues",
      "trigger": {
        "kind": "event",
        "eventType": "sentry.issue-received"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_wake_manual",
      "from": "watch",
      "to": "check-issues",
      "trigger": {
        "kind": "event",
        "eventType": "sentry.check-now"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 1
    },
    {
      "id": "tr_do_repro",
      "from": "check-reproduce",
      "to": "reproduce",
      "trigger": {
        "kind": "always"
      },
      "guard": {
        "eq": [
          {
            "root": "context",
            "segments": ["requireReproduction"]
          },
          true
        ]
      },
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_skip_repro",
      "from": "check-reproduce",
      "to": "solve",
      "trigger": {
        "kind": "always"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 1
    },
    {
      "id": "tr_reproduced",
      "from": "reproduce",
      "to": "solve",
      "trigger": {
        "kind": "result",
        "outcome": "reproduced"
      },
      "guard": null,
      "contextPatch": [
        {
          "op": "set",
          "path": ["reproCommand"],
          "value": {
            "root": "result",
            "segments": ["reproCommand"]
          }
        },
        {
          "op": "set",
          "path": ["rootCause"],
          "value": {
            "root": "result",
            "segments": ["rootCause"]
          }
        }
      ],
      "priority": 0
    },
    {
      "id": "tr_not_repro",
      "from": "reproduce",
      "to": "handle-unfixable",
      "trigger": {
        "kind": "result",
        "outcome": "not-reproducible"
      },
      "guard": null,
      "contextPatch": [
        {
          "op": "set",
          "path": ["lastOutcome"],
          "value": "not-reproducible"
        }
      ],
      "priority": 1
    },
    {
      "id": "tr_not_actionable",
      "from": "reproduce",
      "to": "handle-unfixable",
      "trigger": {
        "kind": "result",
        "outcome": "not-actionable"
      },
      "guard": null,
      "contextPatch": [
        {
          "op": "set",
          "path": ["lastOutcome"],
          "value": "not-actionable"
        }
      ],
      "priority": 2
    },
    {
      "id": "tr_repro_missing",
      "from": "reproduce",
      "to": "handle-error",
      "trigger": {
        "kind": "no-result"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_repro_err",
      "from": "reproduce",
      "to": "handle-error",
      "trigger": {
        "kind": "failed"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_repro_timeout",
      "from": "reproduce",
      "to": "handle-error",
      "trigger": {
        "kind": "timed-out"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_solved",
      "from": "solve",
      "to": "check-review",
      "trigger": {
        "kind": "result",
        "outcome": "fixed"
      },
      "guard": null,
      "contextPatch": [
        {
          "op": "set",
          "path": ["commitSha"],
          "value": {
            "root": "result",
            "segments": ["commitSha"]
          }
        },
        {
          "op": "set",
          "path": ["fixSummary"],
          "value": {
            "root": "result",
            "segments": ["summary"]
          }
        },
        {
          "op": "set",
          "path": ["lastOutcome"],
          "value": "fixed"
        }
      ],
      "priority": 0
    },
    {
      "id": "tr_cannot_fix",
      "from": "solve",
      "to": "handle-unfixable",
      "trigger": {
        "kind": "result",
        "outcome": "cannot-fix"
      },
      "guard": null,
      "contextPatch": [
        {
          "op": "set",
          "path": ["lastOutcome"],
          "value": "cannot-fix"
        }
      ],
      "priority": 1
    },
    {
      "id": "tr_solve_missing",
      "from": "solve",
      "to": "handle-error",
      "trigger": {
        "kind": "no-result"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_solve_err",
      "from": "solve",
      "to": "handle-error",
      "trigger": {
        "kind": "failed"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_solve_timeout",
      "from": "solve",
      "to": "handle-error",
      "trigger": {
        "kind": "timed-out"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_do_review",
      "from": "check-review",
      "to": "review",
      "trigger": {
        "kind": "always"
      },
      "guard": {
        "eq": [
          {
            "root": "context",
            "segments": ["requireReview"]
          },
          true
        ]
      },
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_skip_review",
      "from": "check-review",
      "to": "choose-delivery",
      "trigger": {
        "kind": "always"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 1
    },
    {
      "id": "tr_review_ok",
      "from": "review",
      "to": "choose-delivery",
      "trigger": {
        "kind": "result",
        "outcome": "approved"
      },
      "guard": null,
      "contextPatch": [
        {
          "op": "set",
          "path": ["reviewSummary"],
          "value": {
            "root": "result",
            "segments": ["summary"]
          }
        }
      ],
      "priority": 0
    },
    {
      "id": "tr_review_changes",
      "from": "review",
      "to": "check-review-retry",
      "trigger": {
        "kind": "result",
        "outcome": "changes-required"
      },
      "guard": null,
      "contextPatch": [
        {
          "op": "set",
          "path": ["reviewFeedback"],
          "value": {
            "root": "result",
            "segments": ["feedback"]
          }
        }
      ],
      "priority": 1
    },
    {
      "id": "tr_review_missing",
      "from": "review",
      "to": "handle-error",
      "trigger": {
        "kind": "no-result"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_review_err",
      "from": "review",
      "to": "handle-error",
      "trigger": {
        "kind": "failed"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_review_timeout",
      "from": "review",
      "to": "handle-error",
      "trigger": {
        "kind": "timed-out"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_retry_solve",
      "from": "check-review-retry",
      "to": "solve",
      "trigger": {
        "kind": "always"
      },
      "guard": {
        "eq": [
          {
            "root": "context",
            "segments": ["reviewAttempted"]
          },
          false
        ]
      },
      "contextPatch": [
        {
          "op": "set",
          "path": ["reviewAttempted"],
          "value": true
        }
      ],
      "priority": 0
    },
    {
      "id": "tr_review_exhausted",
      "from": "check-review-retry",
      "to": "handle-error",
      "trigger": {
        "kind": "always"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 1
    },
    {
      "id": "tr_deliver_local",
      "from": "choose-delivery",
      "to": "check-triage",
      "trigger": {
        "kind": "always"
      },
      "guard": {
        "eq": [
          {
            "root": "context",
            "segments": ["deliveryMode"]
          },
          "local"
        ]
      },
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_deliver_pr",
      "from": "choose-delivery",
      "to": "create-pr",
      "trigger": {
        "kind": "always"
      },
      "guard": {
        "in": [
          {
            "root": "context",
            "segments": ["deliveryMode"]
          },
          ["draft-pr", "pr", "pr-auto-merge"]
        ]
      },
      "contextPatch": [],
      "priority": 1
    },
    {
      "id": "tr_deliver_default",
      "from": "choose-delivery",
      "to": "check-triage",
      "trigger": {
        "kind": "always"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 2
    },
    {
      "id": "tr_pr_opened",
      "from": "create-pr",
      "to": "check-merge",
      "trigger": {
        "kind": "result",
        "outcome": "pr-created"
      },
      "guard": null,
      "contextPatch": [
        {
          "op": "set",
          "path": ["prNumber"],
          "value": {
            "root": "result",
            "segments": ["prNumber"]
          }
        },
        {
          "op": "set",
          "path": ["prUrl"],
          "value": {
            "root": "result",
            "segments": ["prUrl"]
          }
        },
        {
          "op": "set",
          "path": ["headSha"],
          "value": {
            "root": "result",
            "segments": ["headSha"]
          }
        },
        {
          "op": "set",
          "path": ["lastOutcome"],
          "value": "pr-created"
        }
      ],
      "priority": 0
    },
    {
      "id": "tr_pr_err",
      "from": "create-pr",
      "to": "handle-error",
      "trigger": {
        "kind": "failed"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_pr_timeout",
      "from": "create-pr",
      "to": "handle-error",
      "trigger": {
        "kind": "timed-out"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_do_merge",
      "from": "check-merge",
      "to": "merge-pr",
      "trigger": {
        "kind": "always"
      },
      "guard": {
        "eq": [
          {
            "root": "context",
            "segments": ["deliveryMode"]
          },
          "pr-auto-merge"
        ]
      },
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_leave_pr",
      "from": "check-merge",
      "to": "check-triage",
      "trigger": {
        "kind": "always"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 1
    },
    {
      "id": "tr_pr_merged",
      "from": "merge-pr",
      "to": "check-triage",
      "trigger": {
        "kind": "result",
        "outcome": "merged"
      },
      "guard": null,
      "contextPatch": [
        {
          "op": "set",
          "path": ["mergeCommit"],
          "value": {
            "root": "result",
            "segments": ["mergeCommit"]
          }
        },
        {
          "op": "set",
          "path": ["lastOutcome"],
          "value": "merged"
        }
      ],
      "priority": 0
    },
    {
      "id": "tr_checks_wait",
      "from": "merge-pr",
      "to": "wait-checks",
      "trigger": {
        "kind": "result",
        "outcome": "pending"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 1
    },
    {
      "id": "tr_checks_red",
      "from": "merge-pr",
      "to": "handle-error",
      "trigger": {
        "kind": "result",
        "outcome": "checks-failed"
      },
      "guard": null,
      "contextPatch": [
        {
          "op": "set",
          "path": ["lastOutcome"],
          "value": "checks-failed"
        }
      ],
      "priority": 2
    },
    {
      "id": "tr_merge_err",
      "from": "merge-pr",
      "to": "handle-error",
      "trigger": {
        "kind": "failed"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_merge_timeout",
      "from": "merge-pr",
      "to": "handle-error",
      "trigger": {
        "kind": "timed-out"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_recheck_ci",
      "from": "wait-checks",
      "to": "merge-pr",
      "trigger": {
        "kind": "timer"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_do_triage",
      "from": "check-triage",
      "to": "triage-sentry",
      "trigger": {
        "kind": "always"
      },
      "guard": {
        "ne": [
          {
            "root": "context",
            "segments": ["sentryTriage"]
          },
          "none"
        ]
      },
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_skip_triage",
      "from": "check-triage",
      "to": "cleanup",
      "trigger": {
        "kind": "always"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 1
    },
    {
      "id": "tr_triaged",
      "from": "triage-sentry",
      "to": "cleanup",
      "trigger": {
        "kind": "result",
        "outcome": "triaged"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_triage_err",
      "from": "triage-sentry",
      "to": "handle-error",
      "trigger": {
        "kind": "failed"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_triage_timeout",
      "from": "triage-sentry",
      "to": "handle-error",
      "trigger": {
        "kind": "timed-out"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_cleaned",
      "from": "cleanup",
      "to": "watch",
      "trigger": {
        "kind": "result",
        "outcome": "cleaned"
      },
      "guard": null,
      "contextPatch": [
        {
          "op": "set",
          "path": ["runId"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["activeRouteId"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["issueKey"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["issueId"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["shortId"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["issueTitle"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["issueUrl"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["issueSummary"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["worktreePath"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["branch"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["baseBranch"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["baseSha"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["githubRepository"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["reproCommand"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["rootCause"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["commitSha"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["fixSummary"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["reviewSummary"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["reviewFeedback"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["reviewAttempted"],
          "value": false
        },
        {
          "op": "set",
          "path": ["prNumber"],
          "value": 0
        },
        {
          "op": "set",
          "path": ["prUrl"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["headSha"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["mergeCommit"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["lastOutcome"],
          "value": ""
        }
      ],
      "priority": 0
    },
    {
      "id": "tr_cleanup_err",
      "from": "cleanup",
      "to": "watch",
      "trigger": {
        "kind": "failed"
      },
      "guard": null,
      "contextPatch": [
        {
          "op": "set",
          "path": ["runId"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["activeRouteId"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["issueKey"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["issueId"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["shortId"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["issueTitle"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["issueUrl"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["issueSummary"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["worktreePath"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["branch"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["baseBranch"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["baseSha"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["githubRepository"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["reproCommand"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["rootCause"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["commitSha"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["fixSummary"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["reviewSummary"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["reviewFeedback"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["reviewAttempted"],
          "value": false
        },
        {
          "op": "set",
          "path": ["prNumber"],
          "value": 0
        },
        {
          "op": "set",
          "path": ["prUrl"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["headSha"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["mergeCommit"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["lastOutcome"],
          "value": ""
        }
      ],
      "priority": 0
    },
    {
      "id": "tr_cleanup_timeout",
      "from": "cleanup",
      "to": "watch",
      "trigger": {
        "kind": "timed-out"
      },
      "guard": null,
      "contextPatch": [
        {
          "op": "set",
          "path": ["runId"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["activeRouteId"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["issueKey"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["issueId"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["shortId"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["issueTitle"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["issueUrl"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["issueSummary"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["worktreePath"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["branch"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["baseBranch"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["baseSha"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["githubRepository"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["reproCommand"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["rootCause"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["commitSha"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["fixSummary"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["reviewSummary"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["reviewFeedback"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["reviewAttempted"],
          "value": false
        },
        {
          "op": "set",
          "path": ["prNumber"],
          "value": 0
        },
        {
          "op": "set",
          "path": ["prUrl"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["headSha"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["mergeCommit"],
          "value": ""
        },
        {
          "op": "set",
          "path": ["lastOutcome"],
          "value": ""
        }
      ],
      "priority": 0
    },
    {
      "id": "tr_unfixable_pause",
      "from": "handle-unfixable",
      "to": "needs-person",
      "trigger": {
        "kind": "always"
      },
      "guard": {
        "eq": [
          {
            "root": "context",
            "segments": ["onFailure"]
          },
          "pause-for-review"
        ]
      },
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_unfixable_skip",
      "from": "handle-unfixable",
      "to": "cleanup",
      "trigger": {
        "kind": "always"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 1
    },
    {
      "id": "tr_error_pause",
      "from": "handle-error",
      "to": "needs-person",
      "trigger": {
        "kind": "always"
      },
      "guard": {
        "eq": [
          {
            "root": "context",
            "segments": ["onFailure"]
          },
          "pause-for-review"
        ]
      },
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_error_skip",
      "from": "handle-error",
      "to": "cleanup",
      "trigger": {
        "kind": "always"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 1
    },
    {
      "id": "tr_person_retry_check",
      "from": "needs-person",
      "to": "check-issues",
      "trigger": {
        "kind": "decision",
        "decisionId": "retry-check"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 0
    },
    {
      "id": "tr_person_retry_solve",
      "from": "needs-person",
      "to": "solve",
      "trigger": {
        "kind": "decision",
        "decisionId": "retry-solve"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 1
    },
    {
      "id": "tr_person_skip",
      "from": "needs-person",
      "to": "cleanup",
      "trigger": {
        "kind": "decision",
        "decisionId": "skip-issue"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 2
    },
    {
      "id": "tr_person_wait",
      "from": "needs-person",
      "to": "watch",
      "trigger": {
        "kind": "decision",
        "decisionId": "wait-next"
      },
      "guard": null,
      "contextPatch": [],
      "priority": 3
    }
  ],
  "limits": {
    "microstepsPerWake": 32,
    "actionStartsPerFiveMinutes": 10,
    "repairAttemptsPerSubject": 2
  },
  "layout": {
    "initial": {
      "x": 80,
      "y": 0
    },
    "nodes": {
      "check-issues": {
        "x": 80,
        "y": 80
      },
      "watch": {
        "x": 80,
        "y": 340
      },
      "check-reproduce": {
        "x": 380,
        "y": 80
      },
      "reproduce": {
        "x": 680,
        "y": 80
      },
      "solve": {
        "x": 980,
        "y": 80
      },
      "check-review": {
        "x": 1280,
        "y": 80
      },
      "review": {
        "x": 1580,
        "y": 80
      },
      "check-review-retry": {
        "x": 1580,
        "y": 340
      },
      "choose-delivery": {
        "x": 1280,
        "y": 340
      },
      "create-pr": {
        "x": 980,
        "y": 340
      },
      "check-merge": {
        "x": 680,
        "y": 340
      },
      "merge-pr": {
        "x": 680,
        "y": 600
      },
      "wait-checks": {
        "x": 980,
        "y": 600
      },
      "check-triage": {
        "x": 380,
        "y": 340
      },
      "triage-sentry": {
        "x": 380,
        "y": 600
      },
      "cleanup": {
        "x": 80,
        "y": 600
      },
      "handle-unfixable": {
        "x": 1280,
        "y": 600
      },
      "handle-error": {
        "x": 1580,
        "y": 600
      },
      "needs-person": {
        "x": 1280,
        "y": 840
      }
    },
    "edges": {},
    "edgeLabels": {
      "tr_found": "issue found",
      "tr_idle": "no new issues",
      "tr_check_err": "check failed",
      "tr_check_timeout": "check timed out",
      "tr_wake_timer": "poll schedule",
      "tr_wake_webhook": "Sentry webhook",
      "tr_wake_manual": "check now",
      "tr_do_repro": "replicate first",
      "tr_skip_repro": "skip repro",
      "tr_reproduced": "replicated",
      "tr_not_repro": "not reproducible",
      "tr_not_actionable": "not actionable",
      "tr_repro_missing": "no result",
      "tr_repro_err": "repro failed",
      "tr_repro_timeout": "repro timed out",
      "tr_solved": "fixed & tested",
      "tr_cannot_fix": "cannot fix",
      "tr_solve_missing": "no result",
      "tr_solve_err": "solve failed",
      "tr_solve_timeout": "solve timed out",
      "tr_do_review": "review required",
      "tr_skip_review": "skip review",
      "tr_review_ok": "approved",
      "tr_review_changes": "changes requested",
      "tr_review_missing": "no result",
      "tr_review_err": "review failed",
      "tr_review_timeout": "review timed out",
      "tr_retry_solve": "fix review feedback",
      "tr_review_exhausted": "review limit",
      "tr_deliver_local": "keep local",
      "tr_deliver_pr": "open PR",
      "tr_deliver_default": "default",
      "tr_pr_opened": "PR created",
      "tr_pr_err": "PR failed",
      "tr_pr_timeout": "PR timed out",
      "tr_do_merge": "auto-merge enabled",
      "tr_leave_pr": "leave PR open",
      "tr_pr_merged": "merged",
      "tr_checks_wait": "CI pending",
      "tr_checks_red": "CI failed",
      "tr_merge_err": "merge failed",
      "tr_merge_timeout": "merge timed out",
      "tr_recheck_ci": "recheck CI",
      "tr_do_triage": "update Sentry",
      "tr_skip_triage": "skip Sentry triage",
      "tr_triaged": "triaged",
      "tr_triage_err": "triage failed",
      "tr_triage_timeout": "triage timed out",
      "tr_cleaned": "ready for next check",
      "tr_cleanup_err": "cleanup warning",
      "tr_cleanup_timeout": "cleanup timed out",
      "tr_unfixable_pause": "pause for review",
      "tr_unfixable_skip": "skip & continue",
      "tr_error_pause": "pause for review",
      "tr_error_skip": "skip & continue",
      "tr_person_retry_check": "recheck Sentry",
      "tr_person_retry_solve": "retry solve",
      "tr_person_skip": "skip issue",
      "tr_person_wait": "sleep until next"
    }
  }
}
