Skip to content

ci: bound the upgrade smoke's npm and HTTP steps so a stalled registry fails it, not the job - #3582

Merged
fforootd merged 2 commits into
mainfrom
ci/bound-smoke-upgrade-npm-steps
Dec 2, 2026
Merged

fforootd merged 2 commits into
mainfrom
ci/bound-smoke-upgrade-npm-steps

Conversation

@fforootd

@fforootd fforootd commented Dec 2, 2026

Copy link
Copy Markdown
Member

Context

Summary

What the run was waiting on

  • The log's last group, @zitadel/e2e#journey:preexisting-nuxt, ended at 17:00:56. With grouped log order, turbo prints a task only when it ends, so a task that never ends prints nothing.
  • I rebuilt that run's graph (TURBO_SCM_BASE=348f144… turbo run <ci list> --affected --dry=json on ec85d3e) and diffed it against the printed groups. Exactly one task with a command is missing: //#smoke-upgrade. It depends on @zitadel/server#build, which finished at 16:59:01.
  • In the same day's other runs it took 10.6 s and 10.8 s (turbo run summaries). In this run it ran from about 16:59 until the cancel. At cleanup the runner killed a pnpm with two sh children: the task's process tree.
  • It is not the remote cache upload or --summarize: those come after the last task, and one task never finished.
  • It is not the Actions outage alone. The task started three minutes before the outage began at 17:02, and the runner stayed up and cancelled on schedule.

Why it could hang for the whole job

  • The smoke installs the latest @zitadel/server from public npm (npm view, then npm install) with no deadline of its own. npm's limits (fetch-timeout 5 min, fetch-retries 2, 10–60 s backoff) outlast the job: against a registry that accepts a connection and sends nothing, npm view was still waiting after 90 s.
  • waitForPublished swallowed every npm view error as "not published yet" and polled every 20 s for up to 15 minutes, which is also the job's limit.
  • The same day, three journey lanes failed on stalled registry.npmjs.org streams (see the journey diagnostics PR). A registry stall is the likely trigger. The task's output was never printed, so I cannot prove which npm step it was.

The change (scripts/smoke-server.mjs, scripts/smoke-upgrade.mjs)

  • npmWithDeadline runs npm with a deadline and a bounded number of attempts:
    • npm view: 60 s per attempt, 3 attempts.
    • npm install: 180 s per attempt, 2 attempts.
    • A retry absorbs one stalled request. Running out of attempts fails the task with npm's output and the attempt count.
  • waitForPublished keeps polling only while npm answers E404, the nightly's "platform package not published yet" case. Any other npm failure ends the smoke after its attempts.
  • The /readyz poll gets a 5 s timeout per request, and the smoke's API requests 60 s.

How this rules the hang out

  • Every step of the smoke now has a deadline. Worst case without an E404: 3 × (60 s + 5 s) for each npm view, 2 × 180 s for the install, then the existing 120 s startServer/migrate bounds. That is a few minutes, and it ends in a failure that prints what stalled.
  • The one remaining long wait is a genuine E404 for the platform package of a release published minutes earlier, which the nightly needs. In CI, latest has been published for days.

Validation

  • Built the server (turbo run @zitadel/server#build), then ran node scripts/smoke-upgrade.mjs: passed in 5 s (0.10.0 wrote schema 47; the build migrated it to 51 and read the user back).
  • node scripts/smoke-server.mjs --version 0.10.0: passed.
  • Fault injection: npmWithDeadline(["view", …]) against a local TCP server that never answers (3 s deadline, 2 attempts) failed after 6.5 s with ran longer than 3s (attempt 2 of 2). Plain npm view against the same server was still waiting at 90 s.
  • npm view of a missing version (@zitadel/server@99.0.0) and of a missing package both answer E404; @zitadel/server@0.10.0 answers 0.10.0.
  • biome check on both files: clean.
  • Not run: the full-pr job itself.

Release notes / changeset

  • No changeset required — no shipped behavior changed.

Notes

  • The hang cost only queue time because the job has its 15-minute limit. That limit is enough: the workflow puts a fully uncached run at about 7.5 minutes, and that day's runs took 2 to 10.5 minutes. The run cancelled earlier that day (46902745533) spent 10.5 minutes in actions/checkout, GitHub's git transport, which no limit that still catches a real hang would absorb.
  • Turbo's grouped output hides a hung task's log entirely. Streaming the order in CI would show it, but it would also interleave every task's output, so I left that as a follow-up for discussion.

Generated by Claude Code

…y fails it, not the job

The merge-queue run for #3552 on ec85d3e hung after its last printed task
until full-pr's 15-minute limit. The task still running was //#smoke-upgrade
(normally about 11 s): turbo prints a task's group only when it ends, so the
log showed nothing of it. Its npm calls had no deadline of their own, and npm's
(fetch-timeout 5 min, 2 retries) outlast the job; waitForPublished turned a
failed `npm view` into 20-second polling for up to 15 minutes.

Run each npm call with a deadline and a bounded number of attempts, keep
waitForPublished's polling for npm's answer that the version is missing
(E404), and give the readyz poll and the API requests a per-request timeout.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmVbPErbwzmWcPYv1gS
@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cloud Ready Ready Preview Dec 2, 2026 8:20pm UTC

Request Review

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ No Changeset found

Latest commit: 1c3780c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@fforootd
fforootd marked this pull request as ready for review December 2, 2026 20:09
Copilot AI balanced review requested due to automatic review settings December 2, 2026 20:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-12-02T20:12:56.277062Z 5e77ee6 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI 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.

🟡 Changes recommended

The smoke script can exceed CI’s 900-second limit before server startup, causing cancellation before grouped failure diagnostics are reported.

1 open issue
What changed in this PR

Adds deadlines and retries to the server smoke scripts so stalled npm or HTTP requests fail with diagnostics rather than consuming the CI job’s timeout.

Changes:

  • Bounds npm attempts and retries.
  • Limits publication polling to missing-package responses.
  • Adds readiness and API request timeouts.
File Description
scripts/​smoke-upgrade.mjs Uses bounded npm lookups and API request timeouts.
scripts/​smoke-server.mjs Adds npm deadlines, selective publication polling, and readiness request timeouts.

Review effort: Balanced

Comment thread scripts/smoke-server.mjs Outdated
const installed = await npmWithDeadline(
["install", "--prefix", dir, "--no-audit", "--no-fund", `@zitadel/server@${version}`],
{ cwd: dir },
{ cwd: dir, timeoutMs: 180_000, attempts: 2 },
Three lookups at three attempts of 60 s and an install at two of 180 s could add up to more than the 15 minutes full-pr allows, so a registry that stalls late would still end in a cancelled job without the smoke's output. The lookups get 30 s and the install 120 s: under ten minutes at worst, and still far above the second or so each takes.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
@fforootd
fforootd added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 6a1f9e4 Dec 2, 2026
26 checks passed
@fforootd
fforootd deleted the ci/bound-smoke-upgrade-npm-steps branch December 2, 2026 20:43
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Engineering Kanban Dec 2, 2026

This branch was successfully deployed

1 active deployment
Preview — 1c3780c5 Deployed Dec 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants