Skip to content

fix(gateway): bypass slash commands during pending /update prompts#16289

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-07db9f94
Apr 27, 2026
Merged

fix(gateway): bypass slash commands during pending /update prompts#16289
teknium1 merged 2 commits into
mainfrom
hermes/hermes-07db9f94

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

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

  • gateway/run.py: in the update-intercept block, resolve_command(cmd) → if recognized, write blank .update_response (unblocks subprocess; _gateway_prompt returns prompt default), clear _update_prompt_pending, fall through to normal dispatch. Unrecognized /foo still consumed as response (legacy).
  • gateway/run.py: _clear_session_boundary_security_state also pops _update_prompt_pending so /new, /resume, /branch clean up stale state for the target session.
  • tests: regression coverage for recognized-command bypass (with .update_response cancel-write + pending-flag clearing), unrecognized slash command still consumed, and boundary-cleanup scoping across sessions.

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.

Yukipukii1 and others added 2 commits April 26, 2026 18:22
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.
@teknium1 teknium1 merged commit 90c84c6 into main Apr 27, 2026
11 of 12 checks passed
@teknium1 teknium1 deleted the hermes/hermes-07db9f94 branch April 27, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants