[kernel-1310] browser telemetry - CLI integration#168
Conversation
knownTelemetryTypes was 22 hardcoded strings that would silently drift as new server-side event types shipped. Drop the warning; unrecognized --types values simply produce no matches, which is obvious. knownTelemetryCategories was settableCategories + "system" with no single source of truth. Remove it; validate --categories against settableCategories with an explicit carve-out for "system".
- mention browsers create as a --telemetry surface (not just update) - document partial-update semantics for per-category config - note default --seq behavior (omit to stream from now) - correct the default output example to call out tab-separated format
|
Firetiger deploy monitoring skipped This PR didn't match the auto-monitor filter configured on your GitHub connection:
Reason: PR modifies CLI commands (cmd/kernel) for browser telemetry, not the kernel API endpoints (packages/api/cmd/api/) or Temporal workflows (packages/api/lib/temporal) specified in the filter. To monitor this PR anyway, reply with |
| return false | ||
| } | ||
| return true | ||
| } |
There was a problem hiding this comment.
Function shouldEmit defined but never called in production
Low Severity
The shouldEmit helper function is defined and unit-tested but never called from production code. TelemetryStream duplicates the exact same filtering logic inline (checking in.Categories and in.Types with slices.Contains) instead of calling shouldEmit. This means the tested function and the actual streaming behavior can drift independently — a fix applied to one won't propagate to the other.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 26e6b5b. Configure here.
Sayan-
left a comment
There was a problem hiding this comment.
integration looks good overall!
…eam --categories
- buildTelemetryParam: drop Enabled=true from the per-category branch so the
request goes through the API's merge path. Previously, enabled=true +
browser={...} collided with the enable-all encoding and was treated as a
replace, defaulting unmentioned categories back to on.
- TelemetryStream: validate --categories against the known set (console,
interaction, network, page, system) and error on typos. Mirrors the
config-side validation in parseTelemetryCategories.
- Tests: cover the three wire-encoding shapes for buildTelemetryParam; flip
the create-with-categories test to assert Enabled is unset; flip the
unknown-category stream test to assert error.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 93d3168. Configure here.
| telemetryStream.Flags().StringSlice("categories", []string{}, "Filter by API event category (console,network,page,interaction,system); system covers all monitor_* events") | ||
| telemetryStream.Flags().StringSlice("types", []string{}, "Filter by event type (e.g. network_response,console_error)") | ||
| telemetryStream.Flags().Int64("seq", -1, "Resume stream from sequence number (Last-Event-ID); 0 means from the beginning") | ||
| telemetryStream.Flags().StringP("output", "o", "", "Output format: json for newline-delimited JSON envelopes") |
There was a problem hiding this comment.
Telemetry stream uses inline output flag instead of shared helper
Low Severity
The telemetry stream command defines its output flag inline via StringP("output", "o", "", "Output format: json for newline-delimited JSON envelopes") and validates it with a hand-rolled check (if in.Output != "" && in.Output != "json"). Every other command in cmd/ uses addJSONOutputFlag(cmd) for flag registration and validateJSONOutput(output) for validation. The error message also drifts from the standard format used by ValidateJSONOutput.
Additional Locations (1)
Triggered by learned rule: Use shared JSON output helpers in CLI commands
Reviewed by Cursor Bugbot for commit 93d3168. Configure here.


Adds browser telemetry to the CLI:
kernel browsers create --telemetry=all|off|<list>kernel browsers update <id> --telemetry=all|off|<list>(partial — unspecified categories retain state)kernel browsers telemetry stream <id>with--categories,--types,--seq(Last-Event-ID resume),-o json(NDJSON)Full test matrix → https://gist.github.com/archandatta/f27eb3ea93d58e932b9fd9a7b7b9090f
Essential run steps to validate
Build:
1. Config (create / update / get):
2. Live stream (text + JSON):
3. Filters:
4. Resume from sequence:
5. Validation paths (all should error cleanly):
Cleanup:
/tmp/kernel browsers delete $IDTests
cmd/browsers_telemetry_test.go(go test ./cmd/...)Note
Medium Risk
Enables collection and live streaming of browser activity (network, console, page, etc.); behavior depends on correct API merge semantics for partial
--telemetryupdates.Overview
Adds browser telemetry to the CLI: configure it on session create and update via
--telemetry=all,--telemetry=off, or per-category lists likenetwork=on,page=off(partial updates only touch named categories;all/offreset the whole config).Introduces
kernel browsers telemetry stream <id>for live SSE events with optional--categories,--types,--seq(Last-Event-ID resume), human-readable lines or-o jsonNDJSON via newPrintCompactJSONLine. README documents the commands and flags; unit tests cover parsing, wire encoding, streaming, and create/update wiring.Reviewed by Cursor Bugbot for commit 93d3168. Bugbot is set up for automated code reviews on this repo. Configure here.