fix(tui): detach foreground shell before steering - #4979
Open
nightt5879 wants to merge 1 commit into
Open
Conversation
Request that a blocking foreground Bash wait move to /jobs before enqueueing same-turn steer input, so the turn loop can consume the user's follow-up. Preserve the existing lossless queue fallback if shell tracking cannot accept the request. Distinguish a true foreground wait from detached Running jobs by their shell task identity, and cover both the ordering and classification boundaries with regression tests. Fixes Hmbown#4930 Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Contributor
Author
|
@codex review Please review current head |
|
To use Codex here, create a Codex account and connect to github. |
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
/jobsbefore enqueueing a same-turn steerRunningFixes #4930
Why this still applies on current
mainSince the report, bare Enter during a busy turn was changed to queue a follow-up. The ordering bug still exists when that follow-up is explicitly promoted into the active turn (or the user uses the explicit steer chord): the shared steer boundary sent the message without first releasing a foreground shell wait. Centralizing the detach request in
steer_user_messagepreserves the newer queue contract and fixes every real steer entry point.The App and Engine share the same
ShellManager. Setting its foreground-background request before enqueueing the steer lets the Bash wait loop return; the turn loop can then consume the steer. If shell tracking cannot accept the request, the existing lossless fallback restores the draft/queue instead of sending out of order.Verification
cargo fmt --all -- --checkcargo check -p codewhale-tui --bin codewhale-tui --locked-D warnings: passed after allowing four Rust 1.95 lint classes already present in untouched upstream codegit diff --checkSelf-review
Reviewed the hook, pause-state rollback, queue fallback, Ctrl+B, detached-job, and engine-consumption paths. Message-submit denial happens before detach, normal busy Enter still queues, shell-manager errors fail closed, existing Ctrl+B status text is preserved, and detached jobs with a
shell_task_idno longer masquerade as foreground waits.