Fix: interactive mode exits after first prompt#23
Open
Mostafa-M-Hussein wants to merge 1 commit into
Open
Conversation
ora's spinner detaches stdin when it stops, which causes readline to receive EOF and fire 'close' on the next tick. The 'close' handler calls process.exit(0), so the session dies right after the first response prints. Pause readline while the spinner is running and resume it in finally so the stdin stream stays attached to readline.
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.
Problem
In interactive mode the CLI quits immediately after the first response is printed. The
deepseek-cli >prompt never comes back. Thechat <prompt>subcommand is not affected.Repro
export DEEPSEEK_API_KEY=...deepseek-cliGoodbye! 👋Tested on Node 22, 24, 25.
Cause
In
src/commands/interactive.tsthe'line'handler starts anoraspinner inside the await:orahooksprocess.stdinto manage cursor visibility. On Node 22+ the way it releases stdin on.stop()leaves the stream paused/detached, and readline reads EOF on the next tick. That firesrl.on('close'), which callsprocess.exit(0). So the very first start/stop cycle is enough to kill the session.Fix
Pause readline while the spinner is running, resume in
finally. Three lines, no behavior change otherwise.Verified
npm run buildcleanexitand Ctrl+C still workchatcommand unchanged