Skip to content

Fix frontend dev server start on bun-only Windows installs - #7895

Merged
FarhanAliRaza merged 2 commits into
mainfrom
farhan/github-issue-7894-82bc28
Nov 13, 2026
Merged

FarhanAliRaza merged 2 commits into
mainfrom
farhan/github-issue-7894-82bc28

Conversation

@FarhanAliRaza

@FarhanAliRaza FarhanAliRaza commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Type of change

  • Bug fix (non-breaking change which fixes an issue)

What

On Windows with bun and no Node.js, reflex run could not start the frontend:

[restart] Relaunching with --conditions=development
error: restartWithMergedOptions() was called, but the process has already been restarted.

react-router dev needs the development export condition and relaunches itself to enable it. NODE_OPTIONS only reaches real Node, so a bun-only install depends on that relaunch. On Windows the relaunched process receives the flag but still does not apply the condition, so the CLI tries to relaunch again and trips its guard.

Fix

When bun is the runtime (no Node, or an outdated one), the dev server is started with

bun --conditions=development run --bun react-router dev --host

instead of bun run dev. Bun applies the condition itself, so the CLI never relaunches. With a supported Node installed the command is unchanged (bun run dev / npm run dev), and Node still reads the condition from NODE_OPTIONS.

run_frontend and AppHarness now share a private _frontend_dev_command() helper in reflex/utils/exec.py. The script is taken from constants.PackageJson.Commands.DEV rather than a hardcoded path into @react-router/dev.

Testing

On Windows 11, bun 1.4.4, no Node, react-router 8.4.0:

  • tests/integration/test_nodeless_frontend.py failed before the change with the error above and passes after. It also asserts that the dev server got --conditions=development, so it checks the new command on Linux CI too, where bun run dev already worked. Its fixture stubs the per-process node probe, so an earlier test that found node cannot change the command.
  • New parametrized test_frontend_dev_command pins the exact command for each runtime case.
  • reflex run on a minimal app starts and serves the page.
  • ruff check and ruff format are clean.

Reviewer notes

  • Not run locally: the full unit and integration suites. Pyright is clean.
  • The new command also applies to bun-only Linux and macOS, where bun run dev already worked; I could only test Windows, so CI's node-less integration test is the coverage there.
  • The outdated-Node case previously ran bun --bun run dev and now takes the same direct form. That path is only unit-tested.
  • run_process_and_launch_url now takes list[str] instead of list[str | None]. No caller passes None, and new_process already exits on a None argument.
  • Why bun's stand-in node.exe ignores the flag on relaunch is not investigated; this sidesteps it.

closes #7894

View guided diff Turn on auto-fix

`react-router dev` needs the `development` export condition and relaunches
itself to enable it. On Windows with bun and no Node, the relaunched process
receives the flag but still does not apply the condition, so the CLI tries to
relaunch a second time and trips its restart guard:

    error: restartWithMergedOptions() was called, but the process has already
    been restarted.

When bun is the runtime (no Node, or an outdated one), run the CLI through
`bun --conditions=development run --bun react-router dev --host` instead of
`bun run dev`, so bun applies the condition itself and the CLI never
relaunches. With a supported Node the command is unchanged: Node reads the
condition from NODE_OPTIONS.

`run_frontend` and AppHarness share the new `_frontend_dev_command` helper.

Fixes #7894
@FarhanAliRaza
FarhanAliRaza requested a review from a team as a code owner November 13, 2026 19:36
@FarhanAliRaza FarhanAliRaza added on deck PRs lined up to review / merge next bug Something isn't working labels Nov 13, 2026
@greptile-apps

greptile-apps Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change reaches development frontend startup in normal runs and app harnesses.

The test assertion must satisfy the repository’s exact-value requirement before merging.

Findings

  1. P2 Command check is incomplete ▶

Summary

The PR shares the frontend start command between reflex run and AppHarness, passing the development condition directly to Bun when Node is unavailable or outdated.

  • Bun starts the frontend with its development condition already set.

Reviews (2) · Last reviewed commit: "fix(exec): keep run_process_and_launch_u..." · Reviewed by Greptile

Comment thread reflex/utils/exec.py Resolved

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread reflex/utils/exec.py Resolved
Comment thread reflex/utils/exec.py Resolved
@codspeed

codspeed Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

2 warnings

⚠️ 24 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ 2 benchmarks with a significant change ran on different hardware

Their base and head results were measured on machines with a different CPU, core count or memory, so the changes might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 149 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ test_process_event_burst_independent_tokens[1] 2.7 ms 2.9 ms -4.57%
⚡ test_route_matching[1000] 50.5 µs 47.8 µs +5.67%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing farhan/github-issue-7894-82bc28 (405bc3c) with main (b5aff10)

Open in CodSpeed

…odeless test's node probe

Sequence[str | None] did not match new_process's list overloads, so pyright
failed. The nodeless integration test now asserts the dev server got the
development condition flag and stubs the per-process node probe, so an
earlier test that found node cannot switch it back to `bun run dev`.
@FarhanAliRaza
FarhanAliRaza merged commit 2e2ffd5 into main Nov 13, 2026
167 of 168 checks passed
@FarhanAliRaza
FarhanAliRaza deleted the farhan/github-issue-7894-82bc28 branch November 13, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working on deck PRs lined up to review / merge next

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reflex run fails to start the frontend on Windows with bun and no Node (react-router restart guard)

2 participants