Repository navigation
fix(capabilities): resolve the terminal query on a later turn - #3
Merged
BlankParticle merged 1 commit intoNov 12, 2026
Merged
Conversation
On Bun, process.stdin releases its reader on the tick after pause(). When the terminal answers before the timeout, finish() runs inside the data handler and the readable listener is reattached before that tick, so Bun releases the reader under it and every later key press is lost. Resolving in setImmediate reattaches after the release. Fixes alchemy-run#2
This was referenced Nov 12, 2026
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.
Fixes #2.
On Bun,
process.stdinreleases its native reader on the tick afterpause()ifreadableFlowingis nottrue. When the terminal answers the query before the timeout,finish()runs inside the'data'handler, andApp.tsxadds the'readable'listener back in a microtask, before that tick. Bun then releases the reader, and no key press reaches the app after that.This change resolves the query in
setImmediate, so the'readable'listener is added after Bun releases the reader and gets a new one. Under Node, the only change is that the query resolves one turn later.Testing
I also used the patched
dist/withalchemy deployin a terminal that answers quickly, and the prompt takes input again.