Skip to content

server: own WebSocket connection closes - #933

Merged
yisding merged 1 commit into
agent/ws25-websocket-manager-sweep-scopefrom
agent/ws25-websocket-close-scope
Aug 7, 2026
Merged

server: own WebSocket connection closes#933
yisding merged 1 commit into
agent/ws25-websocket-manager-sweep-scopefrom
agent/ws25-websocket-close-scope

Conversation

@yisding

@yisding yisding commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Problem

The raw-WebSocket runtime fanned out surviving connection close() awaitables with asyncio.ensure_future. A hard deadline left cancellation-resistant closes dependent on the grandfathered module-global timeout set rather than the runtime that owned the connections.

Changes

  • add a dedicated named connection-close RuntimeTaskScope to WebSocketSessionRuntime
  • start each asynchronous close through that scope with a stable task identity
  • retain the existing duplicate filtering and best-effort exception policy
  • assert that hard-timeout survivors stay attached to the runtime until settlement
  • reduce the raw production task baseline from 25 to 24
  • document connection-close ownership

Why / impact

Shutdown timing and error policy do not change. Surviving close handshakes now remain locally and inspectably owned after the shared force deadline expires.

Checks

  • .venv/bin/python -m pytest tests/server/test_websocket_runtime_drain.py -q (17 passed)
  • .venv/bin/python -m pytest tests/server/test_capacity_gate_drain.py tests/server/test_websocket_runtime_drain.py tests/ratchets/test_source_inventory.py -q (89 passed)
  • .venv/bin/ruff check src/easycat/server/transports.py tests/server/test_websocket_runtime_drain.py
  • .venv/bin/ruff format --check src/easycat/server/transports.py tests/server/test_websocket_runtime_drain.py
  • .venv/bin/mypy src/easycat/server/transports.py
  • pre-commit hooks

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0fdb27d0-2408-4bf7-ae09-badd8cffa5e3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yisding
yisding marked this pull request as ready for review August 7, 2026 02:45
@yisding
yisding force-pushed the agent/ws25-websocket-close-scope branch from 1aee0ff to 63c985d Compare August 7, 2026 03:15
@yisding
yisding force-pushed the agent/ws25-websocket-close-scope branch from 63c985d to 23322c6 Compare August 7, 2026 03:48
@yisding
yisding merged commit bc36a53 into agent/ws25-voice-server-listener-scope Aug 7, 2026
2 checks passed
@yisding
yisding deleted the agent/ws25-websocket-close-scope branch August 7, 2026 04:11
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.

1 participant