Skip to content

fix(approval): wake blocked gateway approvals on session cleanup#18171

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-b18b7e59
May 1, 2026
Merged

fix(approval): wake blocked gateway approvals on session cleanup#18171
teknium1 merged 1 commit into
mainfrom
hermes/hermes-b18b7e59

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

@teknium1 teknium1 commented May 1, 2026

Salvages #18044 onto current main. Authorship preserved via cherry-pick.

Summary

Gateway approval waiters blocked in threading.Event.wait() now get signalled (and marked as denied) when clear_session() runs during /new, /resume, or /branch — instead of idling until the dangerous-command approval timeout expires.

Changes

  • tools/approval.py: clear_session() now pops gateway queues, sets entry.result="deny", and calls entry.event.set() outside the lock. Same lock-scope fix applied to sibling unregister_gateway_notify() (prevents deadlock when waiter re-acquires _lock).
  • 2 regression tests in tests/gateway/.

Validation

  • scripts/run_tests.sh tests/gateway/test_approve_deny_commands.py tests/gateway/test_session_boundary_security_state.py → 25/25 passing (3 runs).

Credit: @Yukipukii1 (original PR #18044)

@teknium1 teknium1 merged commit 5f3f456 into main May 1, 2026
9 of 10 checks passed
@teknium1 teknium1 deleted the hermes/hermes-b18b7e59 branch May 1, 2026 02:46
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery labels May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants