Skip to content

chore: remove debug - #2285

Closed
Lightning00Blade wants to merge 3 commits into
mainfrom
remove-debug
Closed

Lightning00Blade wants to merge 3 commits into
mainfrom
remove-debug

Conversation

@Lightning00Blade

@Lightning00Blade Lightning00Blade commented Jul 2, 2026 •

Copy link
Copy Markdown
Collaborator

Removes the debug lib and replaces it with custom logic for the FileLog and Node native logger for the other cases.

@Lightning00Blade
Lightning00Blade marked this pull request as ready for review July 20, 2026 10:07

@OrKoN OrKoN left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change the data logged does not seem to include logging metadata (e.g.,2026-05-07T06:21:39.089Z mcp:log). Only the content is logged. Btw I noticed that the file traffic was already missing CDP logs. Any thoughts on how to fix it?

@Lightning00Blade

Copy link
Copy Markdown
Collaborator Author

Closing as we have a better way to do it on the latest Puppeteer version

pull Bot pushed a commit to FairyWorld/ai_chrome-devtools-mcp that referenced this pull request Aug 12, 2026
…swer (ChromeDevTools#2477)

`getContext()` awaits `updateRoots()` while `ToolHandler.handle()` holds
the tool mutex, so a client that negotiated `roots` and never answers
blocks every tool for the SDK's 60s default.

This bounds the one awaited listing rather than `updateRoots()` as a
whole, since the other two call sites are already fire-and-forget and
bounding them would only throw away roots a slow client was about to
send. The last listing is then kept and handed to each new `McpContext`.
Roots are client state rather than browser state, so a reconnect does
not invalidate them, and real changes still arrive through
`roots/list_changed`.

Both halves turn out to be needed, which took me a couple of tries to
see. Bound every listing and a client answering in 8s never gets roots
at all, because each of its listings times out. Leave the background
ones unbounded but keep no cache and they are lost anyway, since that
listing can land while `context` is still undefined and
`context?.setRoots()` drops it. Either way, file writes stay confined to
the temp directory for the rest of the session, where today that client
works and merely waits.

It does mean a client declaring `roots` without `listChanged` can see
the previous list on its first call against a new context, until the
background refresh lands.

Tests for each half:

- `does not block tools if the client never answers roots/list` fails on
`main` and passes here. It raises the client-side timeout above the SDK
default so the stall surfaces as the assertion rather than as a test
timeout

```
✖ does not block tools if the client never answers roots/list (60902.121334ms)
  AssertionError [ERR_ASSERTION]: list_pages took 60438ms, expected the bounded roots request to settle well before the 60s SDK default
```

- `still applies roots from a client slower than the bound` passes on
`main` and here, and fails if the bound covers every listing rather than
the awaited one

`npm run test` shows four failures here, but the same four fail on
unmodified `main`.

ChromeDevTools#2285 changes the `catch` inside `updateRoots()` that this rewrites, so
whichever lands second needs a rebase. Happy to do it if this goes last.

Fixes ChromeDevTools#2476

Co-authored-by: Natasha Gorshunova <[email protected]>
@Lightning00Blade
Lightning00Blade deleted the remove-debug branch September 2, 2026 12:31
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