Repository navigation
fix: start the engine on a fresh profile despite npm audit hangs; honest free-model limit copy - #4408
Conversation
…ited When the anonymous OpenCode Zen free tier returns 429 FreeUsageLimitError, the engine retries with an OpenCode Go upsell in the status and then halts with the raw provider text. OpenWork rendered both verbatim. - Retry banner: for action.reason free_tier_limit, show OpenWork copy and a Connect a model provider button that opens provider settings instead of linking to opencode.ai/go. - Session error: classify FreeUsageLimitError as free-model-limit with a plain title and a description pointing at connecting your own provider. Raw fields stay in developer-mode technical details. - first-run-local spec: the first free-model task must either answer or show the honest busy notice, and must never show the Go upsell, raw provider text, or Something went wrong. The scheduled dev run was red only because the free tier is throttled from CI egress, which the spec could not see.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (a47fab8331dc1f4566490e0fa06b478b314e6c74). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (448118748eb73e8a42bc32ec409b2ce1a50e87d3). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
This reverts commit 4481187.
OpenCode installs @opencode-ai/plugin into fresh config dirs and npm plugins into its packages cache with npm's Arborist in-process, audit on by default. That audit POST to registry.npmjs.org/-/npm/v1/security/advisories/bulk is a hard network dependency; when the endpoint stalls (observed today from two networks) npm-registry-fetch waits its full 300s timeout and every engine request 502s with opencode_unreachable for five minutes on first run, so Run task silently does nothing. @npmcli/config honors npm_config_* from the environment, so the managed engine now inherits npm_config_audit=false by default; an explicit options.env value still wins. Measured on the bare sidecar: cold bootstrap with an npm plugin and a local plugin drops from >=300s to 6s.
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (49bef1ff839bbdfd7680a2e35d208a3be5e8286c). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (13271e9c9fd3596270d8fc9e6e7192cedc8db865). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (dd3262ab78159446055118052626cdb341fdf073). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
Test evidence — first-use-without-an-invite-or-cloud-reaches-local-task-ui-with-honest-model-set — ✅ passed✅ passed · 0 expectations passed · 0 failed · 0 pending [world] desktop(daytona) Test run created 2026-09-04T09:12:08.946Z · Source: |
Why
The scheduled Daytona E2E Singles lane on
devwent red onfirst-run-local.e2e.test.ts(run 33845862995):Timed out waiting for assistant reply after 180000ms; last value: 0. A clean control atorigin/dev13c282d83(pnpm evals:e2e first-run-local --daytona, exit 1, 0 passed / 1 failed) reproduced it byte-for-byte, and none of the 36 commits since the last green run touch the path. Both root causes are external services, but each exposed something OpenWork should not depend on.Root cause 1 (the actual red): the engine never starts on a fresh profile
Instrumented on a kept sandbox: clicking Run task did nothing for 5 minutes — no route change, no toast, no console error;
session.create→Request timed out; openwork-server logged every engine call as502 opencode_unreachablewhile theopencode serveprocess was alive and/global/healthanswered in 2 ms. Every instance-scoped route hung. The engine log stopped atloaded custom config.Reproduced on the bare sidecar (no OpenWork code), Linux and macOS: any plugin in config (even a one-line local file) → OpenCode 1.18.18 runs an in-process npm Arborist install of
@opencode-ai/plugininto the config dir (and of npm plugins into its packages cache).Arborist.reifyaudits by default and waits onPOST registry.npmjs.org/-/npm/v1/security/advisories/bulk. That endpoint is currently hanging — plaincurlgets nothing back in 120 s from two different networks — sonpm-registry-fetchwaits its full 300 s timeout, on every fresh profile.@npmcli/confighonorsnpm_config_*from the environment. Measured on the bare sidecar: cold bootstrap with an npm plugin + a local plugin goes from ≥300 s to 6 s withnpm_config_audit=false.Fix —
apps/server/src/managed-opencode.ts: every managed engine is spawned withnpm_config_audit=falseby default (explicitoptions.envstill wins). First run no longer depends on npm's audit service at all.Root cause 2 (masked by #1, would have been the next red): free-tier throttling rendered dishonestly
The anonymous OpenCode Zen
big-pickletier intermittently returns429 FreeUsageLimitError. The engine retries 5× and OpenWork rendered its status verbatim — "Free usage exceeded, subscribe to Go" → "Subscribe to OpenCode Go … $5/month" → [subscribe] → opencode.ai/go — then a raw"Error from provider (Console): Rate limit exceeded…"card that the spec's probe cannot see (nodata-message-role).Fix —
message-list.tsxRetryMessage: foraction.reason === "free_tier_limit", OpenWork copy plus a Connect a model provider button (existingdispatchAction→ provider settings); never links to opencode.ai/go; other reasons unchanged.session-error.ts:FreeUsageLimitError→ kindfree-model-limitwith a plain title and a description pointing at Settings → AI Providers; developer-mode technical details keep the raw fields.ErrorMessagerenders the description.Spec
first-run-local.e2e.test.ts(extended, no new file): after Run task, the first free-model task must either answer or show the honest busy notice, and must never showsubscribe to Go,Error from provider, orSomething went wrong.Verification
Journey spec on Daytona (the CI lane), three consecutive green runs on this branch, the last on the exact PR head:
Evidence for that run is in the test-evidence comment below. Note on honesty: in all three green runs the engine started immediately and the free model answered (the "replied" branch); the "honest busy notice" branch is not deterministically reachable in E2E (the 429 depends on the egress IP's quota), so that rendering is covered by unit tests instead — see below — and I am stating that explicitly rather than claiming E2E proof for it.
Unit / type checks:
pnpm --dir apps/server exec bun --conditions=development test src/managed-opencode.test.ts— 3 pass (new: defaultnpm_config_audit=falsereaches the engine; caller override wins).pnpm --dir apps/app exec bun test --isolate tests/session-error-resilience.test.tsx— 16 pass (new: free-tier APIError classifies asfree-model-limitwith developer details retained; error card shows the honest copy and no provider text/Resume; retry banner shows the Connect button, dispatches{target:"settings",action:"open",section:"providers"}, contains no Go upsell; other retry reasons unchanged).pnpm --filter @openwork/app typecheck— exit 0.pnpm --dir apps/server exec tsc -p tsconfig.json --noEmit— exit 0.origin/devbd29c1dc8, unchanged by this PR:pnpm --dir evals typecheck(3× TS2304 inenterprise-mcp-client/headless-threads) andapps/appbun suite (1183 pass / 7 fail / 1 error, same six tests).