feat(workers push): make build wait opt-in with --wait flag - #6371
feat(workers push): make build wait opt-in with --wait flag#6371johnstonmatt wants to merge 1 commit into
--wait flag#6371Conversation
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@6010d9fcd17a55753d419f28aa030bc0c60759baPreview package for commit |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fdff3a52a1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
fecde22 to
d4e37d5
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a6e00c91e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
6a6e00c to
8026a04
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5072b3ec0d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| | `--output-format json` | one structured result carrying `worker_name`, `project_ref`, `kept_*` | as above | | ||
| | `--output-format stream-json` | the same result as a single terminal event | as above | | ||
| | `-o json` / `yaml` / `toml` | the same payload in that encoding, and nothing else | as above | |
There was a problem hiding this comment.
Limit the delete trailer documentation to text mode
For --output-format json, stream-json, and -o json|yaml|toml, the handler returns immediately after emitting the payload, before reaching emitSuccessTrailer; therefore these rows' “as above” wording incorrectly promises the newly documented redeploy hint on stderr. Qualify the hint as text-only so this compatibility checklist matches the actual output branches.
AGENTS.md reference: apps/cli/AGENTS.md:L359-L366
Useful? React with 👍 / 👎.
| | `--output-format json` | one structured result carrying every reported field | as above | | ||
| | `--output-format stream-json` | the same result as a single terminal event | as above | | ||
| | `-o json` / `yaml` / `toml` | the same payload in that encoding, and nothing else | as above | |
There was a problem hiding this comment.
Limit the status trailer documentation to text mode
In the JSON, stream-JSON, and legacy machine-format branches, legacyWorkersStatus returns before the failed-build emitSuccessTrailer call, so “as above” falsely documents a build-retry hint that those modes never emit. Mark the retry hint as text-only rather than including it in every machine-mode stderr contract.
AGENTS.md reference: apps/cli/AGENTS.md:L359-L366
Useful? React with 👍 / 👎.
| // On the success trailer rather than inline, the way `bootstrap` emits its | ||
| // "start your app" line: the shell prints trailers once at the end of the | ||
| // run, so the next step is the last thing on screen. | ||
| yield* emitSuccessTrailer(`Deploy it with ${legacyAqua(`supabase workers push ${name}`)}.\n`); |
There was a problem hiding this comment.
Record the workers-new output-channel change
For a successful text-mode workers new, this changes the deploy hint from inline stdout to a deferred stderr success trailer, but workers/new/SIDE_EFFECTS.md was not updated and still contains no output-format contract describing the new channel. Since stdout/stderr behavior is an established compatibility surface and these checklists drive E2E coverage, document this intentional change in the same commit.
AGENTS.md reference: apps/cli/AGENTS.md:L267-L279
Useful? React with 👍 / 👎.
`supabase workers push` blocked on the server-side container build on every invocation. That build routinely runs for minutes, so the common case — a deploy that builds fine — was the slowest thing in the loop. The command now returns once the platform accepts the deploy, which is the last thing it can learn without waiting: the deploy response arrives only after the spec and the uploaded context are accepted, and it carries the accepted spec back. `--wait` opts into the build's verdict, for CI and for anyone who needs the image version before continuing. A deploy answered with a spec already in `failed` is still reported as a failure whether or not the build was waited on, rather than exiting zero on a worker that will never come up. Without `--wait` the details block leads with a `State` row — the one row that says the worker is not serving yet — and drops `Image`, since no image exists until the build produces one. A success trailer then names both `workers status` and `--wait` as ways to follow the build. The flag closes with `Flag.withDefault(false)`; the guard added in the previous commit is what keeps a boolean flag from shipping required again.
5072b3e to
6010d9f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6010d9fcd1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const settled = input.wait | ||
| ? yield* awaitWorkerBuild(api, projectRef, name, { |
There was a problem hiding this comment.
Honor terminal deploy responses before polling
When --wait is set and the deploy POST already returns build_state: active or failed—both are permitted by V2DeployAWorkerOutput—this branch discards that terminal verdict and performs a GET anyway. If that read is temporarily unavailable, still returns the documented post-deploy 404 race, or observes a concurrent deployment, the command can time out, fail, or even succeed contrary to its own deploy response. Only poll when accepted.buildState === "building"; otherwise use accepted directly.
Useful? React with 👍 / 👎.
| yield* emitSuccessTrailer( | ||
| `\nYour build was submitted successfully.\n` + | ||
| `Run ${legacyAqua(`supabase workers status ${name}${input.refSuffix}`)} to check on it.\n` + | ||
| `Add ${legacyAqua("--wait")} to block on the build next time.\n`, |
There was a problem hiding this comment.
Preserve accepted-build hints when a later worker fails
In a text-mode multi-worker push without --wait, an accepted worker queues its status command here, but if any later worker fails the real runCli path exits nonzero and never drains SuccessTrailer (shared/cli/run.ts only calls takeAll for exit code 0). The first remote build is still running, yet its only follow-up guidance is silently discarded; the handler-level tests do not expose this because their missing SuccessTrailer service makes emitSuccessTrailer write immediately. Surface these already-submitted build hints on partial failure rather than retaining them only for an entirely successful batch.
Useful? React with 👍 / 👎.
Summary
supabase workers pushblocked on the server-side container build on every invocation. That build routinely runs for minutes, so the common case — a deploy that builds fine — was the slowest thing in the loop.The command now returns once the platform accepts the deploy, which is the last thing it can learn without waiting: the deploy response arrives only after the spec and the uploaded context are accepted, and it carries the accepted spec back.
--waitopts into the build's verdict, for CI and for anyone who needs the image version before continuing.failedis reported as a failure whether or not the build was waited on, rather than exiting zero on a worker that will never come up.--waitthe details block leads with aStaterow — the one row that says the worker is not serving yet — and dropsImage, since no image exists until the build produces one.workers statusand--waitas ways to follow the build. Text output only; machine callers readbuild_statefrom the payload.Stack
Stack 7, on top of the workers output polish (#6389). The output and styling work was split out so it can ship on its own — this PR is now only the flag and the behaviour change behind it, and can be rejected independently.
Linked issue
FUNC-848 (Linear). Supabase maintainer, exempt from the
open-for-contributionflow.Checklist