Skip to content

ci: cancel a pull request's superseded runs in test.yml - #353

Merged
hogan-yuan merged 1 commit into
mainfrom
ci/cancel-superseded-pr-runs
Nov 19, 2026
Merged

hogan-yuan merged 1 commit into
mainfrom
ci/cancel-superseded-pr-runs

Conversation

@hogan-yuan

Copy link
Copy Markdown
Member

test.yml is the workflow pull requests actually run, and it is the one without a concurrency group — so every push to a PR queues another run while the one it replaced keeps its place in line.

The change

concurrency:
  group: test-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

Three workflows here already declare groups (test-update.yml, update-homebrew.yml, update-scoop.yml), so this follows their naming style — a literal prefix — rather than importing ${{ github.workflow }} from elsewhere.

github.head_ref is set only for pull_request events:

  • a pull request groups by its branch — a new commit cancels the run for the commit it replaced
  • a push to main, or a tag, falls back to github.run_id, which is unique per run, so those get a group of their own: never cancelled, never queued behind each other

That second half matters more here than it would in a PR-only workflow, because test.yml also runs on tags: ["*"], and a tag build is not something to cancel. test-update.yml's existing group: test-update-${{ github.ref }} would have that problem; this one does not.

Why only test.yml

workflow trigger why untouched
release.yml v* tags, build-test branch publishes; aborting halfway is worse than running twice
release-to-oss.yml workflow_dispatch a run is something a person asked for by hand
test-install.yml push to main / tags, path-filtered no pull_request trigger at all, so nothing to supersede

Prevention here, not a fix

Being straight about it: no backlog was observed in this repo — its CI is a single build job.

The same change landed in longbridge/openapi as longbridge/openapi#629, where it was a real problem: nine jobs across a wide platform matrix, six runs queued at once, nothing starting for about three hours, four of them for commits that were no longer any branch's HEAD. This repo has the same gap in the workflow that matters and none of the symptoms.

🤖 Generated with Claude Code

test.yml is the workflow pull requests actually run, and it is the one
without a concurrency group: every push to a PR queues another run while
the one it replaced keeps its place in line.

Three workflows here already declare groups (test-update, update-homebrew,
update-scoop), so this follows their naming style rather than importing a
different one.

`github.head_ref` is set only for pull_request events. A push to main, or a
tag, falls back to `github.run_id`, which is unique per run, so those get a
group of their own: never cancelled, and never made to queue behind each
other. That distinction matters more here than in a PR-only workflow,
because test.yml also runs on `tags: ["*"]`, and a tag build is not
something to cancel.

The other three without a group are left alone: release.yml publishes on
`v*` tags and pushes to build-test, release-to-oss.yml is
workflow_dispatch, and test-install.yml has no pull_request trigger at all,
so it has nothing to supersede.

Prevention rather than a fix for anything seen here -- this repo's CI is
one job. The same change landed in longbridge/openapi#629, where it was a
real backlog: six runs queued at once and nothing starting for about three
hours.
@hogan-yuan
hogan-yuan merged commit ac6cf86 into main Nov 19, 2026
1 check passed
@hogan-yuan
hogan-yuan deleted the ci/cancel-superseded-pr-runs branch November 19, 2026 07:26
hogan-yuan added a commit that referenced this pull request Nov 23, 2026
Minor bump: this release adds a command. The repo's precedent puts a new
command in the minor slot -- v0.31.0 for routing asset commands to the US
APIs, v0.30.0 for serving quote commands over HTTP REST.

Since v0.31.2:

- feat(trade): add risk-assessment command (#350)
- fix(tls): trust the OS certificate store in addition to the bundled roots (#351)
- fix(auth): say when a token was encrypted for a different machine (#352)
- chore: build x86_64 Linux releases with cross to keep a baseline-CPU binary (#348)
- ai: start a new conversation after signing in (#346)
- docs(valuation): explain high/low are fair-value band bounds (#354)
- ci: cancel a pull request's superseded runs in test.yml (#353)

Only Cargo.toml and the lockfile change, as in the 0.31.2 bump. The scoop
manifest is updated by update-scoop.yml after the tag is published, not
here.

The `[patch.crates-io]` pin on the SDK stays for now. longbridge 5.5.0 was
tagged and released today but is not yet on crates.io, and dropping the
patch before it lands would resolve to 5.4.0, which has no
`risk_assessment`. Moving to `longbridge = "5.5"` is the next change, and it
is what carries the SDK-side TLS fix into the quote and trade paths.
hogan-yuan added a commit that referenced this pull request Nov 23, 2026
Minor bump: this release adds a command. The repo's precedent puts a new
command in the minor slot -- v0.31.0 for routing asset commands to the US
APIs, v0.30.0 for serving quote commands over HTTP REST.

Since v0.31.2:

- feat(trade): add risk-assessment command (#350)
- fix(tls): trust the OS certificate store in addition to the bundled roots (#351)
- fix(auth): say when a token was encrypted for a different machine (#352)
- chore: build x86_64 Linux releases with cross to keep a baseline-CPU binary (#348)
- ai: start a new conversation after signing in (#346)
- docs(valuation): explain high/low are fair-value band bounds (#354)
- ci: cancel a pull request's superseded runs in test.yml (#353)

Only Cargo.toml and the lockfile change, as in the 0.31.2 bump. The scoop
manifest is updated by update-scoop.yml after the tag is published, not
here.

The `[patch.crates-io]` pin on the SDK stays for now. longbridge 5.5.0 was
tagged and released today but is not yet on crates.io, and dropping the
patch before it lands would resolve to 5.4.0, which has no
`risk_assessment`. Moving to `longbridge = "5.5"` is the next change, and it
is what carries the SDK-side TLS fix into the quote and trade paths.
hogan-yuan added a commit that referenced this pull request Nov 23, 2026
Bumps `version` to `0.32.0`. One line in `Cargo.toml` plus the lockfile;
no code changes.

## Why 0.32.0 and not 0.31.3

This release adds a command, and the repo's precedent puts a new command
in the minor slot:

| version | what earned the bump |
|---|---|
| v0.31.0 | `feat(trade): route asset commands to US APIs for US
accounts` |
| v0.30.0 | `feat(quote): serve one-shot quote commands over HTTP REST`
|

`risk-assessment` is the same kind of change.

## Contents since v0.31.2

```
75f3b68 docs(valuation): explain high/low are fair-value band bounds (#354)
4954d57 feat(trade): add risk-assessment command (#350)
753cfef fix(auth): say when a token was encrypted for a different machine (#352)
e77245e fix(tls): trust the OS certificate store in addition to the bundled roots (#351)
ac6cf86 ci: cancel a pull request's superseded runs in test.yml (#353)
bddd70b chore: Build x86_64 Linux releases with cross to keep a baseline-CPU binary (#348)
52eb7a6 ai: Start a new conversation after signing in (#346)
```

Worth calling out:

- **TLS (#351)** — fixes `longbridge auth login` failing with `invalid
peer certificate: UnknownIssuer` behind a corporate TLS-inspecting proxy
(longbridge/developers#1153). **This widens what the CLI trusts**: a
certificate authority installed on the machine can now intercept its
traffic, which is what makes such a proxy work. Reasoning in
longbridge/openapi#628.
- **Auth diagnostics (#352)** — a token that cannot be decrypted now
says it was encrypted for a different machine, with the token path and
advice selected for the platform, instead of a bare "Failed to decrypt
auth token."

## Scope: two files only

`Cargo.toml` and `Cargo.lock`, matching the 0.31.2 bump (`263d9a5`,
which touched exactly those two). `.scoop/longbridge.json` also carries
a version, but `update-scoop.yml` rewrites it after the tag is published
— it is not part of the release commit.

## The SDK pin stays, deliberately

`[patch.crates-io]` still points `longbridge` at a git rev. It has to
for now: `longbridge 5.5.0` was tagged and released today but **is not
yet on crates.io**, and dropping the patch before it lands resolves to
5.4.0, which has no `risk_assessment` — `risk-assessment` (#350) would
not build.

**The follow-up matters more than this release.** Once 5.5.0 is on
crates.io: drop the patch and move to `longbridge = "5.5"`. That is what
carries the SDK-side TLS fix into the quote and trade paths. Until then
the CLI's **own** clients are fixed — which covers the
`/oauth2/register` failure actually reported — but
`OAuthBuilder::build()`, quotes and trades still go through the SDK on
the old root set, so longbridge/developers#1153 is not yet closed for
CLI users.

## Verified

`cargo test --bin longbridge`: 981 pass. `cargo check` clean.

## After merge

Tag `v0.32.0`; `update-scoop.yml` and `update-homebrew.yml` pick it up
from there.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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