Skip to content

fix: don't misroute telemetry/events to the browser VM#126

Merged
IlyaasK merged 2 commits into
mainfrom
fix/telemetry-events-vm-routing
Jun 24, 2026
Merged

fix: don't misroute telemetry/events to the browser VM#126
IlyaasK merged 2 commits into
mainfrom
fix/telemetry-events-vm-routing

Conversation

@IlyaasK

@IlyaasK IlyaasK commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

The direct-to-VM routing allowlist matched on the subresource segment (telemetry), so the new historical GET /browsers/{id}/telemetry/events (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 → failures/wrong data.

Fix (in lib/, Stainless-preserved → durable across regens):

  • Allowlist entries are now full path-prefixes (curl, telemetry/stream), not bare subresources.
  • Segment-boundary matching: telemetry/stream matches telemetry/stream[/...] but NOT telemetry/events or telemetry/streamfoo.
  • Safe by default: anything not allowlisted (incl. future endpoints) → control plane (slower, never misrouted).
  • Regression vector pins stream→VM, events→control-plane, boundary guard, curl→VM, non-allowlisted→control-plane.

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 telemetry segment sent GET .../telemetry/events (control plane / S2) to the VM, which only serves live SSE at telemetry/stream.

Direct-to-VM routing now uses path-prefix allowlist entries (curl, telemetry/stream by default) with segment-boundary matching via matchesDirectVMPrefix: telemetry/stream and subpaths route to the VM; telemetry/events, bare telemetry, and similar paths stay on the control plane. Env override KERNEL_BROWSER_ROUTING_SUBRESOURCES follows 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.

IlyaasK and others added 2 commits June 24, 2026 10:37
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>
@IlyaasK IlyaasK requested a review from archandatta June 24, 2026 17:18
@IlyaasK IlyaasK merged commit bd35fc1 into main Jun 24, 2026
10 checks passed
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.

2 participants