Skip to content

test(evals): pre-warm the OpenCode plugin cache per Daytona sandbox - #4415

Closed
benjaminshafii wants to merge 4 commits into
devfrom
fix/evals-warm-engine-cache
Closed

benjaminshafii wants to merge 4 commits into
devfrom
fix/evals-warm-engine-cache

Conversation

@benjaminshafii

Copy link
Copy Markdown
Member

Problem

Every app-driving e2e spec on dev has been failing at seedSessions (session.create_task → "Action is disabled" / "did not return a session ID"), on Daytona and locally. The app showed "OpenCode unavailable — the engine did not answer after 4 attempts."

Root cause (measured live in a sandbox): each spec gets a fresh Electron profile with an empty engine cache, so the engine's first workspace bootstrap npm-installs @opencode-ai/plugin@<engine version> into two config dirs and opencode-chrome-devtools@latest into its package cache. Inside the sandbox that self-install frequently wedges — 60 idle TLS connections to registry.npmjs.org, no timeout, log silent — so bootstrap never completes. npm itself is fine from the sandbox (40 parallel fetches in 1.1s). With those three directories already populated, bootstrap takes 0.2s.

Fix (harness only)

  • provision.ts: new engine cache warm gate after the first-boot gate. Reads the sidecar version, writes the three package.jsons (base64-shipped — the exec transport strips "), runs npm install into each, and stores the tree at /workspace/.openwork-daytona/engine-cache/openwork-dev-data. Non-fatal on failure (specs start cold, with a logged warning). ~10s.
  • daytona.ts spawnElectron: after creating a fresh profile, cp -a the warm tree into <userData>/openwork-dev-data (guarded: never clobbers a caller-owned profile that already has one).
  • Cleanup gate untouched; it never removes engine-cache.

Verification

OPENWORK_EVAL_DAYTONA lane, unchanged spec evals/specs/responsive-session-layout.e2e.test.ts:

[openwork/testkit] ==> engine cache warmed for openwork-connector-testkit-admin-…
✓ narrow session panes stay selectable, synchronized, and inside the viewport  235096ms
passed 1 / failed 0 / skipped 0

Also proven downstream: with this branch as base, new-split-session.e2e.test.ts (#4397) went from red-at-seed to green on the same lane.

Unit: node --test evals/packages/hosts/test/{provision,daytona-host}.test.ts → 29 pass.

Two harness footguns found along the way (not fixed here)

  1. pnpm evals:e2e on the Daytona lane checks out OPENWORK_EVAL_REF or dev inside the sandbox — never the current branch. A feature branch's local Daytona "verdict" silently tests dev's app unless you set OPENWORK_EVAL_REF. The run-tests skill doesn't mention it.
  2. The app's canCreateTask needs a model; the Daytona lane needs OPENWORK_EVAL_MODEL=big-pickle (CI sets it; the skill doesn't say so).

@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 10:58am UTC
openwork-den Ignored Ignored Preview Sep 4, 2026 10:58am UTC
openwork-diagnostics Ignored Ignored Preview Sep 4, 2026 10:58am UTC
openwork-landing Ignored Ignored Preview Sep 4, 2026 10:58am UTC

Comment thread evals/packages/hosts/src/daytona.ts Resolved
Benjamin Shafii added 2 commits September 4, 2026 02:58
…nd seed each Electron profile

Every e2e desktop profile started with an empty engine cache, so the first
workspace bootstrap npm-installed @opencode-ai/plugin and opencode-chrome-devtools
inside the engine. In the sandbox that self-install often wedged with idle TLS
connections to the registry, the app reported OpenCode unavailable, and every
app-driving spec died at seedSessions. Install those packages once per sandbox
with npm into the three directories the engine checks, then copy the warm tree
into each fresh profile so bootstrap takes 0.2s instead of minutes.
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 (a58d10806c6ae1075ebe861f0e97c6e6431c3870). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

…that exact path

Address the Warden finding: never trust a pre-existing shared cache dir in a
reused sandbox. Each provision installs into a fresh /tmp/openwork-engine-warm-*
tree with --ignore-scripts and hands that exact path to the Daytona host, which
is the only source spawnElectron seeds from.
@benjaminshafii

Copy link
Copy Markdown
Member Author

Test evidence — narrow-session-panes-stay-selectable-synchronized-and-inside-the-viewport — ✅ passed

✅ passed · 3 expectations passed · 0 failed · 0 pending

verdict passed · 0 user observations · 0 probes · steps 0/0

ℹ️ ASSERTION — 1. Narrow split focus stays synchronized and the tab widget remains reachable

{"selected":"split","tabStops":1,"inactiveStops":0,"controlsResolve":true,"labelledByActiveTab":true,"minimumTarget":44,"switcherInsideViewport":true,"panelInsideViewport":true,"documentWidth":390,"viewportWidth":390}

  • ✅ PASS Narrow split focus stays synchronized and the tab widget remains reachable — {"selected":"split","tabStops":1,"inactiveStops":0,"controlsResolve":true,"labelledByActiveTab":true,"minimumTarget":44,"switcherInsideViewport":true,"panelInsideViewport":true,"documentWidth":390,"viewportWidth":390}

ℹ️ ASSERTION — 2. Existing session focus actions reveal the requested narrow pane without losing the other chat draft

session.open revealed ses_f93ea53bafferk1gg5VlhraY4Q; returning to ses_f93ea5d5affetA9FIhdgt2ZWI5 preserved the draft.

  • ✅ PASS Existing session focus actions reveal the requested narrow pane without losing the other chat draft — session.open revealed ses_f93ea53bafferk1gg5VlhraY4Q; returning to ses_f93ea5d5affetA9FIhdgt2ZWI5 preserved the draft.

ℹ️ ASSERTION — 3. The in-flow tools pane stays inside the viewport and closing it returns to chat

{"panelInsideViewport":true,"chatHidden":true,"splitHidden":true,"documentWidth":390,"viewportWidth":390}

  • ✅ PASS The in-flow tools pane stays inside the viewport and closing it returns to chat — {"panelInsideViewport":true,"chatHidden":true,"splitHidden":true,"documentWidth":390,"viewportWidth":390}

Test run created 2026-09-04T10:58:00.450Z · Source: evals/results/test-runs/2026-09-04T10-58-00-449Z-narrow-session-panes-stay-selectable-synchronized-and-inside-the-viewport/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 4415 --test-run 2026-09-04T10-58-00-449Z-narrow-session-panes-stay-selectable-synchronized-and-inside-the-viewport

benjaminshafii pushed a commit that referenced this pull request Sep 4, 2026
)

Right-click any session row (or its ⋯ menu) → New split, or Cmd+K → New split, creates a
fresh empty session in that workspace and opens it as the secondary split pane without
moving the primary pane or route. One shared task creator with openAs "primary" | "split".

Also carries the e2e harness fix from #4415 (superseded): every Daytona provision now
pre-installs @opencode-ai/plugin and a pinned opencode-chrome-devtools into a fresh
per-provision tree (npm --ignore-scripts) and seeds each Electron profile from that exact
path, so the engine bootstraps in 0.2s instead of wedging on a cold in-engine npm install.
Adds a trusted user.rightClick spec primitive.

Verified on Daytona: evals/specs/new-split-session.e2e.test.ts passed on 69caa0f.
@benjaminshafii

Copy link
Copy Markdown
Member Author

Superseded: these commits landed on dev via #4397 (squash 153b34d), which carried them because its spec depended on the warm engine cache. Root-cause write-up, Warden threads, and the Daytona evidence on this PR remain the record for the harness change.

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