Skip to content

fix: run Bun sequences natively without a Node subprocess - #1154

Open
MichalCz wants to merge 3 commits into
develfrom
feat/native-bun-runner
Open

MichalCz wants to merge 3 commits into
develfrom
feat/native-bun-runner

Conversation

@MichalCz

Copy link
Copy Markdown
Member

Summary

  • Execute Bun-selected sequence code inside the Bun runner process. Remove the delegated Node subprocess and all Node fallback behavior.
  • Reuse the existing sequence runtime through Bun's bundled Node compatibility, with a small Bun-specific inherited-control-stream adapter.
  • Preserve configured HTTP Agent/Broker routing by loading the existing installed node-fetch implementation under Bun instead of Bun's replacement shim.
  • Require Bun 1.4.2 or newer, with an explicit error on unsupported versions; align CI, image pins, and author documentation.
  • Keep the Node-based Host/outer coordinator. It is not the process executing the Bun sequence.

Tests-first implementation

The first commit adds tests before the runtime change. Against the previous implementation, the native-identity test failed because author code ran in a separate Node PID, and the unusable-NODE_BIN test failed because the runner tried to spawn Node. The independent Node behavior baseline passed.

The implementation and integration updates follow in separate commits. This PR is independent of #1152 and targets devel directly.

Validation

Package and contract checks

  • Full runner-bun suite on Docker Bun 1.4.2: 75 passed.
  • Node runner suite: 118 passed.
  • client-utils suite: 4 passed.
  • npm run build:packages: passed.
  • npm run check:typings-split: 4 passed.
  • npm run check:runtime-invariants: 8 passed.
  • Runtime-manifest artifact/provenance tests: 14 passed.
  • PR workflow tests: 8 passed; sequence guide tests: 3 passed; affected documentation contract: 1 passed.
  • Final Agent/version regression after naming-only cleanup: 4 passed under Bun 1.4.2 with container networking disabled.

The new tests cover author identity, unusable NODE_BIN, supported export shapes, multi-function chains, DataStream/StringStream/BufferStream output, args/context, declarations and initialization ordering, lifecycle/errors/exit artifacts, inherited-descriptor framing/EOF/cancellation/backpressure, and Agent-aware requests/streaming/abort.

Hosted BDD

All runs use the supported Docker BDD runner and report no leaked repository processes.

NO_HOST=true SCRAMJET_SPAWN_TS=1 node scripts/run-bdd.js --mode=docker -- features/appcontext/APPCONTEXT-002-hosted-runtimes.feature --name 'APPCONTEXT-002'

3 scenarios / 86 steps passed: Python, Node, and native Bun. Exercises real Hub client routing, initialization-time declarations, logging, health, events, raw HTTP exposure, and author-side identity.

NO_HOST=true SCRAMJET_SPAWN_TS=1 node scripts/run-bdd.js --mode=docker -- features/appcontext/RUNTIME-MANIFEST-001.feature --tags '@source and @requires-bun'
NO_HOST=true SCRAMJET_SPAWN_TS=1 node scripts/run-bdd.js --mode=docker -- features/appcontext/RUNTIME-MANIFEST-001.feature --tags '@built and @requires-bun'

Each passed: 1 scenario / 18 steps. Both producer and consumer report the actual Bun executable/PID and the selected source or built runner entry. The exact loaded-package provenance checks remain intact; no Node sequence-runner process appears below Bun.

NO_HOST=true SCRAMJET_SPAWN_TS=1 node scripts/run-bdd.js --mode=docker -- features/api-router/hub-event-watch.feature --name 'REALCONTAINER native Bun observer'

1 scenario / 18 steps passed: actual Bun 1.4.2 executes the observer, acquires/releases the watch, aborts the pending read, and completes the control probe successfully.

Boundaries and known baseline issues

  • Bun 1.3.14 is intentionally unsupported. Its HTTP compatibility did not preserve the configured Agent; the user-approved minimum is 1.4.2. There is no Node fallback.
  • The supported BDD container tested current source and built artifacts. The changed product runner Dockerfile was inspected, but a fresh product runner image was not built/tested. No downloaded-release-tarball run is claimed.
  • The full documentation generator still has four unrelated baseline failures involving missing technical-debt content, existing output drift, and an unowned README. Targeted native-Bun documentation checks and updated generated pages pass; unrelated output was not broadly regenerated.
  • No strict memory-guard profile was enabled. Default supported runner limits were retained, with no added skips, threshold changes, or exceptions.

@MichalCz
MichalCz force-pushed the feat/native-bun-runner branch from 1f17f69 to 9f5fade Compare November 12, 2026 18:20

This branch has not been deployed

No deployments
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