Return 502 Bad Gateway when OCI skill pull fails#4956
Merged
Conversation
getContentFromOCI previously mapped registry.Pull failures to 400 Bad Request, but auth errors, unreachable registries, missing manifests, and network timeouts are upstream failures the caller cannot fix by changing their input. Align with getContentFromGit, which already returns 502 Bad Gateway for git resolve failures, so clients see consistent semantics across both backends.
installFromOCI previously mapped registry.Pull failures to 400 Bad Request, which incorrectly blamed the caller for upstream registry problems (auth, network, manifest unknown). Return 502 Bad Gateway to match the behaviour just applied to GetContent and the existing git install path.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4956 +/- ##
==========================================
- Coverage 69.49% 69.48% -0.01%
==========================================
Files 551 551
Lines 55817 55817
==========================================
- Hits 38788 38786 -2
- Misses 14041 14043 +2
Partials 2988 2988 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
JAORMX
approved these changes
Apr 21, 2026
Contributor
|
One small follow-up on the swagger side (non-blocking, feel free to punt to a separate PR):
|
3 tasks
samuv
added a commit
that referenced
this pull request
Apr 21, 2026
) Follow-up to #4956: installFromOCI now returns 502 on upstream pull failures (matching installFromGit), but the @failure list on the installSkill swagger annotation still only advertised 400/409/500. Add @failure 502 {string} string "Bad Gateway" and regenerate the spec so clients see the real contract for POST /api/v1beta/skills.
yrobla
pushed a commit
that referenced
this pull request
Apr 21, 2026
* Return 502 Bad Gateway when OCI content pull fails getContentFromOCI previously mapped registry.Pull failures to 400 Bad Request, but auth errors, unreachable registries, missing manifests, and network timeouts are upstream failures the caller cannot fix by changing their input. Align with getContentFromGit, which already returns 502 Bad Gateway for git resolve failures, so clients see consistent semantics across both backends. * Return 502 Bad Gateway when OCI install pull fails installFromOCI previously mapped registry.Pull failures to 400 Bad Request, which incorrectly blamed the caller for upstream registry problems (auth, network, manifest unknown). Return 502 Bad Gateway to match the behaviour just applied to GetContent and the existing git install path.
This was referenced Apr 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
registry.Pullfailures ingetContentFromOCIandinstallFromOCIwere mapped to400 Bad Request, but auth errors, unreachable registries, missing manifests, and network timeouts are upstream failures the caller cannot fix by changing their input.502 Bad Gatewayinstead, matching the git-resolve path ingetContentFromGitwhich already uses502for the equivalent upstream failure.400— those are genuine caller errors.Type of change
Test plan
go test ./pkg/skills/skillsvc/...)502where appropriate;400assertions for parse / missing-registry / invalid-reference cases left intactChanges
pkg/skills/skillsvc/content.gogetContentFromOCI:StatusBadRequest→StatusBadGatewayonregistry.Pullfailurepkg/skills/skillsvc/install_oci.goinstallFromOCI:StatusBadRequest→StatusBadGatewayonregistry.Pullfailurepkg/skills/skillsvc/content_test.gopull failure propagates as 400→...as 502; assertStatusBadGatewaypkg/skills/skillsvc/install_oci_test.gowantCodetoStatusBadGatewayin four pull-failure fall-back tests (explicit tag, qualified name, digest ref, multi-segment ref)Does this introduce a user-facing change?
Yes — API clients that previously received
400 Bad Requeston a remote OCI pull failure now receive502 Bad Gateway. This is a more accurate signal that the failure originated upstream (registry/network) rather than from a malformed request, and matches the behaviour already in place for git pulls (and already documented in the swagger annotation introduced in #4810).