[fix] #3105: Input stops working after clicking 'Warpify subshell' in poetry/pipenv#9873
[fix] #3105: Input stops working after clicking 'Warpify subshell' in poetry/pipenv#9873mitre88 wants to merge 1 commit intowarpdotdev:masterfrom
Conversation
…/pipenv) When clicking 'Warpify subshell' in a poetry or pipenv subshell, the terminal input would stop working. This was caused by Warp sending Ctrl-U and Ctrl-K control characters to clear the line before sending the InitShell DCS hook, which interfered with pexpect's PTY management. pexpect (used by poetry and pipenv to spawn subshells) expects to manage the PTY itself and is sensitive to control characters. Sending Ctrl-U/Ctrl-K caused pexpect to enter a state where user input was blocked. This fix: - Adds is_pexpect_subshell() helper to detect poetry/pipenv subshells - Adds write_init_subshell_bytes_to_pty_without_clearing() for pexpect - Modifies trigger_subshell_bootstrap to use the non-clearing variant for pexpect-based subshells Fixes warpdotdev#3105
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Dr. Alex Mitre.
|
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR attempts to fix Poetry/Pipenv subshell warpification by skipping the Ctrl-U/Ctrl-K line-clearing bytes before sending the InitShell DCS hook for pexpect-backed subshells.
Concerns
- The new pexpect detection reads
session.subshell_info()from the currently bootstrapped session, not from the command currently being warpified. For the reported flow, the active session is still the parent session before the Poetry/Pipenv subshell bootstraps, so this usually returnsNoneand the code still sends Ctrl-U/Ctrl-K.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| } | ||
|
|
||
| self.write_init_subshell_bytes_to_pty(shell_type, ctx); | ||
| let is_pexpect_subshell = self.is_pexpect_subshell(ctx); |
There was a problem hiding this comment.
subshell_info() is usually None before the poetry shell/pipenv shell subshell is initialized; the reported flow still falls back to sending Ctrl-U/Ctrl-K. Base this on the active block/banner command being warpified instead.
Problem
When users launch a subshell using
poetry shellorpipenv shelland click "Warpify subshell", all keyboard input stops working. Users cannot type commands, use Ctrl+C, or Ctrl+D to exit.Root Cause
pexpect (used by poetry and pipenv to spawn subshells) manages its own PTY state. When Warp sends Ctrl-U and Ctrl-K control characters to clear the line before sending the InitShell DCS hook, these characters interfere with pexpect's PTY management, causing input to be blocked.
Solution
Added
is_pexpect_subshell()helper method that detects if the current subshell is poetry or pipenv by checking thespawning_commandagainst the existingPOETRY_SUBSHELL_COMMAND_REGEXandPIPENV_SUBSHELL_COMMAND_REGEX.Added
write_init_subshell_bytes_to_pty_without_clearing()method that writes the InitShell DCS hook directly without sending Ctrl-U/Ctrl-K first.Modified
trigger_subshell_bootstrap()to check if the subshell is pexpect-based and use the non-clearing variant in that case.This approach is consistent with the existing code which already uses RC-file based bootstrap for poetry/pipenv subshells during initial session bootstrapping (see
should_use_rc_file_bootstrap_methodinbootstrap.rs).Testing
exceptclauses)Fixes #3105