Skip to content

test: cover direct browser stream cancellation - #148

Open
rgarcia wants to merge 1 commit into
mainfrom
hypeship/test-routing-cancel
Open

test: cover direct browser stream cancellation#148
rgarcia wants to merge 1 commit into
mainfrom
hypeship/test-routing-cancel

Conversation

@rgarcia

@rgarcia rgarcia commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

summary

  • add an async telemetry stream that blocks until its consumer is canceled
  • verify cancellation stops the consumer and closes the direct-routed response body
  • assert the request reaches the browser VM telemetry path

tests

  • pytest -q — 671 passed
  • ruff check .
  • pyright --pythonpath /tmp/kernel-python-venv/bin/python tests/test_browser_routing.py

Note

Low Risk
Test-only addition with no runtime code changes; low risk beyond CI/test maintenance.

Overview
Adds test_async_telemetry_stream_cancellation_survives_direct_routing, which exercises AsyncKernel when telemetry/stream is allowlisted for direct browser VM routing.

The test uses a mock httpx.AsyncByteStream that blocks until the stream consumer is cancelled, then asserts the consumer raises CancelledError and the underlying response read/teardown completes (via read_stopped). It also pins that the request hits /browser/kernel/telemetry/stream on the cached browser route.

No production or SDK behavior changes—only regression coverage for cancelling long-lived SSE reads on direct-routed telemetry streams.

Reviewed by Cursor Bugbot for commit b136c50. Bugbot is set up for automated code reviews on this repo. Configure here.

@rgarcia
rgarcia requested a review from Jayko001 August 8, 2026 14: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