Skip to content

Default to :latest tag for OCI skill install references#4430

Merged
JAORMX merged 1 commit intomainfrom
worktree-fix+skill-install-error-message
Mar 30, 2026
Merged

Default to :latest tag for OCI skill install references#4430
JAORMX merged 1 commit intomainfrom
worktree-fix+skill-install-error-message

Conversation

@JAORMX
Copy link
Copy Markdown
Collaborator

@JAORMX JAORMX commented Mar 30, 2026

Summary

  • Running thv skill install ghcr.io/org/skill (without a tag) produced a confusing Error: failed to install skill: Bad Gateway because the raw user input was passed to oras-go which requires an explicit tag or digest, while go-containerregistry had already defaulted to latest internally but that parsed reference was ignored.
  • Build the qualified OCI reference from the parsed nameref.Reference, appending :latest only when the user omitted a tag. Explicit tags and digests pass through unchanged.
  • Change the OCI pull error status from 502 (Bad Gateway) to 400 (Bad Request) since a pull failure due to a bad reference is a client input error, not an upstream gateway failure.

Type of change

  • Bug fix

Test plan

  • Unit tests (task test)
  • Linting (task lint-fix)

Does this introduce a user-facing change?

thv skill install ghcr.io/org/skill now defaults to the :latest tag instead of failing with "Bad Gateway". When OCI pull errors do occur, the error message is now surfaced to the user instead of being hidden behind a generic status text.

Generated with Claude Code

When a user runs `thv skill install ghcr.io/org/skill` without a tag,
go-containerregistry defaults to "latest" internally but String() omits
it. The raw user input was passed to oras-go's registry.Pull which
requires an explicit tag, causing a confusing "Bad Gateway" error.

Build the qualified OCI reference from the parsed nameref.Reference,
appending `:latest` only when the user omitted a tag. Also change the
pull error status from 502 to 400 since a bad reference is a client
input error, not an upstream gateway failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added the size/XS Extra small PR: < 100 lines changed label Mar 30, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.54%. Comparing base (feef6ed) to head (d0e1e7d).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4430      +/-   ##
==========================================
+ Coverage   69.50%   69.54%   +0.03%     
==========================================
  Files         486      486              
  Lines       50017    50024       +7     
==========================================
+ Hits        34766    34790      +24     
+ Misses      12570    12549      -21     
- Partials     2681     2685       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@aponcedeleonch aponcedeleonch left a comment

Choose a reason for hiding this comment

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

LGTM! One minor note: according to the go-containerregistry docs, ref.String() already returns the fully-qualified reference (including the default :latest tag when none is specified), so qualifiedOCIRef could potentially be replaced by just using ref.String() from the already-parsed reference. That said, the strings.Contains(s, ":") check could be a false positive for references with a registry port (e.g. registry.example.com:5000/my-skill). If you've tested that case and it works correctly, all good!

@JAORMX
Copy link
Copy Markdown
Collaborator Author

JAORMX commented Mar 30, 2026

I actually tried using the String method and it seems the docs were off. They did kot contain the tag.

@JAORMX JAORMX merged commit 4a0da43 into main Mar 30, 2026
42 of 43 checks passed
@JAORMX JAORMX deleted the worktree-fix+skill-install-error-message branch March 30, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants