fix: don't misroute telemetry/events to the browser VM#126
Merged
Conversation
The direct-to-VM routing allowlist matched on the subresource SEGMENT
("telemetry"), so the new historical GET /browsers/{id}/telemetry/events
endpoint (served by the control plane from S2) was routed to the session VM —
which only serves the live telemetry/stream SSE — once a session was route-cached,
yielding failures / wrong data.
Fix the granularity:
- Allowlist entries are now full path-prefixes ("curl", "telemetry/stream")
instead of bare subresources.
- Matching is segment-boundary aware: "telemetry/stream" matches
"telemetry/stream[/...]" but NOT "telemetry/events" or "telemetry/streamfoo".
- Safe by default: any path not in the allowlist (including future browser
sub-endpoints) goes to the control plane — slower, never misrouted.
All in lib/ (Stainless-preserved custom code), so durable across regens. Adds a
regression vector pinning stream->VM, events->control-plane, the boundary guard,
curl->VM, and non-allowlisted->control-plane.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CI 'test' failed because two root-package assertions still referenced the old "telemetry" segment after the default allowlist changed to ["curl","telemetry/stream"]: - TestBrowserRoutingSubresourcesFromEnvDefaultsToCurl: default assertion - TestBrowserRoutingRewritesTelemetryStreamToVM: env override aligned to the full-path value it now exercises go test ./... passes. The lib/browserrouting matcher test already covers telemetry/events -> control plane. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
archandatta
approved these changes
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The direct-to-VM routing allowlist matched on the subresource segment (
telemetry), so the new historicalGET /browsers/{id}/telemetry/events(served by the control plane from S2) was routed to the session VM (which only serves the livetelemetry/streamSSE) once a session was route-cached → failures/wrong data.Fix (in
lib/, Stainless-preserved → durable across regens):curl,telemetry/stream), not bare subresources.telemetry/streammatchestelemetry/stream[/...]but NOTtelemetry/eventsortelemetry/streamfoo.Should land in 0.70.0, which introduces
telemetry/events. Companion PRs in kernel-node-sdk + kernel-python-sdk apply the same change.🤖 Generated with Claude Code
Note
Medium Risk
Changes request routing for all browser subresources when route cache is warm; wrong matching would break telemetry/events or SSE, but behavior is narrowly scoped with strong test coverage.
Overview
Fixes misrouting of historical telemetry reads when a browser session route is cached. Allowlisting the bare
telemetrysegment sentGET .../telemetry/events(control plane / S2) to the VM, which only serves live SSE attelemetry/stream.Direct-to-VM routing now uses path-prefix allowlist entries (
curl,telemetry/streamby default) with segment-boundary matching viamatchesDirectVMPrefix:telemetry/streamand subpaths route to the VM;telemetry/events, baretelemetry, and similar paths stay on the control plane. Env overrideKERNEL_BROWSER_ROUTING_SUBRESOURCESfollows the same prefix semantics.Regression tests pin stream→VM, events→control plane, boundary cases, and updated defaults.
Reviewed by Cursor Bugbot for commit 161369f. Bugbot is set up for automated code reviews on this repo. Configure here.