fix(watch): refuse deadlocking Bun runtimes - #902
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThe PR prevents watch mode from starting or being enabled by reload on Bun versions older than 1.3.14, before filesystem watchers can be constructed.
Confidence Score: 5/5The PR appears safe to merge; the runtime guard is applied before watcher construction on both initial startup and live reload paths. The compatibility policy is centralized, covered at its version boundaries, and invoked before side-effecting watch setup while non-watch behavior remains available. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Configured review input] --> B{Watch enabled?}
B -- No --> C[Continue startup or reload]
B -- Yes --> D{Bun version at least 1.3.14?}
D -- No --> E[Raise actionable user error]
D -- Yes --> F[Load bootstrap]
F --> G[Adopt review]
G --> H[Construct watch runtime]
Reviews (1): Last reviewed commit: "fix(watch): refuse deadlocking Bun runti..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--watchstartup on Bun versions older than 1.3.14.Why
A live
bun src/main.tsx diff main --watch --fastsession became completely unresponsive: keyboard and mouse bytes accumulated in the PTY while the process remained alive at 0% CPU.A forced core dump showed an AB/BA lock inversion in Bun 1.3.10:
PathWatcherManager.unregisterWatcher→Watcher.remove, waiting for the watcher mutex.processINotifyEventBatch→PathWatcherManager.onFileUpdate, waiting for the manager mutex.This matches oven-sh/bun#31166. The upstream reproduction hung under Bun 1.3.10 after two heartbeats and completed under Bun 1.3.14 after nineteen. Hunk already pins Bun 1.3.14 for builds, but source invocations could still use an older global runtime.
The guard runs before watcher construction and before acquiring a controlling-terminal stream. Headless and non-watch commands remain available on older runtimes. Prebuilt/npm installs continue using their embedded or bundled fixed Bun runtime.
Verification
bun test src/core/watch/runtime.test.ts src/app/startup.test.ts src/ui/AppHost.reload.test.tsxbun run typecheckbun run deps:checkXDG_CONFIG_HOME=$(mktemp -d) bun run testbun run test:integrationbun run test:tty-smokebun run check:docsbun run changeset:statusTested on Linux x64. The runtime policy and version parser have platform-neutral unit coverage; macOS and Windows were not tested manually.
This PR description was generated by Pi using gpt-5.6-sol