Add browser telemetry reads and debugging guidance#119
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
1b23fd3 to
7f98f1a
Compare
|
I know this is wip but fly by initial reactions from opus Overall looking good + nothing blocking. One field escapes the compaction. It strips Worth a think: the empty-result logic is doing a lot. Three statuses ( Worth a think: standalone tool vs. an action on |
98eb0a9 to
033119e
Compare
- Default since to the epoch instead of fetching created_at: the archive cannot predate the session, so the reads are equivalent and the common path saves a browser lookup. - Fetch the browser only for the terminal-empty capture-state hint, catch only 404 (deleted/unknown session), and let other errors propagate like sibling actions. - Drop the response status field: it collided with the list status param and duplicated items/has_more plus the note. - Reword the filtered-empty disabled hint to steer toward adjusting the filter rather than enabling capture and retrying. - Fix the debug prompt: a session with capture off has an empty telemetry config in GET responses, not a null field. - Document why compact single-line JSON is used over the pretty-printed response helpers.
Returning the un-awaited promise from the get_telemetry case let API failures (e.g. 404 for an unknown session) escape the surrounding try/catch as unhandled rejections instead of resolving to a tool error response. Caught by exercising the handler against production.
b864d28 to
94477c7
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f4cc8d3. Configure here.
An empty read with since at or before the session's creation covers the whole archive, so it now gets the definitive nothing-is-archived note instead of the broaden-the-window one. Uses the browser already fetched for the capture-state hint; duration-style since values and deleted sessions keep the windowed wording.
An unfiltered ascending read starts at session creation, which baits agents into paging oldest-first through a long archive when the failure they want is at the end. Attach a note to such pages while has_more is true pointing at order=desc, and say in the order description when desc is the better read. Filtered or time-bracketed reads are deliberate and stay note-free.
Addressed all three.
|

summary
get_telemetryaction tomanage_browsersfor archived browser telemetry: works for active and deleted sessions, including events captured before telemetry was disabledsince/until), ascending/descending reads, and opaque offset pagination;since+order=descis rejected up front with a clear errorbody,headers,post_data, and screenshotpng, plus any data field over 8 KiB; report every removal inomitted_fieldsand keepseq, rawts(µs), readabletime,source, andtruncatedstatusparam): empty filtered pages with more data tell the caller to continue; terminal empty reads say whether anything is archived (an explicitsinceat or before session creation counts as a full-session read); current capture state is appended to the noteorder=desc, and theorderdescription says when desc is the better readmanage_browserstelemetry category descriptions (default bundle gotcha, per-category definitions)debug-browser-sessionprompt: telemetry-first heuristics instead of a fixed script, the opt-in/archive-vs-config gotcha, and the shared event catalog (defined once insrc/lib/mcp/telemetry.ts, reused verbatim)The required SDK update and pagination migrations landed in #122; this branch is rebased onto
main.live verification (production)
Exercised the actual tool handlers end-to-end against production: created a browser with console/network/page telemetry via
manage_browsers, drove a navigation, an intentional console error, and a failing page load, then verified: full-session default reads,omitted_fieldscompaction, a category filter isolating the plantedconsole_error(51.8KB → 1KB),order=desc, filter misses,since+descrejection, current-disabled hints, never-enabled sessions, and post-deletion reads.verification
bun install --frozen-lockfilebunx tsc --noEmitpackages/api/cmd/api/api/telemetry.go,browsers.go)The repository does not have an automated test suite.
Note
Medium Risk
New read path on
manage_browsersand richer telemetry create/update docs affect agent debugging workflows; behavior is read-only for telemetry but touches session diagnosis flows many agents rely on.Overview
Adds
get_telemetrytomanage_browsersso agents can read archived browser telemetry for active or deleted sessions, with category filters,since/until,asc/descordering, and opaquenext_offsetpagination. Unfiltered ascending reads default to the full session (epochsinceinstead of the API’s five-minute window);since+order=descis rejected with a clear error. Responses compact event payloads (drop heavy fields, cap field size, surfaceomitted_fields) and usenotetext for empty results and to steer away from paging long archives oldest-first.Introduces shared
src/lib/mcp/telemetry.ts(category list + event catalog) reused in tool schemas and thedebug-browser-sessionprompt, which is reworked to be telemetry-first (opt-in capture vs archive, enable debug categories viaupdate). README and create/update telemetry param descriptions clarify defaults and debug categories.Reviewed by Cursor Bugbot for commit 260708e. Bugbot is set up for automated code reviews on this repo. Configure here.