Skip to content

AI-3639: let client SDKs CI runs on main finish - #2283

Merged
kanat merged 4 commits into
mainfrom
ci/ai-3639-main-runs-finish
Nov 23, 2026
Merged

kanat merged 4 commits into
mainfrom
ci/ai-3639-main-runs-finish

Conversation

@kanat

@kanat kanat commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Why

client-sdks.yml cancelled in-progress runs on every ref, main included. Since #2235 only a push to main saves the Swift package cache, and since #2225 a cancelled run saves nothing. An empty-cache swift job takes about 21 minutes, so when main gets a push faster than that, no run finishes and the cache is never saved. After #2225 merged, main runs 45229507749 (17:36 UTC) and 45232221644 (17:51 UTC) were cancelled by the next push; run 45233683223 finished and saved swiftpm-… on refs/heads/main (gh api repos/GetStream/Agents/actions/caches?key=swiftpm-). AI-3639.

How it works

cancel-in-progress is an expression, which GitHub allows (docs: "can specify cancel-in-progress as an expression", example ${{ !contains(github.ref, 'release/')}}). It is now github.event_name == 'pull_request'.

Event group cancel-in-progress Result
push to main …-push-main false the running run finishes and saves the cache; a newer push waits as pending; a still newer push replaces the pending one (docs: "any existing pending job or workflow in the same concurrency group will be canceled")
pull_request from branch X …-pull_request-X true a new push cancels the older run of the same PR, as before
pull_request from a fork's main …-pull_request-main true its own group: it never cancels or replaces a run of main's push group (the event is in the key for this)

The workflow has only push and pull_request triggers (client-sdks.yml:3-30), so no other event reaches the expression.

Validation

  • actionlint .github/workflows/client-sdks.yml: only the known xcode-27 runner-label warning.
  • Other workflows: run_tests.yml:68 saves a mypy cache only on push, and ci-go, ci-python, ci-sdks, integration, python-versions, run_tests cancel on main too. Not changed here; a cancelled mypy-cache run only costs a cold mypy cache, not 21 minutes.
  • Unverified until merge: that main runs now queue and the cache is saved. Watch the first pushes to main that touch the paths of this workflow: no run of CI (client SDKs) on main should end cancelled, and gh api repos/GetStream/Agents/actions/caches?key=swiftpm- should list an entry on refs/heads/main.

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@kanat
kanat marked this pull request as ready for review November 23, 2026 19:27

@kanat kanat left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Round 1 review. The expression is right for both triggers the workflow has (push to main and pull_request, client-sdks.yml:3-30; no workflow_dispatch, merge_group or schedule). Queue behaviour is fine: one pending run per group, a newer one replaces it, so the newest main commit always runs. actionlint shows only the known xcode-27 warning. Title and body follow the pr skill. swift and dart were still pending when I read the checks.

One finding blocks: R1.1 (group key shares main's group with a PR whose head branch is main).

Verdict: NO-GO (1 Should fix).

cancel-in-progress: true
# A run on main is never cancelled: only a finished push run saves the Swift package cache (#2235,
# #2225), and a newer push queues behind it. A pull request run still cancels the one before it.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[Should fix] R1.1 A run on main can still be cancelled: the group key is github.head_ref || github.ref_name (line 259), so a pull request whose head branch is named main (a fork's main; the repo is public) has head_ref == main and lands in the same group as the push runs on main. GitHub applies the cancel-in-progress of the run that enters the group, so that PR's run (true here) cancels the running main run and replaces its pending one, which is the starvation this PR removes and contradicts the comment above ("A run on main is never cancelled"). Same for every later push to that PR. Not new, but this PR claims to close it. Fix: put the event in the key, group: ci-client-sdks-${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}, so a push group and a pull_request group never meet. Cancellation semantics are from the docs (https://docs.github.com/en/actions/using-jobs/using-concurrency); I did not run a fork PR to show it live.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in ad0528e: the group key is now ci-client-sdks-${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}, so a fork's main PR gets …-pull_request-main, never main's …-push-main. actionlint shows only the xcode-27 warning; the PR body table is updated.

kanat and others added 2 commits November 23, 2026 20:31
A pull request from a fork's main must not share main's push group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@kanat kanat left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[reviewer R2] GO: delta round 2, head ad0528e, merged onto origin/main e416613.

PRIOR

  • R1.1 (a fork PR from branch main joined main's push group): fixed. The pre-fix key gives both the same group (mutant M1 fails); the head key gives …-push-main (cancel false), …-pull_request-X and …-pull_request-main (cancel true), as in the fixer table.

NEW FINDINGS (both Nit, not blocking; inline)

  • R2.1 (client-sdks.yml:261): "A run on main is never cancelled" overstates. A pending main run is still replaced by a newer push (GitHub docs, using-concurrency); only a running run is protected.
  • R2.2 (client-sdks.yml:260): the PR group uses the branch name, so a fork PR and a same-repo PR with the same branch name cancel each other. Pre-existing and rare; the PR-number form fixes it.

Checks: actionlint shows only the known xcode-27 warning. The new key changes main's group for one run only; nothing is cancelled by it. Mutations: 5 run, 1 survived (equivalent). Details: ~/.claude/ship-task/Vision-Agents/AI-3639/pr/reviewer-2.md. CI was read once, not waited on: run 45249844670 was still in progress.

Comment thread .github/workflows/client-sdks.yml Outdated
cancel-in-progress: true
# The event is in the key so a pull request from a fork's `main` never joins main's push group.
group: ci-client-sdks-${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}
# A run on main is never cancelled: only a finished push run saves the Swift package cache (#2235,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[R2.1] Nit: "A run on main is never cancelled" overstates. A pending main run is still replaced by a newer push (GitHub docs: "any existing pending job or workflow in the same concurrency group will be canceled"), and a run can be cancelled by hand. Fix: "A run on main that is running is not cancelled by a newer push; a newer push replaces only a pending one (#2235, #2225)."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in fe13b24: the comment now says a running run on main is not cancelled by a newer push, and a newer push replaces only a pending one. Comment text only; actionlint shows only the known xcode-27 warning.

group: ci-client-sdks-${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
# The event is in the key so a pull request from a fork's `main` never joins main's push group.
group: ci-client-sdks-${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[R2.2] Nit (pre-existing): the PR group uses github.head_ref, the branch name. A fork PR and a same-repo PR with the same branch name (e.g. feature-x) both get …-pull_request-feature-x, so one cancels the other's run. Optional fix, keyed by PR number: ${{ github.event_name }}-${{ github.event.pull_request.number || github.ref_name }} in place of the event and head_ref parts.

The comment said a run on main is never cancelled. A pending main run is
still replaced by a newer push; only a running one is protected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kanat
kanat merged commit d3ff64a into main Nov 23, 2026
10 checks passed
@kanat
kanat deleted the ci/ai-3639-main-runs-finish branch November 23, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant