Skip to content

feat: never hold a pull request's CI run behind the run it supersedes (DOTGH-7) - #13

Merged
kiliantyler merged 2 commits into
mainfrom
feat/DOTGH-7-supersede-without-waiting
Nov 24, 2026
Merged

kiliantyler merged 2 commits into
mainfrom
feat/DOTGH-7-supersede-without-waiting

Conversation

@kiliantyler

Copy link
Copy Markdown
Contributor

Ticket

DOTGH-7

Problem

CI.md rule 4 put a pull request's runs in one concurrency group with cancel-in-progress. GitHub then holds a new push's run in pending until the superseded run has fully stopped. A cancelled xcodebuild job on a hosted macOS runner takes about 5 minutes to stop, even after a force-cancel. On MaudeCode/cowtail#54 the new run waited from 20:02:10Z to 20:06:52Z.

Solution

  • Every run except a push to the default branch gets a concurrency group of its own, so no pull request run waits for another.
  • A new supersede job runs on a pull request's first attempt. It cancels that pull request's older, unfinished runs of the same workflow through the Actions API and does not wait for them to stop. It needs actions: write, is continue-on-error because a fork's token cannot cancel, and stays out of CI Gate's needs.
  • Pushes to the default branch keep one group per ref, and re-runs and manual runs stay standalone, as before.
  • CI.md rule 4 and the ci.yml template describe the new behavior.

Validation

Risk

A run of a fork's pull request can't cancel its older runs, and the job's failure is ignored. Those older runs finish instead.

Rollback

Revert. Repositories that adopted the change go back to the old block.

… (DOTGH-7)

A pull request's runs shared one concurrency group with cancel-in-progress,
so GitHub held a new push's run in pending until the run it replaced had
fully stopped. A cancelled xcodebuild job takes minutes to stop: on
MaudeCode/cowtail#54 a new run waited from 20:02 to 20:06 for one.

Every run but a push to the default branch now gets a group of its own, and
a pull request's first attempt cancels its older, unfinished runs of the
workflow from a `supersede` job through the Actions API, without waiting
for them to stop. The job needs actions: write, is continue-on-error since
a fork's token cannot cancel, and stays out of CI Gate's needs.
@kiliantyler

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T20:10:10.383933Z c3963ca Manual request
🔒 Security Review ✅ Completed 2026-11-24T20:13:39.376429Z c3963ca Manual request

Security findings

Advisory findings (1)

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c3963cae25

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CI.md Resolved
Comment thread CI.md Resolved
… a query field (DOTGH-7)

Filtering by head branch alone also cancelled the runs of another pull
request from the same branch to another base, whose merge commit differs.
The supersede query now keeps only runs whose pull_requests name this one.
A branch name with + or # changed the query when pasted into the URL, so the
query fields now go through gh api --method GET -f.
@kiliantyler
kiliantyler merged commit 6cb5d80 into main Nov 24, 2026
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: c3963cae25

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread CI.md
Comment on lines 103 to +106
group: >-
ci-${{ github.run_attempt == '1' && (github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number)
|| github.event_name == 'push' && github.ref) || format('run-{0}-{1}', github.run_id, github.run_attempt) }}
cancel-in-progress: ${{ github.event_name == 'pull_request' && github.run_attempt == '1' }}
ci-${{ github.event_name == 'push' && github.run_attempt == '1' && github.ref
|| format('run-{0}-{1}', github.run_id, github.run_attempt) }}
cancel-in-progress: false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

P2 Badge Security: Preserve cancellation for fork pull-request runs

When a consumer copies this template and permits fork PR workflows, keep fork runs in a shared per-PR concurrency group. This assigns every PR update a unique group and disables server-side cancellation, while the replacement supersede job explicitly cannot cancel with a fork's read-only token and ignores that failure. A fork author can rapidly push commits so every update starts another full set of jobs, consuming runner concurrency/minutes and delaying other protected CI. Use API cancellation only for same-repository PRs and retain cancel-in-progress for forks.

Useful? React with 👍 / 👎.

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.

1 participant