You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: prevent permission callback binding loss after reconnections
Addresses issue github#300 — SDK permission callbacks are lost after session
reconnection in headless mode.
Three-pronged fix across all SDKs (Node.js, Python, Go, .NET):
1. Disposed guard in event dispatch: DispatchEvent/dispatchEvent returns
early if the session has been disposed, preventing events from being
routed to a stale session.
2. Explicit denial when no permission handler: If a permission.requested
event arrives and no handler is registered, the SDK now sends an
explicit denial RPC response instead of silently ignoring it, which
would cause the CLI to timeout.
3. Session map cleanup via onDisposed callback: When a session is
disposed, the client is notified and removes the session from its
internal map, ensuring future events are not routed to it.
Concurrency hardening:
- TOCTOU re-check after async boundaries in permission execution path
(Node.js, Python, Go)
- Atomic disconnect guards with proper locking (Go RWMutex, Python lock,
.NET Interlocked)
- Scoped exception handling in .NET permission denial path (IOException,
ObjectDisposedException only)
- TCP notification path lock safety in Python client
0 commit comments