8000 feat: capture console and browser logs per tab by adeelahmad · Pull Request #7 · adeelahmad/Tether · GitHub
[go: up one dir, main page]

Skip to content
< 8000 div style="--spacing:var(--spacing-none)" class="prc-PageLayout-PageLayoutRoot--KH-d" data-component="SplitPageLayout" data-has-sidebar="true">

feat: capture console and browser logs per tab - #7

Merged
adeelahmad merged 1 commit into
mainfrom
claude/console-logs-j7vjwa
Oct 11, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/console-logs-j7vjwa

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

What

Every tab Tether drives now keeps its recent console.* output, uncaught exceptions and browser log entries (failed requests, security warnings), readable three ways:

  • Control API: GET /tether/v1/tabs/{id}/logs?after=N&level=warning returns {"entries":[…],"next":N}. Poll with after=next to read only new entries.
  • WebDriver: driver.get_log("browser") (POST /session/{id}/se/log and /log, plus /log/types). It works like ChromeDriver: each entry is returned once per session, with levels DEBUG/INFO/WARNING/SEVERE, and no goog:loggingPrefs is needed.
  • Core: core.Core.Logs(session, after, minLevel) (entries, next) gives the MCP face something to read from. It skips the tab lock, so logs can be read while a request is running.

cdp enables Runtime and Log on attach and keeps a per-tab ring buffer of Runtime.consoleAPICalled, Runtime.exceptionThrown and Log.entryAdded. The buffer is sized by --console-buffer / TETHER_CONSOLE_BUFFER (default 1000, 0 turns capture off and leaves those domains disabled). Each entry is capped at 8 KiB, and the event subscription is dropped when its target is destroyed or detached.

Why

Console log capture was on the v1 roadmap. Agents and Selenium scripts need to see page errors.

How tested

  • make check equivalents: gofmt, go vet (with and without integration tag), golangci-lint v2.5.0 (0 issues), go test -race ./...
  • make test-integration against headless Chromium. The new TestConsoleLogs covers console.log/warn/error, an uncaught exception, a 404 resource entry, level filtering, the after cursor, and WebDriver se/log + log with no repeats.
  • Docs updated: README (control API + flag + roadmap), docs/WEBDRIVER.md, docs/ARCHITECTURE.md, SECURITY.md threat model, CHANGELOG

Security

  • Logs are only reachable through the authenticated listener and never go to Tether's own logs. SECURITY.md now covers two risks: pages can print secrets to the console, and Runtime.enable can be detected by anti-bot scripts. --console-buffer 0 addresses both.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LtFFUWfDTzh1KEm5aPavz3


Generated by Claude Code

Each attached tab buffers Runtime.consoleAPICalled, Runtime.exceptionThrown
and Log.entryAdded events in a ring (--console-buffer, default 1000, 0
disables). Entries carry a per-tab sequence number so faces can read only
what is new.

- core.Core.Logs(session, after, minLevel) for every face (MCP next)
- GET /tether/v1/tabs/{id}/logs?after=&level= on the control API
- WebDriver get_log("browser") via /se/log and /log, ChromeDriver-style

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LtFFUWfDTzh1KEm5aPavz3
@adeelahmad adeelahmad self-assigned this Oct 11, 2026
@adeelahmad
adeelahmad merged commit 2730101 into main Oct 11, 2026
16 of 17 checks passed
adeelahmad pushed a commit that referenced this pull request Oct 11, 2026
Resolves conflicts with #7 (console logs): Tab gets both Guard and Logs,
the API keeps the policy routes and adds /tabs/{id}/logs, and docs list
both features. Also makes TestConsoleLogs tolerate a late favicon 404
between the two WebDriver log reads (it asserted the second read was
empty; it should assert no entry repeats).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X9CEjRcHsJmgWdtz6ZTKsk
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

0