Repository navigation
Description
Problem
The ci-fix skill's "Check for existing fixes" step (Step 1) only queries open fix/ci-* PRs:
gh pr list --state open --head "fix/ci-" --json number,title,headRefNameWhen a maintainer closes a workaround PR with a rejection rationale (e.g. "we'll fix upstream", "won't fix"), the next CI failure on the same root cause re-runs ci-fix, sees no open PR, and re-derives a near-duplicate of the just-rejected workaround. The maintainer ends up closing the same fix twice.
Concrete example
In max-sixty/worktrunk:
collect affected coveragefails on every push to main (cargo-affected runner-shim … target-name fallback ambiguous).- worktrunk#2493 proposed a workaround (renaming helper-crate dummy test files); closed within ~8 hours with "we'll fix upstream".
- The next push (
90d5cfcb) hit the same failure and triggered run 25170507538. With only the open-PR check, ci-fix would have re-derived the same workaround. A repo-local override caught it; this issue is to move that check into the bundled skill so every consumer benefits.
Proposed fix
Extend Step 1 to also look up recent closed bot-authored fix/ci-* PRs and shape-match the new failure diagnostic against their body:
BOT_LOGIN=$(gh api user --jq '.login')
# Open dedup (existing):
gh pr list --state open --head "fix/ci-" --json number,title,headRefName
# Closed dedup (new) — last ~14 days, bot-authored:
gh pr list --state closed --author "$BOT_LOGIN" --search "head:fix/ci-" \
--json number,title,closedAt,body,comments,headRefName \
--jq '[.[] | select((now - (.closedAt | fromdateiso8601)) < 1209600)] | .[]'Match by failure shape (the diagnostic snippet embedded in the PR body) rather than branch name — branch names encode run IDs and never repeat. The closure comment / review usually carries the maintainer's rationale.
If a closed PR with a maintainer rejection covers the same failure, exit silently. The maintainer already saw the diagnosis; another PR is noise.
Two gotchas worth codifying
- Use the
head:fix/ci-search qualifier for the closed-state lookup, notin:head(silently ignored — falls back to default-field text matching and returns nightly/daily PRs containing "fix" or "ci").--head "fix/ci-"works for--state openbecause gh filters client-side, but the search-API path needs--search "head:fix/ci-". - Request
bodyin--json. That field carries the failure diagnostic written by the prior ci-fix run; without it there's nothing to shape-match.
Why upstream
The rejection-dedup pattern is generic across all tend consumers — the rationale ("fix upstream") happens to be repo-local, but the mechanism for not re-proposing a just-rejected fix is not.
Filed at @max-sixty's direction in worktrunk#2499.
Activity
tend-agent commentedon Apr 30, 2026
Thanks for the detailed write-up! Searched the codebase and confirmed this isn't implemented today —
ci-fix/SKILL.mdStep 1 only queries open PRs:gh pr list --state open --head "fix/ci-" --json number,title,headRefNameNo closed-PR shape-match against prior failure diagnostics. The two gh-search gotchas you flagged (
head:fix/ci-qualifier on--state closed, requestingbodyin--json) aren't documented elsewhere in the bundled skills either.I'll leave it for a maintainer to evaluate and prioritize.
skills(triage): drop exclamation marks from comment templates (#361)