Skip to content

server: own WebRTC offer cleanup - #924

Merged
yisding merged 1 commit into
agent/ws25-session-manager-stop-cohortfrom
agent/ws25-webrtc-route-task-scope
Aug 7, 2026
Merged

server: own WebRTC offer cleanup#924
yisding merged 1 commit into
agent/ws25-session-manager-stop-cohortfrom
agent/ws25-webrtc-route-task-scope

Conversation

@yisding

@yisding yisding commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Problem

Each accepted WebRTC offer started a long-lived peer-close cleanup worker with raw asyncio.create_task() and tracked it in a manual set. The set supplied a strong reference, but duplicated lifecycle bookkeeping and left the worker outside the named runtime ownership model.

Changes

  • create per-offer cleanup workers through a dedicated RuntimeTaskScope
  • retain the task-to-session-key index needed for forced shutdown finalization
  • start cleanup through one helper used by production and the force-escalation regression test
  • release an empty standalone cleanup scope after server-stop cancellation settles
  • reduce the reviewed raw-task-spawn inventory from 35 to 34
  • document the per-offer cleanup owner in the WebRTC architecture guide

Why / impact

Every accepted peer now has an explicitly named, strongly owned cleanup task that remains discoverable until it releases the Session and capacity reservation. Existing cancellation and force-escalation semantics are preserved.

Root cause

The WebRTC routes' cleanup ledger was implemented before the shared runtime task-scope abstraction and had not yet been migrated in WS2.5.

Checks

  • focused cleanup ownership and source-inventory tests — 10 passed
  • broader WebRTC routes/capacity/source slice — 70 passed / 24 skipped
  • Ruff on changed Python files — passed
  • mypy on webrtc_routes.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: 5ae58457-0ab6-4ffa-8539-ac2fc051076a

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
@yisding
yisding force-pushed the agent/ws25-webrtc-route-task-scope branch from cd7a696 to 6419d39 Compare August 7, 2026 03:05
@yisding
yisding force-pushed the agent/ws25-webrtc-route-task-scope branch from 6419d39 to f8546dd Compare August 7, 2026 03:47
@yisding
yisding merged commit dea751c into agent/ws25-task-scope-policy Aug 7, 2026
5 checks passed
@yisding
yisding deleted the agent/ws25-webrtc-route-task-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