Skip to content

fix: start the engine on a fresh profile despite npm audit hangs; honest free-model limit copy - #4408

Merged
benjaminshafii merged 6 commits into
devfrom
fix/free-model-limit-honest-card
Sep 4, 2026
Merged

benjaminshafii merged 6 commits into
devfrom
fix/free-model-limit-honest-card

Conversation

@benjaminshafii

@benjaminshafii benjaminshafii commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Why

The scheduled Daytona E2E Singles lane on dev went red on first-run-local.e2e.test.ts (run 33845862995): Timed out waiting for assistant reply after 180000ms; last value: 0. A clean control at origin/dev 13c282d83 (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 as 502 opencode_unreachable while the opencode serve process was alive and /global/health answered in 2 ms. Every instance-scoped route hung. The engine log stopped at loaded 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/plugin into the config dir (and of npm plugins into its packages cache). Arborist.reify audits by default and waits on POST registry.npmjs.org/-/npm/v1/security/advisories/bulk. That endpoint is currently hanging — plain curl gets nothing back in 120 s from two different networks — so npm-registry-fetch waits its full 300 s timeout, on every fresh profile.

@npmcli/config honors npm_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 with npm_config_audit=false.

Fix — apps/server/src/managed-opencode.ts: every managed engine is spawned with npm_config_audit=false by default (explicit options.env still 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-pickle tier intermittently returns 429 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 (no data-message-role).

Fix — message-list.tsx RetryMessage: for action.reason === "free_tier_limit", OpenWork copy plus a Connect a model provider button (existing dispatchAction → provider settings); never links to opencode.ai/go; other reasons unchanged. session-error.ts: FreeUsageLimitError → kind free-model-limit with a plain title and a description pointing at Settings → AI Providers; developer-mode technical details keep the raw fields. ErrorMessage renders 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 show subscribe to Go, Error from provider, or Something went wrong.

Verification

Journey spec on Daytona (the CI lane), three consecutive green runs on this branch, the last on the exact PR head:

OPENWORK_EVAL_REF=fix/free-model-limit-honest-card pnpm evals:e2e first-run-local --daytona
placement: daytona (--daytona) · checkout resolved 13271e9c9fd3
✓ first use without an invite or cloud reaches local task UI with honest model setup  157s
Tests 1 passed (1) · verdict: passed

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: default npm_config_audit=false reaches 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 as free-model-limit with 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.
  • Pre-existing on clean origin/dev bd29c1dc8, unchanged by this PR: pnpm --dir evals typecheck (3× TS2304 in enterprise-mcp-client / headless-threads) and apps/app bun suite (1183 pass / 7 fail / 1 error, same six tests).

…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.
@vercel

vercel Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

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

4 Skipped Deployments
Project Deployment Actions Updated
openwork-app Ignored Ignored Preview Sep 4, 2026 9:12am UTC
openwork-den Ignored Ignored Preview Sep 4, 2026 9:12am UTC
openwork-diagnostics Ignored Ignored Preview Sep 4, 2026 9:12am UTC
openwork-landing Ignored Ignored Preview Sep 4, 2026 9:12am UTC

Comment thread evals/specs/first-run-local.e2e.test.ts Resolved
diff-warden[bot]
diff-warden Bot previously approved these changes Sep 4, 2026

@diff-warden diff-warden Bot 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.

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

diff-warden[bot]
diff-warden Bot previously approved these changes Sep 4, 2026

@diff-warden diff-warden Bot 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.

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

Benjamin Shafii added 2 commits September 4, 2026 01:59
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.
diff-warden[bot]
diff-warden Bot previously approved these changes Sep 4, 2026

@diff-warden diff-warden Bot 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.

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

diff-warden[bot]
diff-warden Bot previously approved these changes Sep 4, 2026

@diff-warden diff-warden Bot 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.

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

@benjaminshafii benjaminshafii changed the title fix(app): tell users honestly when the free starter model is rate limited fix: start the engine on a fresh profile despite npm audit hangs; honest free-model limit copy Sep 4, 2026

@diff-warden diff-warden Bot 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.

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

@benjaminshafii

Copy link
Copy Markdown
Member Author

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)
[user] see(text=Welcome to OpenWork) · see(Use Without Cloud) · notSee(text=/Something went wrong/) · click(Use Without Cloud) · type(placeholder=/workspace/my-project, "/tmp/openwork-first-run-workspace-1788513222336") · click(Use this folder) · see(text=Power your first task, timeoutMs=120000) · click(Skip and use the free model) · see(text=How did you hear about OpenWork?, timeoutMs=90000) · click(Skip) · see(text=/What do you need done?/, timeoutMs=180000) · see(Run task)
[probe] composer
[user] notSee(text=/Something went wrong/) · see(text=/Using the free starter model/) · type(composer, "Create a short welcome checklist for this OpenWork workspace. Use exactly three bullets and mention one thing I can do next.")
[probe] composer
[user] click(Run task) · see(text=Create a short welcome checklist for this OpenWork workspace. Use exactly three bullets and mention one thing I can do next., timeoutMs=30000)
[probe] composer · has("The free starter model is busy right now") · composer · has("The free starter model is busy right now") · composer · has("The free starter model is busy right now") · composer · has("The free starter model is busy right now") · composer · has("The free starter model is busy right now") · composer · has("The free starter model is busy right now") · composer · has("The free starter model is busy right now") · composer · has("The free starter model is busy right now") · composer · has("The free starter model is busy right now") · composer · has("The free starter model is busy right now") · composer · has("The free starter model is busy right now") · composer · has("The free starter model is busy right now") · composer · eventually(assistant reply or honest free-model notice)
[user] notSee(text=/subscribe to Go/i) · notSee(text=/Error from provider/) · notSee(text=/Something went wrong/)
steps 1 ✅ Welcome (4.2s) · 2 ✅ Choose a local folder (20.9s) · 3 ✅ Finish onboarding (12.7s) · 4 ✅ Run the first task or hear honestly why the free model can't (21.9s)
verdict passed · 13 user observations (see ×8, notSee ×5) · 28 probes · steps 4/4


Test run created 2026-09-04T09:12:08.946Z · Source: evals/results/test-runs/2026-09-04T09-12-08-946Z-first-use-without-an-invite-or-cloud-reaches-local-task-ui-with-honest-model-set/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 4408 --test-run 2026-09-04T09-12-08-946Z-first-use-without-an-invite-or-cloud-reaches-local-task-ui-with-honest-model-set

@benjaminshafii
benjaminshafii merged commit f93dbc9 into dev Sep 4, 2026
27 checks passed
@benjaminshafii
benjaminshafii deleted the fix/free-model-limit-honest-card branch September 4, 2026 09:15
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