Skip to content

manager: fix two bugs in custom runtime selection#5922

Merged
gz merged 1 commit intomainfrom
runtime-fix
Mar 26, 2026
Merged

manager: fix two bugs in custom runtime selection#5922
gz merged 1 commit intomainfrom
runtime-fix

Conversation

@gz
Copy link
Copy Markdown
Contributor

@gz gz commented Mar 26, 2026

Bug #1:
If the tag doesnt exist in the checkout, we didnt try to to fetch it.

This meant that when specifying a version tag vX.Y.Z would only work if the requested tag was created before the first time we use a custom runtime. This probably doesnt happen all that often but one can run easily into it during local development.

Bug #2:
We added a sanity check that makes sure a pipeline is really running the requested SHA. This works by embedding the SHA in the binary at build time and then matching it with the requested sha that gets forward at runtime by the pipeline manager. If there is a mismatch we know that there is an issue with the runtime version selection and abort. In this case we also aborted when a version tag was specified instead of the SHA because the manager was forwarding the tag which got matched with the SHA of the corresponding tag (and of course this didn't match).
The fix is to resolve the tag to a SHA before forwarding it to the pipeline.

Describe Manual Test Plan

Tested manually, this feature is behind an experimental flag.

Bug #1:

If the tag doesnt exist in the checkout, we didnt try to to fetch it.

This meant that when specifying a version tag `vX.Y.Z` would only work
if the requested tag was created before the first time we use a custom
runtime. This probably doesnt happen all that often but one can running
into it in local development.

Bug #2:
We added a sanity check that makes sure a pipeline is really running
the requested SHA. This works by embedding the SHA in the binary
at build time and then matching it with the requested sha that gets
forward at runtime by the pipeline manager. If there is a mismatch
we know that there is an issue with the runtime version selection
and abort. In this case we also aborted when a version tag was
specified instead of the SHA because the manager was forwarding
the tag which got matched with the SHA of the corresponding tag
(and of course this didn't match).
The fix is to resolve the tag to a SHA before forwarding it
to the pipeline.

Signed-off-by: Gerd Zellweger <mail@gerdzellweger.com>
@@ -1051,6 +1051,7 @@ async fn checkout_runtime_version(
"protocol.version=2",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit: commit subject says "fix bug" (singular) but the body describes two fixes. "fix two bugs" (matching the PR title) would be more accurate.

@gz gz requested a review from mihaibudiu March 26, 2026 16:14

/// We need to pass the actual revision SHA to the binary for verification,
/// so in case we have a version tag, we need to convert it to the sha.
pub async fn resolve_runtime_sha(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

no tests?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we test the feature already in CI every time we run something in the merge queue.. but we don't usually set tag names, just runtime SHAs so this bug fell through. It's not obvious how to test this part easily because it's not obvious a version tag in a test is compatible with the current runtime. This feature is also behind a feature flag.

@gz gz added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 886ab77 Mar 26, 2026
1 check passed
@gz gz deleted the runtime-fix branch March 26, 2026 18:15
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.

3 participants