The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Drop the `fix-flaky-test` command (#76299)
Nemanja Glumacdc80345e6605
diff --git a/.claude/commands/fix-flaky-test.md b/.claude/commands/fix-flaky-test.mddeleted file mode 100644index 48ff5e49f1c..00000000000--- a/.claude/commands/fix-flaky-test.md+++ /dev/null@@ -1,297 +0,0 @@-----description: Diagnose and fix a flaky Cypress e2e test, then verify the fix with CI stress runs in a bounded loop------Fix flaky e2e test: $ARGUMENTS--You are orchestrating a **bounded flake-fix loop** with a real CI feedback signal. The-only integration tool for the loop is `gh` (trigger the stress workflow + read results).-The Linear issue is the input. Everything else is reasoning over files.--**Hard rules — do not deviate:**-- **Max 3 attempts.** One attempt = diagnose → fix → push → 2 stress runs → interpret.- After 3 failed attempts, stop and hand back.-- **Branch existence is the go/no-go gate.** Before starting, check whether the remote branch- `automated-e2e-flake-fix-<LINEAR_ID>` already exists (Phase 0). If it does, a run- is already in flight (or already landed a fix) → **stop, do nothing**. If it doesn't,- proceed through the whole loop and push without pausing for confirmation. This runs- identically whether a human or automation triggered the command.-- **Linear access:** prefer the Linear MCP (`mcp__linear__*`); if it's unavailable (e.g.- headless CI), fall back to the Linear REST/GraphQL API with a token — for both reads and- comment writes.-- **Always write to the *resolved* issue, never the raw `$ARGUMENTS` ref.** Issues are born- `DEV-####` and **re-keyed when moved to another team** (`DEV-2180` → `UXW-4514`). `get_issue`- resolves the old ref (it's redirect-aware), but `list_comments`/`save_comment` with the stale- ref **404**. Capture the issue's UUID + current identifier in Phase 0 and use the **UUID** for- every Linear read/write.-- **Heartbeat — post progress at every phase boundary.** It's the only run-visibility in- headless CI (the GH job log isn't streamed live), so never skip it. Prefer ONE rolling comment- (record its id in the state file, update it in place); if your write path can't update, post- terse per-phase comments instead. Update at: run start (+ `GITHUB_ACTIONS_RUN_URL` if set),- diagnosis done (#1 reason + hypothesis), branch pushed + **both stress run URLs**, and each- attempt's verdict.-- **Each attempt triggers TWO stress runs in parallel** — `enable_network_throttling=true`- and `=false` — on the same branch/commit. The fix is verified only if **both** pass.-- **CI is the source of truth.** No local Cypress runs, no `bin/` stress scripts.-- **Branch names use `-` only, never `/`.**-- **Persist state** to a scratch file so the loop survives `ScheduleWakeup` and context- summarization.-------## Phase 0 — Resolve the target--1. Parse `$ARGUMENTS`:- - If it's a Linear ref (`DEV-####` or a Linear URL) → `mcp__linear__get_issue`. **Capture the- issue's UUID + current identifier + team** from the response and use them for all later- Linear ops (the ref you were handed may be stale — see the Linear-access rule). Read the- body for failure detail / screenshots / stack, and capture the **ranked failure reasons**- (Trunk lists them "most common" first) — #1 is what you fix first (Phase 1).- - **Derive the grep from the FULL Trunk test title, verbatim.** Trunk's `Test:` field is the- complete runtime title (e.g. `data model > data studio Undos allows to undo every action`).- Use the **whole string** as the grep — do **not** split on `>` or reduce it to the leaf- `it()` name. The `>` is often part of a `describe.each("… > %s")` template, not a separator,- and the discriminator (`data studio` vs `admin`) lives mid-title; dropping it makes the grep- match sibling parameterizations and burn the stress run on the wrong (non-flaky) branch.- - Otherwise treat it as a spec path or fuzzy test name (fallback; no Linear context).-2. **Compute the branch name + dedup gate (this is the go decision).** `<LINEAR_ID>` is the **bare**- dispatched Linear identifier (e.g. `DEV-2180`) — the same value the workflow uses to build the- branch (`automated-e2e-flake-fix-<LINEAR_ID>`). If `$ARGUMENTS` is a Linear **URL**, extract the- `DEV-####` identifier from it first — a URL contains `/` and is not a valid branch component.- The branch name is derived **only** from `<LINEAR_ID>`, and it's the **dispatched** identifier —- never the re-keyed canonical id (so dedup stays stable across a team move) and never the test- name:- `automated-e2e-flake-fix-<LINEAR_ID>` (e.g. `DEV-2181` →- `automated-e2e-flake-fix-DEV-2181`). Check whether it already exists on the remote:- ```bash- git ls-remote --exit-code --heads origin automated-e2e-flake-fix-<LINEAR_ID>- ```- - **Exists (exit 0)** → a run is already in flight or already landed a fix → **stop, do- nothing.** This is the whole dedup mechanism.- - **Doesn't exist (exit 2)** → that's the **go** signal. Proceed without pausing for- confirmation.- (On the no-Linear fallback path there's no ref to build the name from; that path stays- interactive and is for local debugging only.)-3. **Resolve the spec file** using the leaf `it()` name (just to locate the file):- ```bash- grep -rl "<leaf it() name>" e2e/test/scenarios- ```- Require **exactly one** *file* match. If 0 or >1, stop and ask the user to disambiguate. (Try- a shorter unique substring if the literal has special characters.) The **grep** passed to the- stress run is still the **full title** from step 1 — the leaf name is only for finding the file.- - **Watch for parameterized suites.** A single source `it()` under `describe.each(...)` /- `forEach` expands into **N runtime tests** (one per parameter), so one source match does- **not** mean one runtime test. Confirm the full-title grep targets exactly the flaky- parameterization (its discriminator must be present), or the stress run also executes the- non-flaky siblings — slow, and it dilutes `burn_in`.-4. **Decide `qa_db`:** scan the spec / its `describe` for external-DB helpers- (postgres/mysql/mongo-writable) or an `@external` tag → `true`, else `false`.-5. **Write the state file** `local/claude/e2e-flake-fix/<LINEAR_ID>.md`:- ```markdown- # Flake fix: <test name>- - linear_ref (dispatched): <DEV-#### or n/a>- - linear_uuid: <issue UUID — use for ALL Linear writes>- - linear_current_id: <e.g. UXW-#### — current identifier>- - heartbeat_comment_id: <set after the first progress comment>- - spec: <spec path>- - grep (full Trunk title): <full runtime title — NOT the leaf it() name>- - qa_db: <true|false>- - edition: ee- - branch: automated-e2e-flake-fix-<LINEAR_ID>- - attempt: 0 / 3-- ## Failure reasons (Trunk, ranked — fix #1 first)- 1. <dominant / most common>- 2. <rarer>- ...-- ## Attempts- ```- This file is the durable record. Re-read it on every `ScheduleWakeup` wake.--## Phase 1 — Diagnose (run at the start of every attempt)--- **Anchor on the #1 / most-common failure reason first.** Trunk lists the issue's failure- reasons ranked by frequency ("The N most common failure reasons…"). Fix the **dominant**- one and ignore the rarer reasons (#2, #3, …) unless the dominant one is fixed and they- still surface in CI. Do **not** rabbit-hole on a lower-frequency reason — that is the most- common way this loop wastes its 3 attempts. (Capture the ranked reasons in the state file- during Phase 0 so each attempt re-grounds on #1.)-- Read the spec, focused on the failing test, its `describe`, and any `before*`/`after*`- hooks. Read shared helpers it calls.-- Apply the flake anti-pattern checklist (from the `e2e-test-review` skill, as a mental- model — don't invoke it):- - numeric `cy.wait(<ms>)` instead of waiting on an alias- - `cy.intercept` registered **after** the action that triggers the request- - `.should("not.exist")` / negative assertions without a positive anchor first- - unscoped text selectors that can match more than one element- - off-by-one `.last()` / `.eq(-1)` without a length assertion- - JS conditionals on `cy` chains (no retry semantics)- - shared state / ordering assumptions between tests-- Fold in any failure detail from the Linear issue (and, on attempts 2–3, the downloaded- CI artifacts from the previous attempt).-- Write a **concrete hypothesis** to the state file's Attempts log before editing code.--## Phase 2 — Fix on a branch--- On **attempt 1 only**, create the branch computed in Phase 0 (dashes only, no `/`):- ```bash- git switch -c automated-e2e-flake-fix-<LINEAR_ID>- ```- On later attempts, keep committing to the same branch.-- Apply a **minimal** fix:- - **Default:** test-scoped (deterministic waits via `cy.intercept` + `cy.wait("@alias")`- before asserting; positive anchor before a negative assertion; scoped selectors).- - **Source code is allowed** only when you have **high conviction** the root cause is a- real product defect the test merely surfaces (e.g. a genuine race or non-deterministic- ordering). When you do, write the evidence for that conviction in the state file and- keep the **blast radius minimal**.--## Phase 2.5 — Share the diagnosis on Linear (before pushing)--- Once you have a confirmed root cause and a fix in hand, **before** the push/CI gate, post- the **debugging story** to the resolved issue (this doubles as the diagnosis heartbeat).- Keep it a tight narrative: the observed failure, the root cause (why the request never- fires), and the fix. Skip silently only if there's no Linear issue (spec/test fallback path).-- **Interactive vs headless:** when a human is driving interactively, draft it and let them- edit/approve first. When running **non-interactively** (headless CI, or the invocation says- not to ask), **just post it — never wait for an approval that can't come.**-- This is separate from the Phase 5 closeout comment — the value here is capturing the *why*- while it's fresh, independent of whether CI later confirms.--## Phase 3 — Push + stress (burn_in=50, fail_fast=true)--**One run, `fail_fast=true`, does both jobs.** A bad fix fails on the **first** iteration-and stops immediately (fast red + artifacts) — no need for a separate cheap sanity stage.-A good fix runs all 50 to green (full confirmation). So every attempt is a single pair of-runs at `burn_in=50` with `fail_fast=true` (throttle on + off).--- **Push without pausing for confirmation.** The branch-existence check in Phase 0 was the- go decision; if you reached this phase you're clear to commit, push, and trigger (same for- a human or automated trigger).-- Commit and push (first attempt only creates the branch; later attempts push the revised- fix), then trigger.--- **Decide `build_jar` (cumulative across the branch, not per-attempt).** With- `build_jar=false` the run downloads a prebuilt uberjar by walking the current commit's- ancestors; with `build_jar=true` it builds the uberjar from this branch, so the JAR is- guaranteed to match your source. Rule:- - If **every** commit on the branch (vs. the base) touches **only** test/spec code →- `build_jar=false`. There is no source change for a JAR to miss, so a download is correct- and saves the build time.- - If **any** commit on the branch changed backend or frontend source — whether this attempt- made it or an earlier one did → `build_jar=true`, and keep it `true` on every later run- (including a test-only attempt 2). We build defensively: it may be redundant if a matching- branch JAR already exists, but it removes any doubt that the stress run tested your actual- source. A redundant build is far cheaper than a hard-to-debug false green from a JAR that- silently didn't include the fix.- - Check with `git diff --name-only <base>...HEAD` and treat anything outside test paths- (`e2e/`, `**/*_test.clj`, `**.unit.*`, etc.) as source. Record the chosen value in the- state file.--### Trigger helper-**Always `git push` and confirm the remote branch is at your new commit BEFORE triggering.**-`gh workflow run --ref <branch>` resolves the ref on GitHub's side at dispatch time, so a-trigger that races an in-flight push will run the *previous* commit. After triggering,-verify with `gh run view <id> --json headSha` and re-trigger if it's stale.-```bash-git add -A && git commit -m "Fix flaky test: <test name>"-git push -u origin <branch> # PUSH FIRST — then trigger-TRIGGERED_AT=$(date -u +%Y-%m-%dT%H:%M:%SZ)-for throttle in true false; do- gh workflow run e2e-stress-test-flake-fix.yml --ref <branch> \- -f spec="<spec path>" \- -f grep="<full Trunk title from Phase 0 — NOT the leaf it() name>" \- -f burn_in="50" \- -f mb_edition="ee" \- -f qa_db="<true|false>" \- -f build_jar="<true|false>" \- -f enable_network_throttling="$throttle" \- -f fail_fast="true"-done-```-- **Capture both run IDs**, then **verify each `headSha` matches your pushed commit**:- ```bash- gh run list --workflow=e2e-stress-test-flake-fix.yml --branch <branch> \- --json databaseId,status,createdAt,event,headSha --limit 10- ```- Save both run IDs + URLs to the state file, tagged `throttled` / `unthrottled`.--## Phase 4 — Wait + interpret (gh only)--- **Auto-poll** with `ScheduleWakeup` (~900s / 15 min cadence) until **both** runs leave- `queued`/`in_progress`. Pass the same `/fix-flaky-test $ARGUMENTS`- back so the loop resumes; re-read the state file on each wake (a manual wake must also- work). Don't poll faster than ~900s.-- When both finish, read each conclusion:- ```bash- gh run view <id> --json status,conclusion- ```- - **Either `cancelled`** → assume a **human cancelled** it. Stop the whole task- immediately — do **not** retry, do **not** open a PR. Note it in the state file and- hand back. (A `cancelled` conclusion means manual cancellation; a `timed_out`- conclusion does **not** — treat `timed_out` like a failure below.)- - **Either `failure` / `timed_out`** → fix is not holding (`fail_fast` stopped at the- first bad iteration, so the artifact is fresh and minimal):- ```bash- gh run download <failed-id> --dir local/claude/e2e-flake-fix/<failed-id>-artifacts- ```- The Cypress error lives in the GitHub step log (`gh run view <id> --log-failed`) and the- screenshots/video — **not** in `logs/test.log` (that's only the backend health log).- Read the failure screenshot(s) (vision) and the step-log error; append findings to the- state file; increment `attempt`. If `attempt < 3` → loop back to **Phase 1** with the- new evidence. If `attempt == 3` → Phase 5 (exhausted).- - **Both `success`** (all 50 iterations passed, both throttle modes) → fixed → Phase 5.-- Don't worry about CI cost.--## Phase 5 — Conclude--- **Fixed** — open a PR (the upfront OK already authorized the push; don't re-gate):- ```bash- gh pr create --title "Fix flaky test: <test name>" --body "<body>"- ```- **The PR can NEVER auto-merge** — it always requires at least one human approval, no- matter how green the stress runs are, and never enable auto-merge. A passing stress run is- *necessary but not sufficient*: it proves the test is stable, not that the root cause was- fixed rather than masked. The human owns the merge decision.- The PR description **must follow this exact order**: (1) the **first line is ALWAYS- `Resolves <current-identifier>`** (the **current** key from Phase 0, e.g. `UXW-####` — a stale- `DEV-####` may fail to link), then (2) the root cause / fix / stress-test sections. The PR body- **must always include both stress-test runs** as links with their pass results:- ```markdown- Resolves <current-identifier>-- ## Root cause- <one paragraph>-- ## Fix- <what changed and why; note if source code was touched and the blast radius>-- ## Stress test (burn_in=50, single test via grep)- - ✅ network throttling ON: <run URL>- - ✅ network throttling OFF: <run URL>- ```- That `Resolves <ID>` reference (in the **PR description only — NEVER in a commit message- or body**, which would reopen the issue) closes the Linear issue **on merge**, via- Linear's GitHub integration. **NEVER close the Linear issue or change its status yourself**- (no status edits via the Linear MCP — only comments). Linear moves it to *In Progress* when- the PR links and to *Done* when the PR merges. Comment the outcome on the issue (link the- PR), and leave a copy-pasteable summary inline AND in `local/claude/`.-- **Exhausted (3 attempts)** — do **not** guess further. Report each hypothesis tried, the- fixes attempted, all 6 stress-run links, and where the artifacts are. Hand back for human- judgment.--- **Always — attach the run log to Linear (regardless of outcome).** As the final step on- both the fixed and exhausted paths, post the full state file- `local/claude/e2e-flake-fix/<LINEAR_ID>.md` to the Linear issue as a comment titled- **"🤖 Flake-fix run log (audit trail)"** (fence it so it renders verbatim). This is the- end-to-end audit trail — every hypothesis, fix, commit, run URL, and verdict — kept for a- human reviewer and as a learning artifact even when the fix didn't land. Skip only on the- no-Linear fallback path.- - **Lead the comment with a run-cost line** (above the fenced log):- **total wall-clock time spent** on the run and **total tokens used** — e.g.- `⏱ 2h 14m · 🪙 1.8M tokens (N attempts)`. Compute time from the first state-file- timestamp to now; report tokens for the whole session (best available figure). This makes- the cost of each automated run visible at a glance on the issue. (Posting the markdown as a comment is sufficient; a file- attachment via `mcp__linear__create_attachment_from_upload` is optional if the user wants- a downloadable file.)diff --git a/.claude/skills/e2e-test-review/SKILL.md b/.claude/skills/e2e-test-review/SKILL.mdindex 94cd84603ac..ddbad362538 100644--- a/.claude/skills/e2e-test-review/SKILL.md+++ b/.claude/skills/e2e-test-review/SKILL.md@@ -25,7 +25,7 @@ Before starting, determine which mode to use:### When to hand off instead of review-If the spec references an issue (`metabase#NNNNN`) and the user wants to **fix** flakiness or assess whether the test still reproduces the original bug, that's outside the review skill's scope. Point them at `/fix-flakey-test` (or the dedicated flake-fixing workflow), which knows to fetch the issue and the resolving PR's diff. The review skill stays focused on "is this test well-written and conformant" — it doesn't fetch external issue context by default.+If the spec references an issue (`metabase#NNNNN`) and the user wants to **fix** flakiness or assess whether the test still reproduces the original bug, that's outside the review skill's scope. Point them at the dedicated flake-fixing workflow, which knows to fetch the issue and the resolving PR's diff. The review skill stays focused on "is this test well-written and conformant" — it doesn't fetch external issue context by default.## Review checklistdiff --git a/.github/workflows/claude-e2e-flake-fix.yml b/.github/workflows/claude-e2e-flake-fix.ymldeleted file mode 100644index a6718d25019..00000000000--- a/.github/workflows/claude-e2e-flake-fix.yml+++ /dev/null@@ -1,208 +0,0 @@-name: "Claude E2E Flake Fix"--# Runs the /fix-flaky-test command headlessly to fix a flaky e2e test tracked by a Linear-# issue. Triggered manually or by automation (e.g. ci-conductor) via workflow_dispatch /-# repository_dispatch. ci-conductor only dispatches this workflow — it never runs the agent-# itself. The agent opens a green, review-ready PR; a human always reviews and merges.--on:- workflow_dispatch:- inputs:- issue:- description: "Linear issue ref for the flaky test (e.g. DEV-2181)"- required: true- type: string- repository_dispatch:- types: [e2e-flake-fix]--concurrency:- # One in-flight run per Linear issue. Belt-and-suspenders alongside the branch-existence- # dedup the command itself performs.- group: e2e-flake-fix-${{ github.event.inputs.issue || github.event.client_payload.issue }}- cancel-in-progress: false--jobs:- flake-fix:- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- # 3 attempts x 2 stress runs (burn_in=50) can run for hours. If this bumps the runner's- # job ceiling, decompose via workflow_run completion events + --resume (see DEV-2182).- timeout-minutes: 360- permissions:- contents: write- pull-requests: write- id-token: write- steps:- - name: Resolve Linear issue ref- id: ref- env:- DISPATCH_ISSUE: ${{ github.event.inputs.issue }}- PAYLOAD_ISSUE: ${{ github.event.client_payload.issue }}- run: |- if [ "${{ github.event_name }}" = "repository_dispatch" ]; then- REF="$PAYLOAD_ISSUE"- else- REF="$DISPATCH_ISSUE"- fi- if [ -z "$REF" ]; then- echo "::error::No Linear issue ref supplied"- exit 1- fi- echo "ref=$REF" >> "$GITHUB_OUTPUT"- echo "branch=automated-e2e-flake-fix-$REF" >> "$GITHUB_OUTPUT"- echo "Flake fix for Linear issue: $REF"-- # Check out metabase itself with the Metabase Automation token so the agent's- # git push / gh dispatch run as that user (a PAT, so it triggers the stress workflow).- - uses: actions/checkout@v6- with:- token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}- fetch-depth: 0-- - name: Dedup — skip if the fix branch already exists- id: dedup- env:- BRANCH: ${{ steps.ref.outputs.branch }}- run: |- if git ls-remote --exit-code --heads origin "$BRANCH" >/dev/null 2>&1; then- echo "::notice::$BRANCH already exists — a run is in flight or already landed. Skipping."- echo "exists=true" >> "$GITHUB_OUTPUT"- else- echo "exists=false" >> "$GITHUB_OUTPUT"- fi-- - name: Configure git identity (Metabase Automation)- if: steps.dedup.outputs.exists == 'false'- run: |- git config --global user.name "Metabase Automation"- git config --global user.email "[email protected]"-- # Make the Linear MCP available to the agent (it prefers MCP, falls back to the- # REST/GraphQL API with the same key when MCP is absent).- - name: Register Linear MCP server- if: steps.dedup.outputs.exists == 'false'- env:- LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}- run: |- jq -n \- --arg key "$LINEAR_API_KEY" \- '{- mcpServers: {- "linear-server": {- url: "https://mcp.linear.app/mcp",- type: "http",- headers: { Authorization: ("Bearer " + $key) }- }- }- }' > ~/.claude.json-- # Fail fast if the model API is unreachable or the key is bad / over quota.- - name: Preflight — model API reachable & authorized- if: steps.dedup.outputs.exists == 'false'- env:- ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY_E2E_FLAKE_FIX }}- LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}- run: |- code=$(curl -sS -o /dev/null -w '%{http_code}' --max-time 15 \- https://api.anthropic.com/v1/models \- -H "x-api-key: $ANTHROPIC_API_KEY" \- -H "anthropic-version: 2023-06-01") \- || { echo "::error::Anthropic API unreachable (connect/timeout) — runner egress likely blocked"; exit 1; }- echo "Anthropic /v1/models -> HTTP $code"- case "$code" in- 200) ;;- 401|403) echo "::error::Anthropic API auth failed (HTTP $code) — check ANTHROPIC_FLAKE_FIX_API_KEY"; exit 1 ;;- 429) echo "::error::Anthropic API rate limited / over quota (HTTP $code)"; exit 1 ;;- *) echo "::error::Anthropic API unexpected status $code"; exit 1 ;;- esac-- # Linear is non-fatal: surface egress/auth trouble without blocking an otherwise-fine run- # (the live path uses Bearer auth via MCP; this raw-key GraphQL probe may differ).- lcode=$(curl -sS -o /dev/null -w '%{http_code}' --max-time 15 \- -X POST https://api.linear.app/graphql \- -H "Authorization: $LINEAR_API_KEY" \- -H "Content-Type: application/json" \- --data '{"query":"{ viewer { id } }"}') \- || { echo "::warning::Linear API unreachable (connect/timeout)"; lcode=000; }- echo "Linear /graphql -> HTTP $lcode"- [ "$lcode" = "200" ] || echo "::warning::Linear API check returned HTTP $lcode — not blocking"-- - name: Run /fix-flaky-test with Claude Code- id: claude- if: steps.dedup.outputs.exists == 'false'- continue-on-error: true- uses: anthropics/claude-code-action@787c5a0ce96a9a6cfb050ea0c8f4c05f2447c251 # v1.0.133- env:- GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}- GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}- LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}- GITHUB_ACTIONS_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}- timeout-minutes: 350- with:- anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY_E2E_FLAKE_FIX }}- github_token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}- allowed_bots: linear- prompt: |- Read and follow the instructions in .claude/commands/fix-flaky-test.md to fix the- flaky e2e test tracked by Linear issue ${{ steps.ref.outputs.ref }}. Treat- "${{ steps.ref.outputs.ref }}" as the command's $ARGUMENTS.-- ## CI Environment Notes- - You are running headlessly in GitHub Actions as the "Metabase Automation" user.- git, gh, and the Linear MCP are pre-configured — no human is watching, so never- ask for approval. The branch-existence dedup gate in Phase 0 is the only go/no-go.- - The fix branch is `${{ steps.ref.outputs.branch }}`.- - Visibility: the dispatched ref may be a re-keyed `DEV-` issue — resolve it via- get_issue first, then post the per-phase heartbeat to the *resolved* issue (per the- command's Linear rules). It is the only progress signal in headless CI.- - Polling: `ScheduleWakeup` is not available here. Instead, block on the stress runs- with `gh run watch <run-id> --exit-status` (the job is long-lived by design).- - NEVER merge: do not run `gh pr merge` or enable auto-merge. Stop at a green,- review-ready PR. A human owns the merge.- - If a phase fails catastrophically, post the failure (with GITHUB_ACTIONS_RUN_URL)- to the Linear issue before exiting, per the command's audit-trail step.- claude_args: >-- --allowedTools- "Glob,- Grep,- Read,- ToolSearch,- Skill(*),- WebFetch(domain:github.com),- Edit(//./**),- Edit(/tmp/**),- Write(//./**),- Write(/tmp/**),- Bash(cat *),- Bash(cd *),- Bash(diff *),- Bash(echo *),- Bash(find *),- Bash(gh *),- Bash(git *),- Bash(grep *),- Bash(head *),- Bash(jq *),- Bash(ls *),- Bash(mkdir *),- Bash(printf *),- Bash(sed *),- Bash(sort *),- Bash(tail *),- Bash(tee *),- Bash(wc *),- Bash(which *),- mcp__linear-server__get_issue,- mcp__linear-server__list_comments,- mcp__linear-server__list_issues,- mcp__linear-server__save_comment,- mcp__linear-server__create_attachment_from_upload"- --disallowedTools "Bash(gh pr merge*),Bash(git push origin master*),Bash(rm -rf /*)"-- - name: Verify the run did not crash- if: steps.dedup.outputs.exists == 'false'- run: |- if [ "${{ steps.claude.outcome }}" = "failure" ]; then- echo "::error::Claude Code crashed or exited with an error"- exit 1- fi- echo "Flake-fix run completed (see the Linear issue for the audit trail and PR)."