Skip to content

[upstream PR 917] f<!-- -->ix(cli): Bun Windows compatibility — shell:true child_process workaround and iii-exec config #389

@wbugitlab1

Description

@wbugitlab1

Source: Source pull request number: 917 in rohitg00/agentmemory (URL omitted to avoid GitHub cross-reference)
Title: fix(cli): Bun Windows compatibility — shell:true child_process workaround and iii-exec config
Author: JackieJK
State: open
Draft: no
Merged: no
Head: JackieJK/agentmemory:fix/bun-windows-spawn @ 5eb08c3
Base: main @ f6f9e3c
Labels: (none)
Changed files: 0
Commits: 0
Created: 2026-06-12T06:08:52Z
Updated: 2026-06-14T10:22:54Z
Closed: (not closed)
Merged at: (not merged)

Original PR body:

What

Fixes agentmemory CLI startup under Bun on Windows, where child_process cannot spawn native Rust-compiled executables (oven-sh/bun#32011).
Three changes, all gated behind an IS_BUN runtime detection:

  1. iiiBinVersion() — adds shell: true to execFileSync. Without it, the version probe hangs for 3s then times out, so the engine is never "found" even when iii.exe exists on disk.
  2. spawnEngineBackground() — adds shell: true to spawn. Without it, the engine process silently fails to start.
  3. writeBunCompatibleConfig() — generates a runtime config at ~/.agentmemory/iii-config.bun.yaml that replaces the iii-exec worker's node dist/index.mjs with bun run src/index.ts. Without it, the engine window prints 'node' is not recognized… on every startup.
    No impact on Node.js — all three changes are IS_WINDOWS && IS_BUN conditional.

Why

Bun's uv_spawn-based child_process implementation on Windows cannot spawn PE binaries with certain subsystem characteristics (iii.exe and other Rust-compiled executables). execFileSync and spawnSync both hang; spawn silently fails. The documented workaround is shell: true, which routes through cmd.exe.
Root cause is upstream in Bun (oven-sh/bun#32011). This PR is a defensive workaround so agentmemory works on Bun without waiting for the upstream fix.
How to verify

  • With Bun 1.3.14 on Windows: bun run src/cli.ts starts the engine, worker connects, and agentmemory is ready. No ETIMEDOUT, no node not found.
  • npm test — all existing tests pass (changes are Bun-conditional, Node path unchanged).

Summary by CodeRabbit

  • New Features

    • Added full support for the Bun JavaScript runtime so the CLI can run under Bun as well as Node.js.
    • CLI now auto-generates a Bun-compatible configuration when needed so engines start seamlessly under Bun.
  • Bug Fixes

    • Resolved subprocess execution issues on Windows when running with Bun to improve reliability.

Local branch:
Fork PR:
Fork decision:
Verification:
Notes:

Metadata

Metadata

Assignees

No one assigned

    Labels

    decision-candidateFork decision has not been madeupstream-openUpstream pull request is openupstream-prTracks an upstream pull request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions