Skip to content

fix(serverless): say why a deploy --wait rollout failed when a worker could not start - #232

Merged
itsNotMyUsername merged 5 commits into
mainfrom
cli-wait-preparation-reason
Dec 1, 2026
Merged

itsNotMyUsername merged 5 commits into
mainfrom
cli-wait-preparation-reason

Conversation

@itsNotMyUsername

Copy link
Copy Markdown
Contributor

What

deploy --wait now says why a rollout failed when the build was ready but a worker could not start, for example a worker that could not prepare a Shared Volume.

  • While it waits, --wait lists the app's live workers on each poll (versionId=all, state=live, pages of 100). It prints a line when a worker turns unhealthy or waits for disk (volume-disk-short):
    Application my-app: worker 2ab2c491-… is unhealthy: fetch-failed
  • A rollout that fails after a ready build names that worker and its reason instead of pointing at the builds:
    application my-app failed: worker 2ab2c491-… is unhealthy: fetch-failed; inspect workers with 'runware serverless apps workers my-app --version all'
  • A wait that times out adds last seen: worker … is pulling: volume-disk-short.
  • Of several workers in trouble, the newest is named. A worker that recovers is forgotten, so a later failure does not blame it.

Why

The builds of such a rollout hold no error. By the time the app reads failed, the API has stopped the worker, and its reason has become the stop (stop-requested). So the reason has to be read during the wait.

Not changed

  • apps resume and apps versions activate keep their messages; they pass no worker cause to appFailedErr.
  • An update of an app that is already active waits on the version pin instead (waitForSubmittedVersion). A failed rollout there leaves the app active on its previous version, and that path still reports no worker reason, as before.

Tests

  • deploy_workers_test.go:
    • a create whose rollout fails on fetch-failed: the error and a single stderr line name the worker;
    • a timeout while a worker is pulling/volume-disk-short;
    • a volume-preparing worker is not treated as trouble, and the builds hint stays;
    • observe picks the newest worker in trouble, forgets a recovered one, and keeps the cause once the list is empty.
  • The failure and timeout tests fail without the change.
  • make test and make lint pass locally.

itsNotMyUsername and others added 2 commits December 1, 2026 12:15
… could not start

A rollout can fail after a ready build, for example when a worker cannot
prepare a Shared Volume. The builds then hold no error, and by the time the
app reads failed the API has stopped the worker and replaced its reason, so
--wait printed only a hint to inspect the builds, or a bare timeout.

--wait now reads the app's live workers on each poll, prints a line when a
worker turns unhealthy or waits for disk, and names the last such worker and
its reason when the app fails or the wait times out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… recovered

Of several workers in trouble the deploy wait now names the newest, which
during an update is one of the version rolling out, and it forgets the trouble
once live workers are listed and none is in trouble, so a worker that
recovered is not blamed for a later failure. An empty list keeps it: that is
the worker the API stopped. The list reads pages of 100.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 11:21
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. To trigger a review, include coderabbit-review in the PR description. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: df0c9d63-57f7-41fe-813f-1138686de5fb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Deployment failure reporting can surface obsolete build errors, discard captured worker failure causes during teardown, and miss troubled workers beyond the first page.

3 open issues
What changed in this PR

Improves serverless deploy --wait diagnostics by capturing worker startup problems while a rollout is in progress, before teardown replaces their failure reasons.

Changes:

  • Polls live workers and prints newly observed unhealthy or disk-short conditions.
  • Includes captured worker details in rollout failure and timeout errors.
  • Adds watcher and deployment tests while preserving resume and version-activation messages.
File Description
internal/​cmd/​serverless/​deploy.go Integrates worker observation and failure diagnostics into deployment waits.
internal/​cmd/​serverless/​deploy_workers.go Adds worker trouble tracking and diagnostic formatting.
internal/​cmd/​serverless/​deploy_workers_test.go Tests worker selection, recovery, failures, and timeouts.
internal/​cmd/​serverless/​deploy_test.go Updates tests for the worker-cause argument.
internal/​cmd/​serverless/​apps_versions.go Passes no worker cause to preserve activation messages.
internal/​cmd/​serverless/​apps_lifecycle.go Passes no worker cause to preserve lifecycle messages.

Review effort: Balanced

Comment thread internal/cmd/serverless/deploy.go Resolved
emmmile
emmmile previously approved these changes Dec 1, 2026

@emmmile emmmile left a comment

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.

Reviewed by Emilio's agent (Claude Opus 5.5).

… cause while the worker stops

The deploy wait now names an unhealthy worker before one still waiting for
disk, which the rollout keeps waiting on, and the newest only among equals.
It forgets a cause only when that same worker is seen serving again: a worker
the API is stopping after the rollout failed reads stop-requested, and that
poll erased the reason the failed-app error should name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
emmmile
emmmile previously approved these changes Dec 1, 2026

@emmmile emmmile left a comment

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.

Reviewed by Emilio's agent (Claude Opus 5.5).

The watch read only the first 100 workers, so a worker in trouble behind a
page of healthy ones was never seen. It now follows the cursor with the same
filters, up to 10 pages a poll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@emmmile emmmile left a comment

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.

Reviewed by Emilio's agent (Claude Opus 5.5).

@itsNotMyUsername
itsNotMyUsername merged commit 3396ca9 into main Dec 1, 2026
5 checks passed
@itsNotMyUsername
itsNotMyUsername deleted the cli-wait-preparation-reason branch December 1, 2026 12:08
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