Skip to content

fix(ci): read the runner image instead of interpolating an empty string - #601

Merged
EtienneLescot merged 1 commit into
mainfrom
claude/fix-whisper-cache-key
Sep 4, 2026
Merged

fix(ci): read the runner image instead of interpolating an empty string#601
EtienneLescot merged 1 commit into
mainfrom
claude/fix-whisper-cache-key

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Closes #596.

build-whisper-stt.yml keys its build cache on the runner image so a Xcode/SDK roll busts it, and carries a comment explaining precisely why that matters. The mechanism has never once worked. ${{ env.ImageOS }} and ${{ env.ImageVersion }} both expand to the empty string: the env expression context holds only what a workflow, job or step env: block put there, while the runner sets these two into its own process environment, visible to run: steps and to nothing else.

The repository's own cache list is the evidence — three consecutive hyphens where the image belongs:

whisper-stt-build-darwin-arm64---2ca5d2c75aac59ca…
whisper-stt-build-darwin-x64---2ca5d2c75aac59ca…
whisper-stt-build-linux-x64---2ca5d2c75aac59ca…
whisper-stt-build-win32-x64---2ca5d2c75aac59ca…

So the cache has been keyed on matrix.tag + the CMakeLists hash alone, and the failure the comment predicts — a restored tree full of dead absolute SDK paths, No rule to make target …libz.tbd — has been unguarded the whole time. Nothing broke yet because no roll happened to land badly; that is luck, not design.

The fix

A shell step reads the values, and both key: and restore-keys: use its output — the same shape #595 uses.

shell: bash is load-bearing, not decorative. The issue's suggested snippet would have broken on this workflow: the matrix includes windows-latest, where the default shell is PowerShell and ${VAR:-default} is not syntax. GitHub ships bash on the Windows image, so pinning the shell is what makes one step work across all four legs.

Second fix, same file

on.push had paths: and no branches:, so a tag push matched it. This is not hypothetical — it is in the run list:

2026-09-04T15:04:42Z  push  v0.0.0-onnxruntime-1.27.1  success

Publishing that ONNX artifact started a four-platform whisper build for a tag touching none of these files. Fixed with branches: ['**'], which excludes tags while keeping every branch — deliberately not branches: [main] as in the ONNX workflow, because contributors push branches here specifically to get binaries built, and narrowing that would be a behaviour change nobody asked for.

Verification

Pushing this branch triggers the workflow, which is the point: the proof is what lands in the cache list afterwards. The keys must carry a real image and must not contain ---. I will post the actual keys before asking anyone to merge — an assertion that cannot fail is worth nothing here, and this is a fix whose entire failure mode was looking correct while doing nothing.

What a reviewer should contest

  1. This invalidates every existing whisper cache — the first run on each platform after merge rebuilds from scratch. That is the intended consequence (the old keys are wrong), but it is a real one-off cost across four legs.
  2. branches: ['**'] is the permissive choice. If the preference is that this workflow only build from main and PRs, say so; it is a one-line change and a product-of-workflow call rather than a technical one.
  3. The :-unknown fallbacks would silently degrade on a self-hosted runner that sets neither variable — the key would read unknown-unknown and stop busting on toolchain rolls again. Every runner here is GitHub-hosted, so it does not bite today; failing loudly instead is defensible if you would rather.

Summary by CodeRabbit

  • Chores
    • Updated automated build triggers to avoid unnecessary multi-platform builds when publishing tags.
    • Improved build caching by correctly accounting for the runner’s operating system and image version.
    • Added clearer build-environment detection, helping builds use the appropriate cached artifacts and run more reliably.

`${{ env.ImageOS }}` and `${{ env.ImageVersion }}` have expanded to nothing
since the line was written. The `env` expression context holds only what a
workflow, job or step `env:` block put there; the runner sets these two into
its own process environment, where `run:` steps see them and `${{ env.… }}`
does not. The repository's own cache list shows the result — three consecutive
hyphens where the image should be:

    whisper-stt-build-darwin-arm64---2ca5d2c75aac59ca…

So the cache was keyed on the tag and the CMakeLists hash alone, and the exact
failure the comment above it predicts — a restored tree with dead absolute SDK
paths, "No rule to make target …libz.tbd" — was never actually guarded against.
A shell step reads the values and both the key and the restore-keys prefix use
its output. `shell: bash` is not decorative: this matrix includes
windows-latest, whose default shell has no `${VAR:-default}`.

Second, unrelated to the key but proven by the same cache list's neighbours:
`on.push` had `paths:` and no `branches:`, so a tag push matched. Publishing
`v0.0.0-onnxruntime-1.27.1` started a four-platform whisper build for a tag
that touches none of these files. `branches: ['**']` excludes tags while
keeping every branch, which is how this workflow is used.

Closes #596
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 1253c273-dec5-4c78-b318-481d5b220335

📥 Commits

Reviewing files that changed from the base of the PR and between 818bfaa and f360e01.

📒 Files selected for processing (1)
  • .github/workflows/build-whisper-stt.yml

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The workflow now limits push-triggered builds to branches. It reads ImageOS and ImageVersion from the runner environment and uses the resulting tag in the whisper.cpp build cache key and restore prefix.

Changes

Whisper STT workflow cache correction

Layer / File(s) Summary
Workflow trigger and runner-image cache scoping
.github/workflows/build-whisper-stt.yml
The push trigger explicitly matches branches. A step reads the runner image values and provides them to the whisper.cpp cache key and restore prefix.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to f360e

The workflow now avoids tag-triggered builds and scopes whisper.cpp caches to the runner image, preventing stale build-tree reuse after SDK or Xcode changes. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The cache changes are in scope for issue #596. However, adding branches: ['**'] changes tag-trigger behavior and is not required by the linked issue. Remove the branches trigger change, or link an issue and state an explicit requirement for preventing tag pushes from starting the workflow.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: reading the runner image instead of interpolating empty environment values.
Description check ✅ Passed The description provides a detailed summary, links issue #596, explains the implementation, and describes verification. It does not follow every template heading or checklist, but it includes the crit…
Linked Issues check ✅ Passed The cache fix satisfies issue #596. It reads ImageOS and ImageVersion in a Bash step and uses the output in both the cache key and restore-keys prefix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fix-whisper-cache-key

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@EtienneLescot

Copy link
Copy Markdown
Collaborator Author

Verified on a real run, not argued. Pushing the branch triggered run 33894430230 — four legs, all green, 8 minutes — and these are the keys it actually wrote:

whisper-stt-build-darwin-arm64-macos26-20260728.0273.1-2ca5d2c7…
whisper-stt-build-darwin-x64-macos15-20260824.0482.1-2ca5d2c7…
whisper-stt-build-linux-x64-ubuntu22-20260831.284.1-2ca5d2c7…
whisper-stt-build-win32-x64-win25-vs2026-20260824.214.3-2ca5d2c7…

Against the --- the same list held before. The check was written to fail rather than to pass: it asserts a key exists for each platform, that none contains ---, and that the image segment is neither empty nor unknown-unknown. Any of those failing would have meant the fix does nothing, which is precisely the way the original line failed.

Two things the keys settle beyond the fix itself:

  • shell: bash was necessary. win32-x64 carries win25-vs2026-20260824.214.3, so the step ran on the Windows leg. Without pinning the shell it would have run under PowerShell, where ${VAR:-default} is not syntax — the suggested snippet in the issue would have failed there.
  • The two macOS legs are on different imagesmacos26 for arm64, macos15 for x64. That divergence is exactly what the key was written to capture and has never once captured; the two legs have been sharing a key that distinguished neither.

@EtienneLescot
EtienneLescot merged commit 92d05a8 into main Sep 4, 2026
22 checks passed
@EtienneLescot
EtienneLescot deleted the claude/fix-whisper-cache-key branch September 4, 2026 17:06
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.

build-whisper-stt.yml's cache key silently loses the runner image, so it never busts on a toolchain roll

1 participant