Skip to content

fix: jitter outage-issue dedup to handle concurrent matrix-leg failures - #586

Merged
max-sixty merged 1 commit into
mainfrom
fix/issue-580
May 23, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/issue-580

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Implements option (1) from #580 — a jittered backoff before the dedup check in the Report failure step.

When a matrix workflow's legs fail at near-identical times (e.g. an Anthropic 529 burst exhausting the retry budget across every leg within ~5 seconds), all legs read $EXISTING as empty in parallel and each file their own tend-outage issue. Adding sleep $((RANDOM % 30)) before gh issue list staggers the legs so later ones see the first leg's issue.

This is the cheap practical fix called out in the issue — it doesn't eliminate the race in pathological cases, but it covers the observed real-world failure mode. Applied to both action.yaml (Claude harness) and codex/action.yaml (Codex harness).

Closes #580.

Adds `sleep $((RANDOM % 30))` before the `gh issue list` check in the
`Report failure` step of both action.yaml and codex/action.yaml. The
randomized backoff staggers concurrent matrix-leg failures so legs that
fail within seconds of each other (e.g. Anthropic 529s exhausting the
retry budget across every leg) don't all read $EXISTING as empty in
parallel and file duplicate `tend-outage` issues.

Refs #580.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@max-sixty
max-sixty merged commit d485b95 into main May 23, 2026
4 checks passed
@max-sixty
max-sixty deleted the fix/issue-580 branch May 23, 2026 17:36
@max-sixty max-sixty mentioned this pull request May 23, 2026
2 of 3 tasks
max-sixty added a commit that referenced this pull request May 23, 2026
## Summary

- Bumps generator version to 0.1.0 and syncs lockfile.

7 commits since 0.0.25:
- fix: jitter outage-issue dedup to handle concurrent matrix-leg
failures (#586)
- fix: install-test default-branch probe on shallow checkout (#583)
- fix: pin install-tend badge link to max-sixty/tend (#585)
- skills(review-reviewers): call out commenter-self-edit filters as a
non-issue (#581)
- triage: skip on tend-outage labeled issues (#579)
- fix: use REST API for author_association in triage skill (#571)
- skills(running-in-ci): catch already-merged sibling PRs in dedup
(#569)

## Test plan
- [x] `wt test` passes
- [x] `pre-commit run --all-files` passes
- [ ] CI green
max-sixty pushed a commit that referenced this pull request Jul 10, 2026
…leg failures (#744)

## Problem

The outage-tracker dedup in `shared/steps/report-failure.sh` is racy,
and the jitter added in #586 to fix it has now been proven insufficient
in production.

When several matrix legs fail within a few seconds of each other (the
common case for an upstream model-API 5xx/overload incident, which hits
every leg at once), each leg runs the check-then-create dedup. The
`sleep $((RANDOM % 30))` jitter only *narrows* the create-create window
— it can't close it. Two legs can still both read `EXISTING` as empty:
jitter collisions are likely with several legs drawing from a 30-slot
range (birthday problem), and GitHub's issue-list index takes a few
seconds to reflect a freshly-created issue, so even a staggered second
leg can miss the first's issue.

## Evidence

- **2026-05-22**: four duplicate `tend-outage` issues (#575, #576, #577,
#578) created within 4 seconds. This prompted #586 (jitter).
- **2026-06-29**: the jitter mitigation failed — an all-five-legs
`review-reviewers` failure ([run
28352782724](https://github.com/max-sixty/tend/actions/runs/28352782724),
transient `529 Overloaded`/StopFailure) produced **two** duplicate
trackers #742 and #743, created within 1 second (06:23:30 and 06:23:31),
both referencing the same run.

Every prior incident with only 1–2 failing legs produced a single
tracker, so the failure mode scales with the number of
simultaneously-failing legs. Impact is low (both dupes were auto-closed
by nightly ~2h later when the outage resolved), but it's a recurring
structural failure of a deployed fix, and it generates duplicate "Bot
temporarily unavailable" notifications during every wide outage.

## Fix

Keep the jitter (it still reduces contention and the number of dupes
created) and add a self-healing reconciliation to the create path: after
`gh issue create`, settle briefly for the list index, then list every
open `tend-outage` issue, keep the lowest-numbered, and close the rest
as duplicates. It is idempotent and convergent — every racing leg
computes the same keeper, so a second leg closing an already-closed dup
is a no-op.

This is shared verbatim by all three harness actions, so it reaches
every consumer at the next release.

<details><summary>Verification</summary>

- `shellcheck shared/steps/report-failure.sh` passes.
- Logic unit-tested against today's numbers: `[{742},{743}]` → keep
#742, close #743; single-issue input closes nothing.
- Index-lag safety: the 5s settle plus the convergent keep-lowest rule
means even if leg B's first re-list misses leg A's issue, both legs
eventually compute the same keeper and the loser is closed.

</details>

Found by `review-runs` analyzing [run
28361647677](https://github.com/max-sixty/tend/actions/runs/28361647677).

Co-authored-by: tend-agent <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
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.

action.yaml outage-issue dedup races on concurrent matrix-leg failures

2 participants