provide-terminal 2026-04-05
Resilience hardening: buffer limits, monotonic leases, WS timeouts, and open-mode fixes
47 files · 696+ · 264-

Resilience hardening: buffer limits, monotonic leases, WS timeouts

5 files changed
  • core.py Buffer limits on hub event queues; sentinel guarantee on shutdown
  • connections.py Monotonic lease clocks replace wall-clock for session expiry
  • websockets.py WebSocket wall-clock timeout added
  • polling.py Polling timeout hardened
  • ownership.py Ownership transfer uses monotonic time
  • Hub event queues gain explicit buffer limits to prevent unbounded memory growth under load. Session lease expiry switched from wall-clock to monotonic clock to prevent clock-skew false expirations. WebSocket routes gain wall-clock timeouts for connections that never send. Hub shutdown now guarantees sentinel delivery even if the event loop is under backpressure. harden behavioral
    3 files
    • core.py
    • connections.py
    • websockets.py

Open-mode guard, rate-limit evaluation order, and resume leak fix

4 files changed
  • rest.py Open-mode guard added to REST routes; rate-limit evaluation order fixed
  • event_bus.py Open-mode resume path leak fixed
  • control_channel.py Control channel open-mode handling corrected
  • coordinator.py Coordinator open-mode guard
  • External review found three issues: (1) open-mode sessions could resume into a state that leaked terminal state to new connections; (2) global rate-limit bucket was evaluated before per-client bucket, inverting priority; (3) REST routes lacked an open-mode guard. All three fixed. event_bus.py resume path now clears stale state on reconnect. remediate behavioral
    3 files
    • rest.py
    • event_bus.py
    • control_channel.py

Test accuracy updates

6 files changed
  • test_hub.py Hub tests updated for buffer limits and sentinel guarantee
  • test_hub_atomic.py Atomic hub tests updated for monotonic clock
  • test_hub_ownership_mutations.py Ownership mutation tests updated
  • test_hub_ownership_mutations_2.py Ownership mutation tests updated
  • test_hub_ownership_mutations_3.py Ownership mutation tests updated
  • test_browser_handlers_mutations.py Browser handler mutation tests updated
  • Test suite updated to match hardened behavior: hub tests verify buffer limit enforcement and sentinel delivery, atomic tests use monotonic time, ownership mutation tests updated for the corrected evaluation order. Total of ~18 test files touched across bridge, hub, and ownership modules. qualify internal
    3 files
    • test_hub.py
    • test_hub_atomic.py
    • test_hub_ownership_mutations.py