Repository navigation
feat: add mm logs for console errors from pages and the service worker - #110
Open
cryptotavares wants to merge 1 commit into
Open
cryptotavares wants to merge 1 commit into
cryptotavares wants to merge 1 commit into
Conversation
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-15-events
branch
from
November 18, 2026 15:45
5c2279c to
72c8e8b
Compare
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-16-logs
branch
from
November 18, 2026 15:45
704d697 to
19aa455
Compare
This was referenced Nov 18, 2026
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-15-events
branch
from
November 18, 2026 17:05
72c8e8b to
54fe280
Compare
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-16-logs
branch
from
November 18, 2026 17:10
19aa455 to
20224ca
Compare
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-15-events
branch
from
November 18, 2026 17:59
54fe280 to
65ef5ed
Compare
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-16-logs
branch
from
November 18, 2026 18:05
20224ca to
9ef48e3
Compare
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-15-events
branch
2 times, most recently
from
November 18, 2026 18:45
00ddbcc to
d75e3ac
Compare
Records Runtime.consoleAPICalled and Runtime.exceptionThrown from every
page and the Extension service worker (through CdpManager.subscribe)
into the session event buffer. Only 'error' is recorded by default
(console.assert and uncaught exceptions included); 'mm logs configure
--levels' widens it for the session. Text is redacted and cut at 2000
characters. Messages replayed by Runtime.enable (older than the source,
or seen already) are dropped. 'mm logs' reads with --cursor/--since/
--limit/--grep and returns { records, cursor, hasMore, gap, summary }.
cryptotavares
force-pushed
the
cryptotavares/mmcli-p2-16-logs
branch
from
November 18, 2026 18:47
9ef48e3 to
2b3db17
Compare
cryptotavares
marked this pull request as ready for review
November 18, 2026 18:58
This branch has not been deployed
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.
Description
Important
Stacked on #109 (P2-15), which stacks on #107 (P2-28, ready to review on
main). Review those first. This PR targets #109's branch and contains one commit. #111 (P2-17) stacks on it.Release validation needs the console errors of each flow from every Extension context. Most Extension errors come from the MV3 background service worker. A page-level
console.errorhook never sees them, andmm cdpcould not reach the worker before #90.src/events/console-source.ts): aCdpManager.subscribe(feat: deliver CDP events from pages and the service worker #107) toRuntime.consoleAPICalledandRuntime.exceptionThrownon every page and the service worker. Each event becomes a console record in the P2-15 buffer:{ seq, t, target, level, text, location?, uncaught? }.level:error|warning|info|log|debug.console.assertcounts aserror. An uncaught exception iserrorwithuncaught: true.text: the arguments joined on one line, as DevTools does it: object and array arguments render from the CDPpreview({message: 'User rejected', chainId: 1},[1, 2],…when the preview overflowed; a property whose name is sensitive (privateKey,mnemonic,password,token,key,*key/*token,secret,seed,pass,pk, …) renders as[REDACTED], nested previews included;publicKey,sortKey,sourceTokenand similar are allowlisted; a named property of an array printsname: value; only plain objects, arrays and proxies render as a record, other subtypes keep theirdescriptionsuch asUint8Array(2)orMap(1)). The preview name check is the query-parameter check, socodeis redacted too ({code: [REDACTED]}), a safe-side false positive. Format specifiers (%s %d %i %f %o %O %c,%%) are filled from the following arguments, and an uncaught exception value uses the same rendering. URLs are redacted, and the text is cut at 2000 characters.location: 1-basedurl:line:columnof the call or throw.t: the CDP timestamp (epoch ms).target:{ kind: 'page'|'sw', id, url }.erroronly.mm logs configure --levels error,warningwidens it for the session;warnis accepted forwarning.configureaccepts exactly--levels <list>: an extra argument, another flag or a second--levelsis a usage error (exit 2).Runtime.enablereplays console messages Chrome kept (P2-28 finding). Messages older than the subscription, and repeats (same target, timestamp, level, text), are ignored; the replay key is remembered before the level filter, so a widened level does not replay an old message.mm logs [--cursor N | --since <iso|ms>] [--limit N] [--grep <re>]→{ records, cursor, hasMore, gap, summary }.--grepis a case-sensitive JS regex of at most 256 characters (retried withoutuwhen that does not compile); a value that starts with--must be escaped (--grep '\-\-x'); unknown flags and missing values exit 2.Part of the mm CLI v2 effort: ticket
P2-16(Phase 2). Next: P2-17mm network.Breaking changes
None.
Consumer impact
test/e2e/playwright/llm-workflow/tests/llm-workflow/The Extension release-validation skill (Consensys/skills#122) can switch from its page hook to
mm logswhen the command is present.Proof
Real daemon + built CLI. MV3 test extension in headless Chromium (page
console.error, uncaught pageTypeError, workerconsole.errorwith an Infura URL,console.warn,console.log).console.error, uncaught page error, with the righttarget.kindconsole.warnnot recorded by defaultconsole.warnrecorded aftermm logs configure --levels error,warningServiceWorker.stopAllWorkers(0 worker targets) and a wake, new worker errors appear--limit 1paging (3 pages, no duplicates)probe/(headless-Chromium capture + formatter output); a second probe checks preview redaction and subtype descriptionsprobe-r3/, through the daemon and built CLI):['one', 2, privateKey: [REDACTED], label: 'wallet'],{mnemonicPhrase: [REDACTED], pk: [REDACTED], passwd: [REDACTED], seed: [REDACTED]},{publicKey: '0xpub', sortKey: 'abc', sourceToken: '0xtoken'}; no secret value in the outputmm logs configurewith an extra argument or a second--levelsevents clearkeepsseq(11 → 11)startedAtapiKeyvalue in any outputTranscript
Unit tests
New:
src/events/console-source.test.ts(level mapping, argument formatting, truncation, redaction, location, uncaught, replay filter, level config),src/tools/logs.test.ts(cursor/since/limit/grep, invalid grep, configure), CLI routing and schemas.