fix(gateway): bypass slash commands during pending /update prompts#16289
Merged
Conversation
When the gateway intercepts a pending /update prompt and the user sends a recognized slash command (/new, /help, ...), the command now dispatches normally AND the detached update subprocess is unblocked by writing a blank .update_response. _gateway_prompt reads '' → strips → returns the prompt's default (typically a safe 'n' / skip), so the update process exits cleanly instead of blocking on stdin until the 30-minute watcher timeout. Also clears _update_prompt_pending[session_key] on this path so stray future input for the same session isn't re-intercepted. Extends PR #15849 with tests for the new cancel-write + a regression test pinning the legacy behavior of unrecognized /foo slash commands still being consumed as the response.
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.
Salvages #15849 (@Yukipukii1) with a follow-up fix.
Summary
Recognized slash commands (/new, /help, /resume, ...) sent during a pending /update prompt now dispatch normally instead of being silently written into .update_response. Also unblocks the detached update subprocess on the bypass path so it exits cleanly instead of zombie-waiting until the 30-minute watcher timeout.
Changes
Why the follow-up
#15849 as submitted fixed the /new-gets-swallowed symptom but left the detached update subprocess blocked on stdin, because .update_response never got written. That would have zombied the update process for 30 minutes waiting on the watcher timeout. This PR adds the blank-write so _gateway_prompt returns the prompt's default immediately.
Validation
scripts/run_tests.sh tests/gateway/test_update_streaming.py tests/gateway/test_session_boundary_security_state.py → 22 passed.
Closes #15849. Authorship of the original commit preserved for @Yukipukii1 via rebase-merge.