Repository navigation
Reset stale REPL interrupts before running a new command - #19337
Merged
Merged
Conversation
fdncred
reviewed
Oct 24, 2026
Contributor
There was a problem hiding this comment.
Review overview
🟡 Changes recommended
The reset fixes the next command, but the prompt's interrupt is still set while the next line is edited, so completers and the transient prompt fail until Enter.
Findings: 0
Open (6)
The prompt's interrupt is still set while the next line is edited A Ctrl-C typed right after Enter is now dropped The prompt step doesn't check anything Say why the command goes throughmatch The test writes shell-integration escapes to the terminal runningcargo test Every command now sends Reset to each running plugin twice
Notes from my clanker, checked on 0c3e8f7. Built the branch, ran the new nu-cli test with and without the fix, and drove the binary through a pty to interrupt the prompt and then use completion and the transient prompt.
Contributor
|
Thanks |
This was referenced Nov 13, 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.



Description
Related to #18989 and follows up on #19163
The REPL resets interrupt signals at the start of each iteration, before evaluating the prompt
An interrupted prompt can leave the signal set for the transient prompt, line editor callbacks, and the next command
matchto reach signal checksReproduction
{ sleep 1min; "prompt" }sleepmatch 1 { 1 => 42 }The macOS PTY probe compared the previous PR commit
0c3e8f749with the updated codeThe previous PR binary reported normal and transient prompt interruption errors and offered no custom completion before Enter
The updated binary reported only the normal prompt interruption, offered completion before Enter, and rendered the transient prompt
The next hook and command succeeded in both probes, including after a separate SIGINT while waiting for input
A separate PTY probe kept a background thread job and a frozen external process registered during prompt interruption and verified cancellation of a later foreground command
User-facing changes (Release notes)
Fixed stale prompt interrupts affecting completions, transient prompts, and the next interactive command with its pre-execution hooks
Validation
Local checks on macOS aarch64 with Rust 1.97.1 at
2bcf4099ecargo test --locked --profile ci -p nu-cli --lib -- command_after_interrupted_prompt_runs_hooks_and_commandcargo build --locked --profile ci --bin nucargo test --locked --profile ci -p nu-cli --no-fail-fastcargo test --locked --profile ci --test tests -- shell::cargo test --locked --profile ci --bin nu -- signals::cargo nuclippycargo check --locked --profile ci --no-default-features --bin nucargo fmt --allandcargo fmt --all --checktypos1.51.1git diff --checkManual PTY checks passed for prompt errors remaining visible, completion and transient-prompt recovery before Enter, subsequent hook and command execution, editor-interrupt recovery, background and frozen job preservation, and foreground cancellation
The regression test emitted no shell-integration OSC or application-mode reset sequences
Additional notes
The command-boundary recovery retains a short race for a SIGINT arriving after Enter but before the reset
This is a trade-off to recover editor interruptions, not a claim that the race is eliminated
One initial baseline PTY launch in this follow-up timed out after 30 seconds without output, while the rerun and updated-binary probes passed
The earlier validation also recorded one 60-second PTY startup timeout
The causes were not established and the passing reruns do not erase those observations
This reproduction did not demonstrate actual job deletion, so this PR does not claim to resolve every scenario in #18989 or close that issue
Windows and Linux runtime validation is deferred to GitHub CI and is not included in the local results above