Skip to content

fix(sandbox): corepack's download prompt hangs the dev server forever - #5837

Merged
pedrofrxncx merged 1 commit into
mainfrom
fix/corepack-prompt-hangs-dev-server
Aug 7, 2026
Merged

fix(sandbox): corepack's download prompt hangs the dev server forever#5837
pedrofrxncx merged 1 commit into
mainfrom
fix/corepack-prompt-hangs-dev-server

Conversation

@pedrofrxncx

@pedrofrxncx pedrofrxncx commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

The bug

Every pod in the tenant-electrolux-prod warm pool has a cloned repo and a full node_modules, and a dev task that has never produced a byte of output:

sandbox  79  0.0  sh -c cd /app/repo && yarn run dev
sandbox  80  0.0  node /usr/local/bin/yarn run dev

/usr/local/bin/yarn is the corepack shim. Its first line is process.env.COREPACK_ENABLE_DOWNLOAD_PROMPT ??= '1', so when it has to fetch a yarn version it asks:

! Corepack is about to download https://registry.yarnpkg.com/yarn/-/yarn-1.22.22.tgz
? Do you want to continue? [Y/n]

Tasks spawn on a PTY, so corepack sees a tty, prints the prompt, and blocks on stdin. Nothing times it out. The dev port never opens, so the preview sits on "Starting your preview…" until the sandbox is reaped — and a warm pool of these is a pool of pods that are warm in every respect except the one that matters.

Verified on the live pod: with COREPACK_ENABLE_DOWNLOAD_PROMPT=0, yarn --version returns instantly.

The fix

install.go and SpawnStep already pin COREPACK_ENABLE_STRICT=0 / COREPACK_ENABLE_DOWNLOAD_PROMPT=0 — that's why install succeeded while dev hung. buildEnv in the task manager is the third spawner and was missed; it's the one that runs the dev server, /exec, and /bash.

Two lines in buildEnv, seeded before extra/overrides so caller env still wins.

Testing

  • TestBuildEnvSilencesCorepackPrompt — asserts both vars on the pty and pipe paths, and that caller overrides survive.
  • go build ./... && go test ./internal/proc/ ./internal/setup/ ./internal/routes/ pass.

Only affects repos whose package manager is a corepack shim (yarn, pnpm). npm/bun were never blocked, which is why this hid until a yarn tenant showed up.


Summary by cubic

Prevent dev server hangs caused by corepack’s interactive download prompt by disabling it in task-run envs. Repos using yarn/pnpm now start previews reliably.

  • Bug Fixes
    • Set COREPACK_ENABLE_STRICT=0 and COREPACK_ENABLE_DOWNLOAD_PROMPT=0 in buildEnv before applying overrides.
    • Covers PTY and pipe spawns; caller env still wins.
    • Added TestBuildEnvSilencesCorepackPrompt.

Written for commit 688d31e. Summary will update on new commits.

Review in cubic

A task spawns on a PTY, so corepack sees a tty and its download prompt
defaults on. The first time it has to fetch a yarn/pnpm shim it prints
"Do you want to continue? [Y/n]" and blocks on stdin — forever. Nothing
times it out, the port never opens, and the preview sits on "Starting
your preview..." until the sandbox is reaped.

Observed on every pod of the electrolux tenant warm pool in prod: the
repo was cloned and node_modules installed, but `yarn run dev` was
parked at the prompt with 0% CPU. Setting COREPACK_ENABLE_DOWNLOAD_PROMPT=0
on the same pod makes yarn resolve instantly.

The install step (install.go) and SpawnStep already pin these two vars.
The task manager is the third spawner and was missed — and it is the one
that runs the dev server.
@pedrofrxncx
pedrofrxncx enabled auto-merge (squash) August 7, 2026 00:26
@pedrofrxncx
pedrofrxncx merged commit c19a182 into main Aug 7, 2026
25 checks passed
@pedrofrxncx
pedrofrxncx deleted the fix/corepack-prompt-hangs-dev-server branch August 7, 2026 00:30
decocms Bot pushed a commit that referenced this pull request Aug 7, 2026
PR: #5837 fix(sandbox): corepack's download prompt hangs the dev server forever
Bump type: patch

- @decocms/sandbox (packages/sandbox/package.json): 1.43.1 -> 1.43.2
- deploy/helm/sandbox-env (chart 0.12.3) (deploy/helm/sandbox-env/values.yaml deploy/helm/sandbox-env/Chart.yaml): image.tag/appVersion -> 1.43.2

Deploy-Scope: both
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.

1 participant