Skip to content

Desktop release: start the publish job alongside the build matrix - #8193

Merged
danielhanchen merged 1 commit into
mainfrom
desktop-publish-early
Aug 9, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
desktop-publish-early

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

publish-release now declares needs: [prepare-version] instead of needs: [prepare-version, build], so it starts with the build matrix and spends the build queueing for its runner instead of queueing only after the last leg goes green. A new "Wait for the build matrix" step restores the gate that needs: build provided.

Why

On the v0.1.526-beta release, all three legs finished at 16:33:08 and Publish desktop release then sat with runner_name=null for about two minutes short of half an hour, waiting for an ubuntu-latest slot behind 56 queued runs, to then do 17 to 40 seconds of work. The queue wait is pure latency bolted onto the end of every release.

This is the same fix, and the same reasoning, as assemble in unslothai/llama.cpp's unsloth-prebuilt.yml, which records the problem it solved:

Only resolve, so this job starts alongside the build matrix instead of after it. It used to needs: every build child, which meant it began queueing for a runner only once the last leg went green: on the reference run that queue wait was 109 minutes to then run a 10-second job. Starting early overlaps the wait with the build. The cost is one runner slot held for the length of the run.

The gate

Dropping needs: build gives away the success check, so the waiter has to be at least as strict. Publishing a partial release is much worse than publishing late. It polls this run's job list every 30s and:

  • blocks until all three legs report completed
  • exits non-zero the moment any finished leg has a conclusion other than success, rather than holding a runner to reach the same answer later
  • refuses to publish if a leg has no job record at all after 15 minutes, so a matrix that never started cannot be mistaken for one that passed
  • tolerates 10 consecutive jobs-API failures before giving up, so an API blip cannot discard a finished build
  • gives up at 75 minutes, inside the job's own 90 minute cap

timeout-minutes goes from 20 to 90 because the job now spans the build, whose legs cap at 60. actions: read is added because the job-level permissions block replaces the workflow-level one and the waiter needs to read the run's job list.

Behaviour change worth knowing

If a build leg fails, publish-release previously showed as skipped. It will now show as failed, with the failing leg named in the log. Nothing is published in either case. llama.cpp made the same trade.

Test plan

The waiter was extracted and run against a stubbed jobs API:

  • all three legs success -> exits 0, "all 3 build legs finished and succeeded"
  • one leg failure -> exits 1, names the leg
  • one leg cancelled -> exits 1, names the leg
  • legs still in_progress -> keeps polling, does not proceed
  • a leg missing from the job list -> keeps waiting, does not proceed
  • jobs API failing -> counts strikes 1/10, 2/10 and keeps retrying

Every run: block in the workflow was also shell-parsed; the only parse error is a pre-existing PowerShell step on the Windows leg, untouched here.

  • Confirm on the next release that publish starts with the matrix and that its runner wait overlaps the build

Note

Independent of #8191 and touches a different part of the file. #8191 shortens the build phase; this removes the queue wait that follows it. Either can merge first.

@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: 476400323a

ℹ️ 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".

# The three matrix legs, by their `name:` (Build <matrix.label>).
LEGS=('Build macOS (Apple Silicon)' 'Build Linux (x64)' 'Build Windows (x64)')
POLL=30
DEADLINE=$(( $(date +%s) + 75 * 60 ))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Size the wait for the entire serial matrix

When the three build legs cumulatively take more than 75 minutes, this deadline fails the publish job even though the builds are still legitimately running. The build strategy uses max-parallel: 1, and each of its three matrix jobs has a 60-minute timeout, so the matrix can take up to 180 minutes, plus runner queueing; the former needs: build gate imposed no 75-minute aggregate limit. Increase both this deadline and the publish job timeout to cover the whole serial matrix and the remaining publish steps.

Useful? React with 👍 / 👎.


while :; do
if ! JOBS="$(gh api --paginate \
"repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs?per_page=100" \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include prior job attempts when retrying publish

When publish-release alone is rerun after a transient publish or jobs-API failure, this request uses the jobs endpoint's default filter=latest, so the successful build jobs from the earlier execution are omitted and all three names remain MISSING until the 15-minute failure. GitHub documents that latest returns jobs from the most recent execution while all includes old executions in the List jobs for a workflow run endpoint. Query all attempts and select the newest record for each build leg so the normal “re-run failed jobs” recovery path can reuse the already-successful builds.

Useful? React with 👍 / 👎.

@danielhanchen

Copy link
Copy Markdown
Member Author

Validated on real CI, not just a stub. The waiter step from this branch was extracted verbatim and run in a harness that models the release job graph with stubbed builds, at danielhanchen/release-graph-test.

Success path (run 31268015946):

Job Started Finished
prepare-version 16:52:30 16:52:34
Publish desktop release 16:52:36 16:54:42
Build macOS (Apple Silicon) 16:52:36 16:54:10
Build Linux (x64) 16:52:42 16:54:16
Build Windows (x64) 16:52:42 16:54:16

Publish started on the same second as the first build leg, which is the whole point of the change. The waiter then polled and released cleanly:

16:52:38  publish job started at 16:52:38
16:52:38  3 of 3 build legs still running; polling again in 30s
16:53:09  3 of 3 build legs still running; polling again in 30s
16:53:39  3 of 3 build legs still running; polling again in 30s
16:54:10  3 of 3 build legs still running; polling again in 30s
16:54:40  all 3 build legs finished and succeeded
16:54:41  release created at 16:54:41

It proceeded 24s after the last leg finished, consistent with the 30s poll.

Failure path (run 31268196463, Linux leg made to fail):

16:58:32  2 of 3 build legs still running; polling again in 30s
16:59:03  ERROR: refusing to publish, these build jobs did not succeed: Build Linux (x64) (failure);

Publish desktop release ended failure and nothing was published, which is the gate needs: build used to provide. It named the offending leg rather than timing out.

Local stub tests also covered: a cancelled leg (exits 1, names it), legs still in progress (keeps polling), a leg missing from the job list entirely (keeps waiting, never proceeds), and a failing jobs API (counts 1/10, 2/10 and retries).

@danielhanchen
danielhanchen merged commit ae59a9c into main Aug 9, 2026
14 of 15 checks passed
@danielhanchen
danielhanchen deleted the desktop-publish-early branch August 9, 2026 03:01
danielhanchen added a commit that referenced this pull request Aug 9, 2026
…ld pre-flight one (#8240)

The desktop release workflow no longer runs a VirusTotal step inside
publish-release. #8194 moved it into its own virustotal-scan job that runs
after the release is published, and #8193 replaced publish-release's
`needs: build` with a "Wait for the build matrix" step so the job can queue
for its runner during the build.

Five tests still encoded the old shape and fail on main for every PR:

  TestWorkflowOrdering::test_scan_runs_after_the_release_is_validated
  TestWorkflowOrdering::test_release_creation_is_deferred_until_after_the_scan
  TestWorkflowOrdering::test_scan_runs_before_the_assets_are_published
  TestWorkflowOrdering::test_the_scan_script_is_checked_out_first
  test_build_matrix_hands_off_assets_without_release_credentials

Rewrite them against the current layout rather than dropping the assertions.
The scan is a post-publish sweep and is advisory by design, so what is worth
pinning is that it cannot be quietly lost:

  - virustotal-scan exists and `needs: [publish-release]`, so deleting the job
    or the dependency is red,
  - the job carries no `if:`, and no step does either except the summary, which
    is `if: always()` so the verdict survives a failed scan,
  - the sparse checkout of scripts/virustotal_scan.py is asserted by mechanism
    rather than by step name, along with the guard that exits 1 when the script
    is absent,
  - the scan step does not swallow the script's exit status: no
    continue-on-error, no `|| true`, no `exit 0`, and no `--fail-threshold`
    pinned to a value the script treats as never-fail,
  - continue-on-error appears on exactly one job and on no step of any job that
    handles a bundle,
  - the downloaded artifact pattern matches what the build matrix uploads,
  - publish-release does not re-inline the scan.

For the permissions test, the build-to-publish handoff is now gated by the
waiter, so assert that instead of `needs: build`: it covers every matrix leg by
name, refuses to publish a leg that did not succeed, and refuses to publish a
leg whose job record never appeared. Add a check that the new scan job holds no
release credentials, since it handles the bundles and uploads them off-box.

Docstrings say plainly that this is a post-publish sweep, so a future reader
does not go looking for a pre-publish gate that is not there.

Co-authored-by: danielhanchen <[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.

1 participant