Skip to content

swConsole [Circular] false positive for shared (acyclic) refs corrupts bex_ext_console output #119

Description

@BitHighlander

Found in pre-merge review of #117 (low severity).

Where

chrome-extension/src/background/swConsole.tsrender() JSON.stringify replacer (~line 48).

Problem

The cycle guard adds objects to a WeakSet on visit but never removes them when a branch completes (globally-seen vs ancestor-path). A non-circular object referenced from two sibling properties is falsely serialized as "[Circular]".

Repro: console.log({ a: cfg, b: cfg }) or console.log([obj, obj]) in the background SW → second occurrence renders "[Circular]".

install() runs at import and patches console.*, and render() runs on every object arg, so this reaches the bex_ext_console agent deterministically — corrupting the exact diagnostic data an agent trusts to debug the extension.

Fix sketch

Track the ancestor path, not a global seen-set: remove the object from the set when its branch finishes (or use a depth-limited/path-based approach).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions