Skip to content

server: own WebSocket handler tasks - #928

Merged
yisding merged 2 commits into
agent/ws25-voice-server-ws-close-scopefrom
agent/ws25-voice-server-handler-scope
Aug 7, 2026
Merged

server: own WebSocket handler tasks#928
yisding merged 2 commits into
agent/ws25-voice-server-ws-close-scopefrom
agent/ws25-voice-server-handler-scope

Conversation

@yisding

@yisding yisding commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Problem

VoiceServer tracked listener-created WebSocket handler tasks in a manual set. Shutdown cancelled and gathered those tasks but discarded every result, so expected cancellation and a handler cleanup failure were indistinguishable and failures lacked task identity.

Changes

  • adopt each listener-created handler into a named RuntimeTaskScope
  • assign a stable easycat-raw-ws-handler-<connection-id> task name
  • cancel handlers through the scope snapshot during shutdown
  • inspect completed gather results, suppressing only cancellation explicitly requested by stop
  • log genuine handler cleanup failures with the exact task name
  • update drain assertions to check the named scope is empty
  • document handler ownership and result policy

Why / impact

WebSocket handlers now remain discoverable under one lifecycle owner until they exit. Normal stop cancellation stays quiet, while a cleanup exception raised after cancellation becomes attributable and observable.

Root cause

The listener owns creation of handler tasks, so VoiceServer historically kept a parallel set. That set had not been replaced by adoption into WS2.5's task-scope model, and its return_exceptions=True results were never classified.

Checks

  • focused handler result-policy and source-inventory tests — 11 passed
  • full VoiceServer lifecycle file outside the sandbox — 24 passed / 4 skipped
  • local-socket drain selection — 15 skipped because localhost sockets are unavailable in this environment
  • Ruff on changed Python files — passed
  • mypy on voice_server.py — passed
  • pre-commit hooks — passed

@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: a1882a2c-64f2-4b69-ab72-44247565efcf

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:44

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3a9af4eba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/easycat/server/voice_server.py
@yisding
yisding force-pushed the agent/ws25-voice-server-handler-scope branch from d3a9af4 to b25ada0 Compare August 7, 2026 03:12
@yisding
yisding force-pushed the agent/ws25-voice-server-handler-scope branch from b25ada0 to 468becd Compare August 7, 2026 03:48
@yisding
yisding merged commit dea751c into agent/ws25-task-scope-policy Aug 7, 2026
2 checks passed
@yisding
yisding deleted the agent/ws25-voice-server-handler-scope branch August 7, 2026 04:12
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