Skip to content

fix(google-meet): serialize caption state without crashing on __soy circular JSON - #140682

Closed
gaoanze888 wants to merge 1 commit into
openclaw:mainfrom
gaoanze888:fix/140455-meet-circular-json
Closed

gaoanze888 wants to merge 1 commit into
openclaw:mainfrom
gaoanze888:fix/140455-meet-circular-json

Conversation

@gaoanze888

Copy link
Copy Markdown

What Problem This Solves

Closes #140455 (Bug 1 — CRITICAL, clean fix).

Google Meet's DOM attaches a __soy property whose object closes a cycle back to the node. The in-call status script (meetStatusScript) stored the live DOM node in each visible caption row for lifecycle tracking, then passed those rows into JSON.stringify via recentTranscript — throwing:

TypeError: Converting circular structure to JSON
  --> starting at object with constructor 'HTMLDivElement'
  |     property '__soy' -> object with constructor '_.AGx'
  --- property 'node' closes the circle

Effect: page.evaluate returns HTTP 500; the plugin can never confirm in-call (inCall reported no despite the agent being a participant), never establishes the audio bridge, and reports manualAction: browser-control-unavailable.

Root Cause

In scrapeCaptions(), each visible caption row is pushed as { ...row, node: region } where region is a live DOM element. When recentTranscript = lines.slice(-5) copies these rows (including the node property) into the serialized payload, JSON.stringify encounters the __soy → node cycle and throws.

Fix

1. Root cause — strip the live DOM node from recentTranscript entries:

- recentTranscript = lines.slice(-5);
+ // Visible caption rows carry a live DOM node for lifecycle tracking;
+ // strip it so JSON.stringify never encounters a __soy circular reference. (#140455)
+ recentTranscript = lines.slice(-5).map((entry) => ({
+   at: entry.at,
+   speaker: entry.speaker,
+   text: entry.text,
+ }));

This keeps only the serializable { at, speaker, text } fields and drops the node, seenAt, etc. The node property remains on the internal captionState.visible array for lifecycle tracking — only the serialized copy is cleaned.

2. Defensive — add a circular-safe replacer to JSON.stringify:

- return JSON.stringify({ ... });
+ return JSON.stringify({ ... }, (function(){
+   var seen = new WeakSet();
+   return function(k, v) {
+     if (v && typeof v === 'object') {
+       if (typeof v.nodeType === 'number') return undefined;  // drop DOM nodes
+       if (seen.has(v)) return undefined;                      // break cycles
+       seen.add(v);
+     }
+     return v;
+   };
+ })());

This is a belt-and-suspenders guard that handles any future edge case where a DOM node or circular reference might sneak into the serialized payload.

Evidence

Regression test

Added a test in google-meet-platform-adapter.test.ts that:

  • Creates a mock caption region with __soy = { node: <self> } (circular reference) and nodeType: 1 (DOM element)
  • Enables caption capture (captureCaptions: true) and in-call state
  • Calls meetStatusScript in a sandboxed VM context
  • Verifies JSON.parse(result) succeeds, inCall is true, and recentTranscript entries have no node property

Before the fix (test catches the bug):

FAIL: TypeError: Converting circular structure to JSON

After the fix:

✓ serializes caption state without crashing on __soy circular references (#140455)
Test Files  1 passed (1)
Tests  6 passed (6)

All existing tests pass

The existing 5 tests (caption capture, audio routing) continue to pass with no regression.

…ircular JSON (openclaw#140455)

Google Meet's DOM attaches a __soy property whose object closes a cycle
back to the node. The in-call status script stored the live DOM node in
each visible caption row for lifecycle tracking, then passed those rows
into JSON.stringify via recentTranscript — throwing
"Converting circular structure to JSON" and leaving inCall unreported.

Two fixes:
1. Root cause: strip the live DOM node from recentTranscript entries
   before serialization, keeping only the serializable {at, speaker,
   text} fields.
2. Defensive: add a circular-safe replacer to JSON.stringify that drops
   DOM nodes (nodeType check) and breaks cycles (WeakSet).

Adds a regression test with a mock __soy circular reference.
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 6, 2026, 10:59 PM ET / September 7, 2026, 02:59 UTC.

ClawSweeper review

What this changes

The PR removes live browser nodes from Google Meet caption status output, adds a defensive JSON serialization guard, and tests a circular-reference caption fixture.

Merge readiness

⛔ Blocked before merge - 2 items remain

This remains a useful, focused fix: current main and v2026.9.2 retain the failing serialization path. No blocking code defect was found, but the submitted evidence does not yet demonstrate the patched behavior in a real Meet session.

Priority: P1
Reviewed head: 04f5d678f3169f5f0fa1d692db51eac44ce6b425

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and source-supported, with useful regression coverage, but real after-fix behavior proof remains a merge gate.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The changed browser status script is exercised only through a mocked VM fixture. Before merge, add redacted terminal output, logs, or a recording with diagnostics from the patched plugin in a real caption-active Meet session showing successful status JSON, inCall detection, and caption text. Screenshots or video are welcome when they show those diagnostics; redact private meeting URLs, IP addresses, credentials, and participant details. Updating the PR body should trigger re-review automatically; otherwise ask a maintainer to comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The changed browser status script is exercised only through a mocked VM fixture. Before merge, add redacted terminal output, logs, or a recording with diagnostics from the patched plugin in a real caption-active Meet session showing successful status JSON, inCall detection, and caption text. Screenshots or video are welcome when they show those diagnostics; redact private meeting URLs, IP addresses, credentials, and participant details. Updating the PR body should trigger re-review automatically; otherwise ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed 8 items Verified introduced change: The pinned merge-base-to-head diff contains the caption-field projection, JSON replacer, and regression test; unrelated endpoint drift is not part of this PR.
Current main still exposes live nodes: Caption scraping stores node references on visible entries; status combines committed and visible entries and assigns lines.slice(-5) directly to recentTranscript before ordinary JSON.stringify.
Latest supplied release retains the mechanism: The v2026.9.2 source contains both the live-node caption entries and the unprojected recentTranscript assignment, so the supplied latest release does not contain this repair.
Findings None None.
Security None None.

How this fits together

The Google Meet plugin runs a browser script to collect meeting status and captions. The returned JSON feeds meeting health checks, which determine whether the participant is in the call and ready for audio.

flowchart LR
  A[Meet page and captions] --> B[Browser status script]
  B --> C[Page-owned caption lifecycle]
  C --> D[Plain caption fields]
  D --> E[Serialized meeting health]
  E --> F[Plugin status and audio readiness]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The changed browser status script is exercised only through a mocked VM fixture. Before merge, add redacted terminal output, logs, or a recording with diagnostics from the patched plugin in a real caption-active Meet session showing successful status JSON, inCall detection, and caption text. Screenshots or video are welcome when they show those diagnostics; redact private meeting URLs, IP addresses, credentials, and participant details. Updating the PR body should trigger re-review automatically; otherwise ask a maintainer to comment @clawsweeper re-review.
  • Complete next step (P2) - Add real after-fix Meet status proof and replace the closing reference to google-meet 2026.9.2: agent voice broken on current Meet — circular-JSON in-call crash + audio-routing verification #140455 with a non-closing reference because its audio-routing failures remain unresolved.
Agent review details

Security

None.

PR surface

Source +6, Tests +93. Total +99 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 8 2 +6
Tests 1 93 0 +93
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 101 2 +99

Review metrics

None.

Root-cause cluster

Relationship: partial_overlap
Canonical: #140455
Summary: This PR addresses the caption serialization failure in the canonical report, which also contains separate unresolved audio-routing and bridge-start symptoms.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep DOM references inside caption lifecycle state and export only the established caption fields, while preserving separate tracking for the remaining audio-routing failures.

Do we have a high-confidence way to reproduce the issue?

Yes, source establishes a precise trigger: an active caption row with a circular DOM property reaches JSON.stringify through recentTranscript. The reporter supplies a matching failure trace; this read-only review did not execute code.

Is this the best way to solve the issue?

Yes, projecting the existing caption fields at the serialization boundary is a narrow repair and matches the sibling transcript export pattern. The generic replacer is unnecessary for that repair, but no reachable correctness defect from it was established.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 022daecee1ab.

Labels

Label changes:

  • add P1: The reported serialization failure prevents in-call confirmation and blocks an existing Google Meet agent voice workflow on the supplied current release.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The changed browser status script is exercised only through a mocked VM fixture. Before merge, add redacted terminal output, logs, or a recording with diagnostics from the patched plugin in a real caption-active Meet session showing successful status JSON, inCall detection, and caption text. Screenshots or video are welcome when they show those diagnostics; redact private meeting URLs, IP addresses, credentials, and participant details. Updating the PR body should trigger re-review automatically; otherwise ask a maintainer to comment @clawsweeper re-review.

Label justifications:

  • P1: The reported serialization failure prevents in-call confirmation and blocks an existing Google Meet agent voice workflow on the supplied current release.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The changed browser status script is exercised only through a mocked VM fixture. Before merge, add redacted terminal output, logs, or a recording with diagnostics from the patched plugin in a real caption-active Meet session showing successful status JSON, inCall detection, and caption text. Screenshots or video are welcome when they show those diagnostics; redact private meeting URLs, IP addresses, credentials, and participant details. Updating the PR body should trigger re-review automatically; otherwise ask a maintainer to comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a redacted real Meet status capture from the patched plugin while captions are active.
  • Use a non-closing reference to the broader linked report so its unresolved audio-routing work remains tracked.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@gaoanze888

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High-priority user-facing bug, regression, or broken workflow. plugin: google-meet rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

google-meet 2026.9.2: agent voice broken on current Meet — circular-JSON in-call crash + audio-routing verification

1 participant