Skip to content

[Bug]: v4.19.4 regression — no longer loads on OpenCode Desktop (Node sidecar); v3.17.15 shim fix reverted (bun.serve top-level) #6635

Closed as not planned

Description

Summary

Regression in v4.x: the OpenCode Desktop (Electron/Node sidecar) load fix shipped in v3.17.15 (see closed #3797 / PR #3798 — bun-spawn-shim.ts, grep -c 'globalThis.Bun' → 0) is gone in v4.19.4 (latest on npm). The plugin silently fails to load on Desktop again.

Environment

  • OS: Windows 11 x64
  • OpenCode Desktop: v1.18.15 (latest production)
  • oh-my-openagent: v4.19.4 (latest, via "plugin": ["oh-my-openagent"] in %USERPROFILE%\.config\opencode\opencode.jsonc)
  • Bun: 1.3.14 installed and on PATH (so it's not a missing-Bun issue)

Evidence

Request

Please ship a Node-compatible build (e.g. bun build --target node, or a dual build selected via exports conditions), or re-apply the v3.17.15 shim approach so v4.x loads on the Electron sidecar. The v3.17.15 fix proves this is achievable — it just regressed in 4.x.

Related

Activity

  1. code-yeongyu commented on Aug 7, 2026

    @code-yeongyu
    Owner

    I unpacked the published [email protected] tarball from npm and checked each claim against dist/index.js (5,744,365 bytes — matches your 5.7MB). Two of the three evidence points don't hold up, so the diagnosis needs revising — but the underlying symptom you're reporting may still be real.

    1. The v3.17.15 shim is NOT gone

    grep -c 'bun-spawn-shim\|bunSpawnShim' dist/index.js  ->  1
    

    The shim from PR #3798 is still present in 4.19.4. It was not reverted.

    2. bun.serve at line 151702 IS guarded — and it is not a global

    This is the key correction. bun there is a local variable, not globalThis.Bun:

    async function createRuntimeSkillSourceServer(options, runtimeEnv = runtime6) {
      ...
      const bun = runtimeEnv.Bun;          // L151670
      if (!bun) {
        const server3 = createServer3(...)  // <-- Node http fallback
        ...
        server3.listen(0, "127.0.0.1");
        return { url: `http://127.0.0.1:${address.port}/`, ... };
      }
      const server2 = bun.serve({ ... });   // L151702 — only reached when Bun exists

    So there is a full node:http fallback path that runs when Bun is absent. bun.serve is unreachable on a Node sidecar. Also:

    grep -oc 'Bun\.serve' dist/index.js  ->  0
    

    There are zero top-level Bun.serve calls. The single bun.serve you found is the guarded local shown above.

    3. Note on your grep methodology

    grep -c 'globalThis.Bun' returns 3 in 4.19.4, not 0. But -c counts matching lines, not occurrences, and in a 5.7MB single-line-heavy bundle that number says very little about whether guards exist. Line numbers in a minified-ish bundle are similarly unreliable as evidence. That's likely how the "insufficient guard" conclusion was reached.

    What would actually help

    The silent-load symptom may still be genuine — I'm only disputing the stated root cause. Since you have a reproducible Desktop environment, could you provide:

    • Does %TEMP%\oh-my-openagent.log get created at all, or is it absent entirely?
    • Any output from the Desktop sidecar with OMO_DEBUG=1 / stderr captured?
    • Confirmation of which file the sidecar actually resolves — exports maps "." to ./dist/index.js via the import condition only; if the Electron sidecar loads via require(), there is no require condition in exports, which would make resolution fail before any Bun/Node runtime check ever runs.

    That last point is my main suspicion and it's consistent with your "silent drop, plugin never instantiated, zero log entries" observation — a module-resolution failure happens earlier than any of the runtime guards.

  2. liudongyan13701205717-source commented on Aug 8, 2026

    @liudongyan13701205717-source
    Author

    Thanks for the detailed review — the three-evidence-point rebuttal is fair and I withdrawn the grep-based claims. Since this thread, I've fully removed oh-my-openagent from the test environment (uninstalled plugin, deleted %TEMP%\oh-my-openagent.log and bunx cache), so I can't produce fresh OMO_DEBUG output right now. What I can still confirm:

    1. %TEMP%\oh-my-openagent.log did exist on Windows Desktop 1.18.15 (with old entries from earlier CLI runs); zero new entries after Desktop sidecar starts — but as you point out, that alone can't distinguish "module resolution failure" from "never invoked", since a resolution failure happens before any plugin code runs.

    2. Sidecar loader path: from my inspection of the shipped Desktop app.asar (v1.18.15), the plugin host loads plugins via Node ESM dynamic import() (the @npmcli/arborist + import("file://...") flow from #18308), not require(). So under Desktop the exports.import condition is what gets resolved — a missing require condition would NOT be hit on the Desktop path.

    So your resolution suspect — exports missing require condition — would matter for a CJS require-path consumer, but Desktop goes through import; that moves suspicion to the v4 bundle itself: the top-level imports of bun:semver/bun-pty style modules or Bun-only APIs evaluated during module evaluation under Node. The v3.17.15 shim fix (PR #3798) worked precisely because it removed those top-level Bun constructs; v4 may have re-introduced them in dist/index.js before any runtime guard.

    Concrete ask: can you grep the v4.19.4 dist bundle for top-level bun:semver, bunx, Bun.serve, or process.versions.bun references (outside functions)? If any exist at module top-level, that's a deterministic Node-sidecar load failure. I can reinstall the plugin, run node --input-type=module -e "await import('oh-my-openagent')" under Node and report the exact error to confirm — just say the word.

  3. liudongyan13701205717-source commented on Aug 15, 2026

    @liudongyan13701205717-source
    Author

    Cross-link with anomalyco/opencode #41033 and shekohex/opencode-pty #36 — same root cause: OpenCode Desktop's Node ESM plugin host vs Bun-targeted plugins. All three are the same incompatibility seen from different plugins. Tracking them together would help maintainers see the pattern and prioritize either a compatibility fix or a documented plugin-host contract.

  4. liudongyan13701205717-source commented on Aug 27, 2026

    @liudongyan13701205717-source
    Author

    Ran the exact repro you asked for. Environment: Windows, Node v26.5.1, plain node --input-type=module -e "await import('oh-my-openagent')" (no Bun involved), package 4.19.4:

    Error: ENOENT: no such file or directory, open
      '...\node_modules\oh-my-openagent\dist\skills\frontend\SKILL.md'
        at readFileSync (node:fs:539:20)
        at loadSharedSkillTemplate (dist/index.js:109234:41)
        at dist/index.js:109254:13
    

    So the failure is NOT a top-level bun:semver / bun-pty import — those resolve fine under Node. It's a packaging bug: loadSharedSkillTemplate does readFileSync('dist/skills/<name>/SKILL.md') at module-evaluation time, but the published 4.19.4 tarball ships every dist/skills/*/ directory WITHOUT SKILL.md. I checked all 11 skill dirs — ast-grep, coding-agent-sessions, data-scientist, debugging, frontend, lsp-setup, programming, ultimate-browsing, ulw-plan, ulw-research, visual-qa — every one has references/ and ATTRIBUTION.md but no SKILL.md. The first one iterated throws ENOENT and aborts the whole import(), which is exactly the silent Desktop load failure.

    Reproducible with zero Bun: pure Node ESM import(). Fix would be to ship SKILL.md into dist/skills/*/ (or stop reading it at top level / guard the read). Happy to retest once a fixed build is published.

  5. liudongyan13701205717-source commented on Aug 27, 2026

    @liudongyan13701205717-source
    Author

    @code-yeongyu bumping this — the repro above (plain Node import('oh-my-openagent') → ENOENT on dist/skills/frontend/SKILL.md) shows the Desktop load failure is a packaging bug, not a Bun/sidecar issue. The published 4.19.4 tarball is missing SKILL.md in all 11 dist/skills/*/ dirs, so loadSharedSkillTemplate throws during module evaluation and aborts the whole import(). Happy to retest any fixed build — just ping me.

  6. code-yeongyu commented on Aug 27, 2026

    @code-yeongyu
    Owner

    Thanks for running the repro. I attempted to reproduce this exactly, and the artifact evidence contradicts the claim on every axis, so let me lay out what I found.

    1. The published 4.19.4 tarball ships SKILL.md in every skill dir

    Pulled straight from the registry, integrity-pinned:

    $ npm pack [email protected] && shasum oh-my-openagent-4.19.4.tgz
    4a9ff922cc029b0768125a8a6aa091457ed57970   # == npm view [email protected] dist.shasum
    $ tar xzf oh-my-openagent-4.19.4.tgz
    $ for d in package/dist/skills/*/; do [ -f "$d/SKILL.md" ] || echo "MISSING: $d"; done
    (no output — all present)
    

    dist/skills has 17 directories in 4.19.4, not 11 — and only 3 of them (frontend, ultimate-browsing, ulw-research) contain ATTRIBUTION.md. An install where "all 11 dirs have references/ and ATTRIBUTION.md but no SKILL.md" matches no published artifact of this package. I also checked older 4.x tarballs (4.0.0 → 4.19.4): every version that ships dist/skills ships SKILL.md in every dir; earlier 4.x had no dist/skills at all (and no eager loader either).

    2. Your exact repro passes on a clean install

    $ npm i [email protected]
    $ node --input-type=module -e "await import('oh-my-openagent'); console.log('IMPORT OK')"
    IMPORT OK      # Node v26.7.0
    

    The path derivation is Windows-safe too: sharedSkillsRootPath() is fileURLToPath(new URL("./skills/", import.meta.url)) (packages/shared-skills/index.mjs), so this is not a POSIX-only path assumption.

    3. The stack trace you posted cannot be produced by this bundle

    I forced the exact failure you describe — deleted dist/skills/frontend/SKILL.md from a real install — and captured the genuine trace:

    Error: ENOENT: no such file or directory, open '.../dist/skills/frontend/SKILL.md'
        at readFileSync (node:fs:539:20)
        at file:///.../dist/index.js:109234:41            <- anonymous closure
        at loadSharedSkillTemplate (file:///.../dist/index.js:109247:10)
        at file:///.../dist/index.js:109254:13
    

    Your trace attributes loadSharedSkillTemplate to 109234:41 and omits the 109247:10 frame. Line 109234 is the anonymous closure returned by createSharedSkillTemplateLoader; V8 does not attribute that frame to loadSharedSkillTemplate, and the real named frame at 109247 is absent from your paste.

    4. The claim contradicts the original report

    loadSharedSkillTemplate("frontend") runs at module evaluation. If SKILL.md were genuinely absent from the artifact, the import would fail identically under the CLI — Bun reads the same files — yet the original report states the same package "works fine" under the CLI.

    Given the registry artifact provably contains the files, an install missing them is local corruption (partial extraction, a disk cleaner, AV interference) — or the pasted output was not from a real run. Closing as not-reproducible.

    Happy to reopen if you can provide, from the failing machine, in one unedited session: Get-FileHash of the cached tarball, dir node_modules\oh-my-openagent\dist\skills\frontend, and the unredacted output of the import command.

  7. liudongyan13701205717-source commented on Aug 29, 2026

    @liudongyan13701205717-source
    Author

    Correction / follow-up on my earlier ENOENT report. I re-tested with clean, complete installs of [email protected] from both the China mirror (registry.npmmirror.com) and the official npm registry:

    • Both tarballs are byte-identical (same SHA256: C1AF13D0104F6D18…).
    • Both install with all 17 dist/skills/*/ directories present, each containing SKILL.md.
    • node --input-type=module -e "await import('oh-my-openagent')" exits 0 (IMPORT_OK) on both.

    My earlier ENOENT was caused by my local npm install being interrupted by a timeout (partial extraction → only 11 skill dirs, SKILL.md not yet written), not by a packaging bug. Your "local corruption / not reproducible" assessment was correct, and closing this was the right call — apologies for the noise.

    The genuine Desktop loading gap (Node ESM sidecar vs Bun-target plugins) is tracked separately in anomalyco/opencode#41033.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions