gemini-cli PR fixes safeJsonStringify mislabeling shared non-circular references as [Circular]

bitwizard25 · ghdev · 2026-11-30

A community PR (#30551) to google-gemini/gemini-cli fixes a subtle bug in safeJsonStringify: the old code tracked every visited object in a global WeakSet without backtracking, so shared non-circular references — like OpenTelemetry's reused endTime arrays and shared histogram boundaries — got serialized as "[Circular]".

The fix replaces the global WeakSet with an ancestor stack in the JSON.stringify replacer that pops back to the current container before cycle checks. Shared DAG references now serialize normally while true cycles still render as [Circular]. The PR includes unit tests covering shared-reference and mixed cycle cases (10/10 passing) plus clean eslint/prettier runs.

Original post →

More from coding & agent

coding & agent channel →