Skip to content

fix(server): ship opencode-chrome-devtools as a bundled local plugin so engine bootstrap never depends on npm - #4423

Merged
benjaminshafii merged 2 commits into
devfrom
fix/vendor-chrome-devtools-plugin
Sep 4, 2026
Merged

benjaminshafii merged 2 commits into
devfrom
fix/vendor-chrome-devtools-plugin

Conversation

@benjaminshafii

@benjaminshafii benjaminshafii commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Problem

openwork-server's runtime config listed one npm plugin, "opencode-chrome-devtools" (apps/server/src/openwork-runtime-config.ts:81); the other six are local files. On any fresh profile (first install, new eval desktop) the bundled OpenCode engine installs that package during bootstrap through its in-process npm installer (Arborist on the embedded Bun 1.3.14 — no child process, writes package-lock.json). That install intermittently hangs forever: dozens of idle keep-alive sockets to the registry, no timeout, no error. Bootstrap never returns, every /session* proxy call 502s after 5s, and the app shows "OpenCode unavailable — the engine did not answer after 4 attempts".

Minimal repro with no OpenWork code, on macOS and Linux, on opencode 1.18.18 and 1.18.27:

# fresh XDG_* dirs, opencode.json = {"plugin":["opencode-chrome-devtools"]}
POST /session  →  hangs >100s  (passes in 24–34s on a lucky attempt)
# same, plugin removed
POST /session  →  200 in 0.16s

This is what has been keeping the Daytona desktop E2E lane red today (#4397 added an eval-host "engine cache warm gate" to pre-seed the cache; that fixes evals but not users).

Change

Bundle the plugin like the other six:

  • apps/server/package.json: exact dev dep [email protected] (build-time only — bun build inlines it, so it is not a runtime dep and does not need mirroring into apps/desktop/package.json; the server-dependency-mirror ratchet stays green); added src/opencode-plugins/openwork-chrome-devtools.ts to the bun build list (ws is inlined; no bare imports remain in the output).
  • apps/server/src/opencode-plugins/openwork-chrome-devtools.ts: export { server } from "opencode-chrome-devtools"; — exactly one exported function so OpenCode registers the tools once. Minimal .d.ts for the untyped package.
  • openwork-extensions-plugin-path.ts: openworkChromeDevtoolsPluginPath(); runtime config uses it in place of the npm specifier.
  • Desktop packaging already copies server/dist/opencode-plugins → resources/opencode-plugins (electron-builder.base.yml:17), so the new file ships automatically.
  • No change to evals/ (the warm gate stays and becomes redundant), and no change to the app's Library detection (it keys off MCP servers, not the plugin array).

Verification

Engine-boundary proof, fresh profile, no registry access on PATH (env -i PATH=/usr/bin:/bin):

opencode.json = {"plugin":["<repo>/apps/server/dist/opencode-plugins/openwork-chrome-devtools.js"]}
POST /session?directory=…  →  200 in 3.45s
GET  /experimental/tool/ids →  8 browser_* tools registered
pnpm --filter openwork-server build                       # exit 0
grep -c 'from "ws"' apps/server/dist/opencode-plugins/openwork-chrome-devtools.js   # 0
node -e 'import("./apps/server/dist/opencode-plugins/openwork-chrome-devtools.js").then(m=>console.log(Object.keys(m)))'   # [ 'server' ]
pnpm --filter openwork-server exec bun test src/openwork-runtime-config.test.ts src/openwork-extensions-plugin-path.test.ts src/workspace-init.test.ts   # 24 pass, 0 fail
pnpm --filter openwork-server typecheck                   # exit 0

openwork-runtime-config.test.ts now asserts the plugin list contains no bare opencode-chrome-devtools specifier and does contain the local openwork-chrome-devtools.(ts|js) path.

E2E lane: running an existing desktop journey on Daytona against this branch to show nothing regressed; result to follow in a comment.

Related: #4392 (composer stays editable) was blocked on this.

@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 Skipped Skipped Sep 4, 2026 5:31pm UTC
openwork-den Skipped Skipped Sep 4, 2026 5:31pm UTC
openwork-diagnostics Skipped Skipped Sep 4, 2026 5:31pm UTC
openwork-landing Skipped Skipped Sep 4, 2026 5:31pm UTC

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 (75c7a26f95ba7bd1557d2c80073761597052d32b). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics September 4, 2026 17:31 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-app September 4, 2026 17:31 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-den September 4, 2026 17:31 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing September 4, 2026 17:31 Inactive

@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 (50d43d3cf5cd49c4a7e9f2273d86e85b4ebf752a). 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 — reloading-a-session-with-a-persisted-composer-draft-keeps-the-renderer-stable — ✅ passed

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

[world] desktop(daytona) · workspace(/tmp/openwork-empty-session-1788543123517) · session("New task")
[user] type(composer, "Keep this persisted draft through reload")
[probe] storage(openwork.session-drafts.v2)
[user] reload · see(composer, editable, text="Keep this persisted draft through reload") · reload · see(composer, editable, text="Keep this persisted draft through reload") · reload · see(composer, editable, text="Keep this persisted draft through reload")
[probe] storage(openwork.session-drafts.v2)
steps 1 ✅ draft survives three reloads (5.7s)
verdict passed · 3 user observations (see ×3) · 2 probes · steps 1/1


Test run created 2026-09-04T17:32:03.482Z · Source: evals/results/test-runs/2026-09-04T17-32-03-481Z-reloading-a-session-with-a-persisted-composer-draft-keeps-the-renderer-stable/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 4423 --test-run 2026-09-04T17-32-03-481Z-reloading-a-session-with-a-persisted-composer-draft-keeps-the-renderer-stable

@benjaminshafii
benjaminshafii merged commit 74fd7b9 into dev Sep 4, 2026
35 checks passed
@benjaminshafii
benjaminshafii deleted the fix/vendor-chrome-devtools-plugin branch September 4, 2026 17:39
benjaminshafii pushed a commit that referenced this pull request Sep 4, 2026
…lugin is bundled (#4426)

The cache warm gate added in #4397 preinstalled opencode-chrome-devtools through npm. #4423 now bundles the plugin locally, so remove the provision-time install, profile seeding, and environment plumbing.
benjaminshafii pushed a commit that referenced this pull request Oct 5, 2026
* chore: delete dead code, unused deps and orphaned assets

Remove code that nothing reaches, verified against origin/dev with knip
(new knip.jsonc) plus manual reference checks, including hidden dirs.
Typecheck passes for app, server, desktop, den-api, den-web, landing,
gateway and telemetry; the app builds; app boot and desktop tests pass.

App (apps/app):
- React-port leftovers and orphaned modules: actions store/provider,
  global sync and SDK providers, unused settings, connections and session
  modules, test-only helpers and their scripts.
- Dead exports: unused utils, Advanced sections, migration deferral
  helpers, compactSession, the deprecated signUpEmail stub.
- The unregistered OpenAI image settings state and the never-read
  microsandboxCreateSandbox flag.
- The menu-overlay renderer (native context menus replaced it in #4650),
  unused i18n keys and 192 unused grain-art images.
- Deps: @ai-sdk/react, @radix-ui/colors,
  @radix-ui/react-use-controllable-state, remark-breaks, remark-gfm.

Desktop (apps/desktop) and types:
- 16 renderer-unreachable IPC handlers and their types and re-exports
  (some wrote files), plus 7 unused browser and microphone channels.
- menu-overlay preload, unused dev icons, electron-devtools-installer.

Server (apps/server):
- Unused exports, @types/minimatch, @openwork/headless-threads and the
  opencode-chrome-devtools devDep with its module declaration (the
  bundled openwork-chrome-devtools plugin replaced it in #4423).

Den:
- Orphaned landing components, the den-api plugin-system barrel and
  desktop-policy-role-assignments re-export, a test-only cache hook,
  test helpers and evidence scripts left without tests, and unused deps
  (grammy, drizzle-orm in gateway, zod in telemetry).

Repo:
- apps/ui-demo, Tauri migration scripts, the broken dev-web-local and
  dev-den-local scripts, the den-controller stub and DEN_CONTROLLER_PORT,
  one-off scripts, HANDOFF.md, committed tsbuildinfo files and tracked
  evals/results output, the Remote MCP Apps docs.
- Add knip.jsonc and make scripts/find-unused.sh a thin knip wrapper
  that uses pnpm.

Signed-off-by: Benjamin Shafii <[email protected]>

* chore(app): keep only the artifact helpers production uses

lib/artifacts.ts keeps ArtifactType, getArtifactType and
useOpenArtifactPath; the rest had no production caller and its tests
were already removed.

Signed-off-by: Benjamin Shafii <[email protected]>

---------

Signed-off-by: Benjamin Shafii <[email protected]>

This branch was previously deployed

4 inactive deployments
Preview – openwork-den — 50d43d3c Deployed Sep 4, 2026 by vercel[bot]
Preview – openwork-landing — 50d43d3c Deployed Sep 4, 2026 by vercel[bot]
Preview – openwork-diagnostics — 50d43d3c Deployed Sep 4, 2026 by vercel[bot]
Preview – openwork-app — 50d43d3c Deployed Sep 4, 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

None yet

Development

Successfully merging this pull request may close these issues.

1 participant