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.pyBuffer limits on hub event queues; sentinel guarantee on shutdownconnections.pyMonotonic lease clocks replace wall-clock for session expirywebsockets.pyWebSocket wall-clock timeout addedpolling.pyPolling timeout hardenedownership.pyOwnership 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.pyconnections.pywebsockets.py
Open-mode guard, rate-limit evaluation order, and resume leak fix
4 files changed
rest.pyOpen-mode guard added to REST routes; rate-limit evaluation order fixedevent_bus.pyOpen-mode resume path leak fixedcontrol_channel.pyControl channel open-mode handling correctedcoordinator.pyCoordinator 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.pyevent_bus.pycontrol_channel.py
Test accuracy updates
6 files changed
test_hub.pyHub tests updated for buffer limits and sentinel guaranteetest_hub_atomic.pyAtomic hub tests updated for monotonic clocktest_hub_ownership_mutations.pyOwnership mutation tests updatedtest_hub_ownership_mutations_2.pyOwnership mutation tests updatedtest_hub_ownership_mutations_3.pyOwnership mutation tests updatedtest_browser_handlers_mutations.pyBrowser 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.pytest_hub_atomic.pytest_hub_ownership_mutations.py