Logpoints: log runtime values without modifying source code
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- typescript
- Ambito
- devtools
Direzione di ricerca
Inizia esaminando l’implementazione esistente di feat/logpoints e facendo il rebase sull’attuale main, in particolare sul DevtoolsUtils.ts sottoposto a refactoring. Traccia l’integrazione di CDP Debugger.setBreakpointByUrl e il percorso list_console_messages; il lavoro è completato quando i quattro comandi di logpoint funzionano con la risoluzione dei source-map, superano i reload come descritto e non mettono in pausa la pagina.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem? Please describe.
When an agent needs to know what a page actually does at runtime — which branch
ran, what a value held, in what order events fired — its only real option today is to
edit the source, add console.log, rebuild, reload, read the output, and then remove
the calls again. That has four costs:
- It's a write to the user's codebase to answer a read-only question, and stray
console.logcalls get left behind and committed. - Every probe added or adjusted costs a full rebuild + reload of the frontend
bundle — slowest exactly when the agent is iterating fastest. - It requires source access and a local build. Debugging a deployed environment
(staging, a hosted app, anything the agent didn't build) can't be instrumented at
all. - The reload can destroy the state being observed — which matters a lot for
lifecycle bugs.
@natorion already put this better than I can, in #567 while discussing initScript:
I think its related to having log points, which would be like a specific screw
driver, which is superior to a multitool, if you have to work with screws.
This is a proposal for that screwdriver.
Describe the solution you'd like
Logpoints, as in the DevTools Sources panel: log an expression every time a line
executes, without pausing and without touching the source.
set_logpoint—urlorurlRegex,lineNumber(1-based), optional
columnNumber, andexpressionformatted likeconsole.logarguments and
evaluated in the scope of that line, so locals are accessible.urlaccepts either
a script URL as served, or an original source file (e.g.src/app.ts, suffix
match) resolved through the parsed scripts' source maps — and re-resolved
automatically when a rebuilt bundle loads. Survives reloads and navigations until
removed or the page closes.list_logpoints— what's currently active.remove_logpoint— one by id, or all on the page whenidis omitted.list_scripts— search script URLs and source-map sources, so the agent can
find the file to target.
Output arrives as ordinary console messages via list_console_messages, so no new
output channel is needed.
Logpoints never pause the page. Implementation is CDP
Debugger.setBreakpointByUrl with a condition that is an IIFE calling console.log
and returning false — the same trick the Sources panel uses. Execution is never
suspended.
A concrete case from our own use. An agent was asked why a spinner span forever
after navigating away from our app and pressing Back. It read the code, formed a
hypothesis, then confirmed it by setting three logpoints on authored TypeScript
lines — a navigation module and two engine methods — resolved through source maps into
a webpack chunk, plus pagehide/pageshow with their persisted flags. The captured
sequence showed a bfcache teardown bug: teardown ran on beforeunload, the page was
frozen with persisted=true, the WebSocket was closed by bfcache, and on restore
there was no popstate and no afterNavigate — so the app never re-entered the
page. The decisive evidence was a line that never executed, which is exactly what
reading code cannot give you and what a logpoint shows cheaply. Three probes, no
rebuild, no source change, and one remove_logpoint call to clean up all of them.
Describe alternatives you've considered
initScriptonnavigate_page(#568) — closest existing tool, but the
instrumentation has to be written up front, it only runs at document start so a
probe can't be added mid-session, it needs a reload, and it can't target "line 42 of
this.tsx".evaluate_script— point-in-time only. It can't observe a specific line as it
executes, and it has no access to local scope there.- Editing in
console.logcalls — the status quo, with the four costs above. - Interactive debugging (#407) — related but a different feature. Pausing and
stepping is stateful and blocks the page, which is risky to hand an agent. Logpoints
are non-blocking and need none of that machinery; they arguably deliver much of the
practical value of #407 without the hang risk, and could be a first step toward it.
Additional context
I have this implemented and working:
feat/logpoints
(needs a rebase onto current main, which has since refactored DevtoolsUtils.ts).
Our team has been using it daily for about six weeks; it's changed how our agents
investigate runtime behaviour, and the non-local case in particular — debugging a
hosted environment we can't rebuild — isn't reachable any other way.
Known limitations I'd call out rather than hide: a logpoint placed on a line that runs
during initial script evaluation can miss executions that happen before the source map
is fetched, and a line with no executable code slides to the next valid location (same
as DevTools).
Happy to open a PR if the direction is welcome.
- Lingua principale
- TypeScript
- Stelle
- 59.8k
- Fork
- 4.8k
- Merge medio
- 2g 10h
- PR unite (30g)
- 162
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ChromeDevTools/chrome-devtools-mcp
-
feature
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
ChromeDevTools/chrome-devtools-mcp#3689 ·
I maintainer di solito rispondono entro 1 giorno
-
`evaluate_script` `sourcePath` http(s) URLs are mangled into `file://` pathsForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertacollecting-feedback
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ChromeDevTools/chrome-devtools-mcp#3453 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
collecting-feedback feature
Difficoltà 2/5 Mezza giornata Idoneità per principianti 76/100
ChromeDevTools/chrome-devtools-mcp#3225 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
`wait_for` never finds visible text whose HTML source contains line breaks or repeated spacesApertaconfirmed p3
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ChromeDevTools/chrome-devtools-mcp#2947 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Project Migration: Moving to devtools-frontendForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 1/100
ChromeDevTools/chrome-devtools-mcp#3648 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ChromeDevTools/chrome-devtools-mcp
Issue simili
-
bug engine
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
frostney/GocciaScript#2539 ·
I maintainer di solito rispondono entro 1 giorno
-
Fish Audio Live calls fail to start: `Unknown callback "onNotice"` from @fishaudio/agent-clientForse già presa @NEAL3K l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
milind-soni/OpenMausBot#8345 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ardia-browser/ardia#6142 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Team (channel) avatars render noticeably smaller than agent avatars in the sidebar gridApertabug from-app needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
nightly-labs/openbot#21303 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Lin-arm/GKD_subscription#530 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno