Repository navigation
fix(jobs): report artifact failures only when the build itself did not fail - #13882
Merged
Merged
Conversation
…t fail A post-job artifact fails with no output to pack whenever the user's build command fails, so every failed build became a Sentry event. Failures are now held until the exit arrives and dropped when the build command exited non-zero or ran out of memory. A repository source that downloads with 401/403/404 gets a reason the user can act on instead of an internal error; an uploaded source keeps the internal error, since its URL is ours.
Contributor
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Holding failures until the exit arrived needed its own state machine. The exit of a failed build reaches the worker before the artifacts that fail for want of its output, so a deployment that is already failed is enough.
loks0n
approved these changes
Sep 24, 2026
Member
Author
|
@greptile review |
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.
What does this PR do?
#13856 made the Jobs worker throw
PermanentFailure(so it reaches Sentry) for any failed build artifact whose code isn't a known user error. On Cloud that became one noisy issue (CLOUD-3R4B, about 400 events in 36 hours). Most of those were the user's own build failing:archive→artifact_timeout"output did not appear within 10s of worker exit"archive→artifact_permission_deniedsource/cachePull→download_failed(DNS lookup andi/o timeout)source→download_http_error"download failed with status 403"1. Don't report artifacts that fail after the deployment has already failed
Post-job artifacts run whatever the exit code is. When a build fails, its exit callback marks the deployment
failed, and thenarchive/outputfail because there's no output. The worker now skips the report when the deployment was alreadyfailedbefore the callback:This also stops a second report when
outputfails straight afterarchive. The one case it misses: an artifact callback that reaches the worker before its failed build's exit is still reported. That's unlikely, becausearchivewaits 10 seconds after the build ends before it fails.2. Tell the user when their repository can't be downloaded
A repository source (
type: vcs, which covers VCS and template deployments) that downloads with 401/403/404 now shows a reason instead of "Internal server error. Please try again.", and isn't reported:An uploaded source (
manual/cli) is downloaded from Appwrite's own presigned URL, so the same status there is ours. It keeps the internal error and is still reported. For now the status is read from the message (download failed with status 403).Test Plan
Jobs::action()locally, on an in-memory database. After a failed exit, "output missing" is not reported and the deployment still fails with "Build failed with exit code N.". After a clean exit it is reported. A repository 404 or 403 shows the reasons above and isn't reported. An uploaded source's 404 keeps the internal error and is reported. Onmain, every one of these is reported, and the repository cases show the internal error.pintandphpstanare clean on the changed file.Related PRs and Issues
artifact_permission_deniedhalf of CLOUD-3R4B.Checklist