Skip to content

server: own capacity drain tasks - #931

Merged
yisding merged 2 commits into
agent/ws25-voice-server-sweep-scopefrom
agent/ws25-capacity-gate-task-scope
Aug 7, 2026
Merged

server: own capacity drain tasks#931
yisding merged 2 commits into
agent/ws25-voice-server-sweep-scopefrom
agent/ws25-capacity-gate-task-scope

Conversation

@yisding

@yisding yisding commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Problem

CapacityGate.drain() started graceful stop workers, its cancellation-shielded finisher, and per-session escalations with raw asyncio task APIs. Only the outer finisher had an instance ledger, while cancellation-resistant descendants depended indirectly on the grandfathered module-global hard-timeout ledger.

Changes

  • move every CapacityGate drain worker into one named RuntimeTaskScope
  • keep graceful, finish, and escalation task identities distinct
  • retain cancellation-resistant force work directly under the gate until settlement
  • add failure-path assertions for caller cancellation and hard-timeout survivors
  • reduce the production raw-task baseline from 29 to 26
  • document the gate's lifecycle ownership

Why / impact

The drain's timing and swallow/propagate behavior stay unchanged, but task lifetime is now explicit and local to the gate. Caller cancellation and force-deadline expiry can no longer leave per-session teardown dependent only on a module-global anchor.

Checks

  • .venv/bin/python -m pytest tests/server/test_capacity_gate_drain.py -q (63 passed)
  • .venv/bin/python -m pytest tests/server/test_websocket_runtime_drain.py tests/server/test_voice_server_lifecycle.py tests/server/test_webrtc_routes.py tests/ratchets/test_source_inventory.py -q (51 passed, 28 skipped)
  • .venv/bin/ruff check src/easycat/server/transports.py tests/server/test_capacity_gate_drain.py
  • .venv/bin/ruff format --check src/easycat/server/transports.py tests/server/test_capacity_gate_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: a95228ac-8cf0-4c62-a076-62d6ce5e5df8

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

@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: 262784a14b

ℹ️ 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/transports.py
@yisding
yisding force-pushed the agent/ws25-capacity-gate-task-scope branch from 262784a to dfcc2e4 Compare August 7, 2026 03:14
@yisding
yisding force-pushed the agent/ws25-capacity-gate-task-scope branch from dfcc2e4 to 94be366 Compare August 7, 2026 03:48
@yisding
yisding merged commit bc36a53 into agent/ws25-voice-server-listener-scope Aug 7, 2026
5 checks passed
@yisding
yisding deleted the agent/ws25-capacity-gate-task-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