fix: truncate long urls in concise network request output - #2513
Merged
OrKoN merged 2 commits intoSep 1, 2026
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
ZayanKhan-12
force-pushed
the
fix/truncate-network-urls
branch
from
August 8, 2026 21:46
1837d22 to
0cb60cf
Compare
OrKoN
reviewed
Aug 10, 2026
OrKoN
self-requested a review
August 21, 2026 19:08
Resolves the existing TODO in NetworkFormatter. Long URLs (especially data: URLs, which can be tens of kilobytes) bloated every line of the token-heavy list_network_requests output. Reuse the file's existing getSizeLimitedString helper to cap URLs at 150 characters in the concise one-line format only; the detailed view and the structured JSON content keep the full URL.
OrKoN
force-pushed
the
fix/truncate-network-urls
branch
from
September 1, 2026 12:35
78994b5 to
e4eaf36
Compare
OrKoN
approved these changes
Sep 1, 2026
OrKoN
enabled auto-merge
September 1, 2026 12:36
OrKoN
force-pushed
the
fix/truncate-network-urls
branch
from
September 1, 2026 13:07
e4eaf36 to
9fc2def
Compare
Merged
via the queue into
ChromeDevTools:main
with commit Sep 1, 2026
552c870
36 of 40 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements the existing
// TODO truncate the URLinsrc/formatters/NetworkFormatter.ts: URLs in the concise one-line network request format are now capped at 150 characters, with the file's existinggetSizeLimitedStringhelper appending the same... <truncated>marker already used for request/response bodies.Why
list_network_requestsemits one concise line per request, so a single page with a fewdata:URLs (which can be tens of kilobytes each) can blow up the tool output by orders of magnitude. Truncating in the concise format keeps list output token-friendly while losing nothing that matters for identifying a request.Scope is deliberately narrow — only
convertNetworkRequestConciseToStringchanges:## Request <url>heading) still shows the full URL, andtoJSON()/ structured content still carries the full URL,so nothing that needs the complete URL is affected. (Concise redirect-chain lines inside the detailed view use the same function and are truncated too, which keeps that list compact as well.)
Limit rationale
150 characters keeps origin + path + the start of the query string intact for virtually all real-world URLs (typical URLs are well under 100 characters), while capping pathological
data:/blob payloads. It reuses the existinggetSizeLimitedStringpattern with a newURL_CONTEXT_SIZE_LIMITconstant next toBODY_CONTEXT_SIZE_LIMIT.Before / after
Before:
After:
Short URLs are unchanged.
Testing
npm run build— passnpm run test:no-build— pass (all tests, exit 0)npm run check-format— pass (eslint + prettier)Added three cases to
tests/formatters/NetworkFormatter.test.ts:... <truncated>marker (andtoJSON()keeps the full URL),data:URL is truncated,No existing snapshots changed.
🤖 Generated with Claude Code