Skip to content

fix(ui): prevent Node-only imports from breaking browser tests - #190089

Merged
vincentkoc merged 1 commit into
mainfrom
fix-transcript-browser-ownership-20261101
Nov 1, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix-transcript-browser-ownership-20261101

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes: Control UI browser suites fail during module loading because shared transcript helpers import a Node-only proxy API.

User Impact

Developers can run the affected browser suites while transcript persistence retains its existing JSON and payload-sharing behavior.

Why This Change Was Made

Move normalization into a Node-only module and migrate its static and dynamic callers. Browser-safe envelope cloning and ownership tracking retain one shared owner; the normalization algorithm is unchanged.

Evidence

  • Both existing Chromium regression files failed on the unchanged base with node:util/types.isProxy; both now pass (30 tests).
  • Node owner and consumer contracts: 222 tests; persistence integration: 34 tests; moved lint-suppression inventory: 14 tests. Includes native JSON/proxy behavior, backing-string retention, persisted graph sharing, and prompt-prefix stability.
  • Dynamic measurement entry points pass a one-operation smoke check in their default, count, and owner modes; no performance comparison is claimed.
  • Type-aware lint, format/diff checks, and pnpm tsgo:core pass.
  • Maintained synthetic-Gateway boot captures pass on the frozen base and candidate for New Session and Chat. The candidate reaches one fewer shared module; the generated boot manifest is refreshed. pnpm ui:build passes its budget checks.
  • Fresh local Claw review of the exact committed range found no actionable correctness or security issues; security review cleared. Runtime evidence above was run separately.

Live-provider turns were outside this import-boundary proof.

@vincentkoc vincentkoc self-assigned this Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 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.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui scripts Repository scripts agents Agent runtime and tooling size: M labels Nov 1, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 1, 2026 04:57
@vincentkoc
vincentkoc enabled auto-merge (squash) November 1, 2026 05:01
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR separates Node-only transcript normalization from browser-safe payload ownership and updates normalization callers.

Example: Chromium imports the transcript media reader for a message containing /synthetic/attachment.png.

  • Before: The import chain reaches node:util/types.isProxy and fails before the browser suite runs.
  • After: The media reader loads browser-safe ownership helpers without importing the Node normalizer.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The browser-boundary repair is useful and preserves the storage algorithm, but a concrete frozen-baseline benchmark regression requires correction.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its body reports 30 Chromium regressions and base/candidate synthetic-Gateway boot captures, but supplies no linked runtime artifact.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Developers cannot run affected Control UI browser suites because module loading reaches a Node-only API.
Reason: The maintainer-authored direction restores a supported browser boundary without changing defaults, configuration, storage format, or payload-sharing semantics.

Regression provenance

Possible regression — probable (reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep open: this maintainer-authored PR repairs a current browser import failure, but its benchmark cutover breaks frozen-baseline measurements.

Priority: P2
Reviewed head: 5272fdf79069fbd23de3572b69395a34b15b4c8b

Before merge

  • Preserve frozen-baseline measurements across the normalizer split (P2) - Using the documented --owners-dir mode with the parent versions of the runtime owners now fails before measurement. Those frozen callers import normalization from transcript-json.ts and never load transcript-json-normalize.ts, but the newly added owner must satisfy owners.every(owner => owner.loaded) at lines 132–134. The run therefore throws "An owner was not loaded"; counts and owner modes also select instrumentation only by the new filename. Select the active normalizer from the supplied snapshot and validate/instrument that owner so both parent and candidate arms remain measurable.
  • Explain or restore the original intent of Frozen-owner append measurements - 3186665: Compare parent and candidate append owners through repository-relative frozen overlays while recording source hashes and normalization work.

Findings

  • [P2] Preserve frozen-baseline measurements across the normalizer split — scripts/perf/transcript-append-normalization-measure.ts:61-63

Provenance

  • Frozen-owner append measurements changes intended behavior without addressing why it exists (3186665: Compare parent and candidate append owners through repository-relative frozen overlays while recording source hashes and normalization work.)

Tests

  • Missing end-to-end proof: The reported Chromium regressions and synthetic-Gateway captures are not accompanied by inspectable shipped-route runtime output.
Agent review details

How this fits together

Browser transcript readers consume shared media helpers, while server-side append owners normalize and seal payloads before persistence; both reuse the same ownership registry.

flowchart LR
A[Browser transcript reader] --> B[Shared media helpers]
B --> C[Payload ownership registry]
D[Session append owner] --> E[Node JSON normalizer]
E --> C
E --> F[Transcript persistence]
Loading

Technical review

Best possible solution:

Keep the shared browser-safe ownership registry and make the benchmark select and instrument the normalizer actually present in each frozen snapshot.

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

Source traces browser message extraction through media-facts into the Node-only normalizer on main, matching the reported Chromium import failure; this read-only review executed no target code.

Is this the best way to solve the issue?

Moving normalization preserves one ownership registry and the existing serialization behavior, but the dynamic benchmark must continue accepting frozen owners from before the split.

Full review comments:

  • [P2] Preserve frozen-baseline measurements across the normalizer split — scripts/perf/transcript-append-normalization-measure.ts:61-63
    Using the documented --owners-dir mode with the parent versions of the runtime owners now fails before measurement. Those frozen callers import normalization from transcript-json.ts and never load transcript-json-normalize.ts, but the newly added owner must satisfy owners.every(owner => owner.loaded) at lines 132–134. The run therefore throws "An owner was not loaded"; counts and owner modes also select instrumentation only by the new filename. Select the active normalizer from the supplied snapshot and validate/instrument that owner so both parent and candidate arms remain measurable.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 2952110b2a14.

Provenance checked

  • Transcript JSON normalization keeps the original intent (e40ed06: Preserve JSON storage semantics while sharing admitted immutable payloads rather than deep-copying them.)
  • Backing-string ownership keeps the original intent (bb46fa6: Detach retained string backing storage so small transcript strings do not retain discarded tool output.)
  • Envelope ownership propagation keeps the original intent (2992c0b: Share already-admitted immutable children across replacement envelopes while keeping the envelope writable.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/config/sessions/transcript-json.test.ts
  • node --expose-gc --import ./scripts/tsx.mjs scripts/perf/transcript-append-normalization-measure.ts --scratch "$PROOF_SCRATCH/runtime" --output "$PROOF_SCRATCH/base-timing.json" --owners-dir "$PROOF_SCRATCH/base-owners" --mode timing --operations 1
  • node --expose-gc --import ./scripts/tsx.mjs scripts/perf/transcript-append-normalization-measure.ts --scratch "$PROOF_SCRATCH/runtime" --output "$PROOF_SCRATCH/base-counts.json" --owners-dir "$PROOF_SCRATCH/base-owners" --mode counts --operations 1
  • node --expose-gc --import ./scripts/tsx.mjs scripts/perf/transcript-append-normalization-measure.ts --scratch "$PROOF_SCRATCH/runtime" --output "$PROOF_SCRATCH/base-owner.json" --owners-dir "$PROOF_SCRATCH/base-owners" --mode owner --operations 1
  • node --expose-gc --import ./scripts/tsx.mjs scripts/perf/transcript-append-normalization-measure.ts --scratch "$PROOF_SCRATCH/runtime" --output "$PROOF_SCRATCH/head-timing.json" --mode timing --operations 1

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 2992c0b adds src/config/sessions/transcript-json.ts:13 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2992c0b8dd4f; files: src/config/sessions/transcript-json.ts)
  • Vincent Koc: Raw commit 6ee2a38 adds ui/config/control-ui-boot-modules.json:165 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6ee2a3846eb1; files: ui/config/control-ui-boot-modules.json)

PR surface

Source +12, Tests -1, Other +2. Total +13 across 20 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 150 138 +12
Tests 9 11 12 -1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 6 12 10 +2
Total 20 173 160 +13

Labels

Label changes:

  • add P2: The established failure blocks browser test imports, and the introduced defect affects developer benchmark measurements; a shipped application outage is not established.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: The established failure blocks browser test imports, and the introduced defect affects developer benchmark measurements; a shipped application outage is not established.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 1, 2026, 1:13 AM ET / 05:13 UTC.

@vincentkoc
vincentkoc merged commit c2bbb10 into main Nov 1, 2026
234 checks passed
@vincentkoc
vincentkoc deleted the fix-transcript-browser-ownership-20261101 branch November 1, 2026 05:22
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

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

Labels

agents Agent runtime and tooling app: web-ui App: web-ui P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant