Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(ci): print agent-runnable depot retry steps (#104696)

Raúl Negrón-Otero1a9bcab66060
diff --git a/.agents/skills/debugging-ci-failures/SKILL.md b/.agents/skills/debugging-ci-failures/SKILL.md
index 95d18e75b52b..ca304ea22838 100644
--- a/.agents/skills/debugging-ci-failures/SKILL.md
+++ b/.agents/skills/debugging-ci-failures/SKILL.md
@@ -331,6 +331,9 @@ Do NOT run `hogli test` with no arguments. Do NOT run `hogli nuke` or
browser through the chrome-devtools MCP. `status.depot.dev` covers the case
where Depot itself is the outage, and the `depot-github-runners` skill owns
runner troubleshooting beyond triage.
+- A PR can route its backend tests to Depot CI. Then `Django Tests Pass` only
+ relays the Depot result, and `gh run rerun` reads the same failure again.
+ The log of its `Relay the Depot verdict` step lists the retry options.
- If a job fails before `Checkout` completes (no app code ran), classify as
`infra / runner`. Do not propose code fixes.
- PostHog CI frequently parallelizes the same test class across N shards
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.yml
index 1e9a6f34735c..94067c5f600b 100644
--- a/.depot/workflows/ci-backend.yml
+++ b/.depot/workflows/ci-backend.yml
@@ -11,7 +11,8 @@
# - The `wait-for-handoff` job waits for GitHub Actions to hand the event off and exposes
# `handed_off`, true only when GitHub Actions handed the tests to this engine. Canonical's
# `Django Tests Pass` gate then relays this workflow's gate verdict. Neither the hand-off
-# job nor the relay has a counterpart here.
+# job nor the relay has a counterpart here. A GitHub rerun does not restart this workflow,
+# so the relay's failure log prints the `depot ci` commands that retry it.
# - runs-on: depot-* labels instead of GitHub-hosted ubuntu-24.04
# - action paths: ./.depot/actions/... instead of ./.github/actions/... (pnpm-install,
# setup-sqlx-cli, setup-python-cached, setup-uv, setup-turbo, and paths-filter mirror
diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml
index 0e07162b01c7..836ad93379fa 100644
--- a/.github/workflows/ci-backend.yml
+++ b/.github/workflows/ci-backend.yml
@@ -4063,6 +4063,8 @@ jobs:
api="https://api.github.com/repos/$REPO/commits/$SHA/check-runs?app_id=$DEPOT_APP_ID&check_name="
gate_url="$api$(jq -rn --arg n "$DEPOT_GATE_CHECK" '$n | @uri')"
wait_url="$api$(jq -rn --arg n "$DEPOT_WAIT_CHECK" '$n | @uri')"
+ # shellcheck disable=SC2016 # $since and $pr are jq variables
+ latest_run='[.check_runs[] | select((.started_at // "") >= $since and any(.pull_requests[]?; .number == $pr))] | max_by(.id)'
# Reads one Depot check run into the named variable: absent, a status, or a
# conclusion. A 304 leaves it as it was.
# shellcheck disable=SC2034 # the nameref writes the caller's variable
@@ -4076,7 +4078,7 @@ jobs:
case "$code" in
200)
mv "/tmp/relay-$2.etag.new" "/tmp/relay-$2.etag"
- slot=$(jq -r --arg since "$EVENT_AT" --argjson pr "$PR_NUMBER" '[.check_runs[] | select((.started_at // "") >= $since and any(.pull_requests[]?; .number == $pr))] | max_by(.id) | if . == null then "absent" elif .status == "completed" then .conclusion else .status end' "/tmp/relay-$2")
+ slot=$(jq -r --arg since "$EVENT_AT" --argjson pr "$PR_NUMBER" "$latest_run"' | if . == null then "absent" elif .status == "completed" then .conclusion else .status end' "/tmp/relay-$2")
refusals=0
;;
304) refusals=0 ;;
@@ -4113,7 +4115,29 @@ jobs:
esac
;;
queued|in_progress|pending|waiting|requested) ;;
- *) echo "::error::Depot gate concluded $gate for $SHA"; exit 1 ;;
+ *)
+ depot_url=$(jq -r --arg since "$EVENT_AT" --argjson pr "$PR_NUMBER" "$latest_run"' | .details_url // ""' /tmp/relay-gate)
+ echo "::error::Backend tests on Depot CI concluded $gate. This step's log lists the retry options."
+ printf '%s\n' \
+ "Backend tests for $SHA ran on Depot CI, not GitHub Actions. Re-running this job alone reads the same result." \
+ "Depot run: ${depot_url:-not found}" \
+ ""
+ if [[ $depot_url =~ ^https://depot\.dev/orgs/([^/]+)/workflows/([a-z0-9]+) ]]; then
+ org=${BASH_REMATCH[1]}
+ workflow=${BASH_REMATCH[2]}
+ printf '%s\n' \
+ "Retry through the Depot CLI (needs access to the Depot org $org):" \
+ " depot ci diagnose --org $org --workflow $workflow # the failures, and the run ID on the 'Run:' line" \
+ " depot ci retry <run ID> --org $org --workflow $workflow --failed" \
+ " depot ci status <run ID> --org $org # repeat until the run finishes" \
+ " gh run rerun $GITHUB_RUN_ID --repo $REPO --failed # relays the new Depot result" \
+ ""
+ fi
+ printf '%s\n' \
+ "Retry without Depot access: a new commit starts a fresh run." \
+ " git commit --allow-empty -m 'chore: retry backend ci' && git push"
+ exit 1
+ ;;
esac
# The gate check only appears when the matrix is done, so once Depot has
# started, a slower poll costs at most a minute of latency.