Skip to content

test(ui): guard browser transcript media imports - #190086

Merged
steipete merged 5 commits into
mainfrom
fix/transcript-browser-ownership
Nov 1, 2026
Merged

steipete merged 5 commits into
mainfrom
fix/transcript-browser-ownership

Conversation

@steipete

@steipete steipete commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A Node-only import broke the browser transcript media entry point. The runtime repair has already landed in #190089; this PR adds a focused browser regression test for that boundary.

Why This Change Was Made

The test imports the real readTranscriptMediaEntries entry point in the browser runner and checks extraction of a persisted synthetic attachment. It catches the Node-only module-graph failure before a broader E2E suite fails during import. There are no production changes.

Evidence

  • The browser import failure reproduced before fix(ui): prevent Node-only imports from breaking browser tests #190089. The new media-entry regression passes against its implementation (1/1).
  • Fresh independent P0–P2 review of this final scoped diff found no actionable issues. The browser-runner and production source were not included in that review's evidence bundle; targeted runtime proof covers that boundary.
  • An earlier revision also changed the cross-tab sidebar fixture. That revision still failed Cross-tab sidebar deletion invalidation > retires chat:deleted-snapshot once per tab without wiping the sidebar across churn and reload in run 41277413048 (two writes instead of at most one). The original test passed on scheduled main 41273079982 and the full picker run 41277424144. The fixture rewrite is removed entirely; the original test and all its assertions are unchanged. No inherited-failure exception or production-race fix is claimed.
  • Full ci:full run 41278249869 passed on final one-file head f38ad3170eb5d905d5587009742de665ce00d8d1. Earlier successful or failing runs remain historical evidence, not proof of this head.

Final diff: one new 20-line browser test. Production LOC unchanged; test LOC 0→20. No dependency, visual change, baseline exception, or test assertion weakening.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T05:35:28.437392Z 85b5372 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui agents Agent runtime and tooling size: S labels Nov 1, 2026
@steipete
steipete enabled auto-merge (squash) November 1, 2026 04:35
@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. labels Nov 1, 2026
@steipete
steipete disabled auto-merge November 1, 2026 04:46
@clawsweeper

clawsweeper Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR extracts transcript payload ownership into a dependency-free module so browser media readers avoid Node-only normalization imports.

Example: Control UI reads a user message containing /synthetic/attachment.png.

  • Before: The browser import chain reaches node:util/types and fails before rendering.
  • After: The media reader imports the dependency-free ownership module and returns the attachment entry.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused extraction has clear value and preserves storage behavior, but verified missed consumers and an incomplete wrapper inventory block merge.
Proof confidence 🦐 gold shrimp (3/6) The supplied maintainer-authored classification exempts this PR from the ordinary contributor proof gate; available evidence is reported Chromium and normalization test output, while inspected linked screenshots cover a different change.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Affected Control UI routes fail to load when browser imports reach a Node-only transcript module.
Reason: The maintainer-authored direction restores browser compatibility while preserving the existing transcript ownership contract.

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 PR repairs a current-main browser import regression, but two incomplete import-cutover changes cause concrete CI failures.

Priority: P1
Reviewed head: ee189d13a5e8584d55e8989a7b55c9b11f2c2559

Before merge

  • Migrate the remaining performance-script ownership imports (P2) - Removing the exported ownership query breaks scripts/perf/prompt-cache-observation-measure.ts, hook-isolation-measure.ts, and replay-history-measure.ts, which still import it from transcript-json.js. The existing request-observer regression launches the first script and now fails during ESM instantiation with a missing-export SyntaxError, as recorded by the reviewed-head CI annotation. Import the query from transcript-payload-ownership.js in all three scripts while keeping normalization imports in their existing owner.
  • Include the extracted module in the trusted wrapper inventory (P2) - The new runtime import is reachable from files listed in scripts/pr-lib/wrapper-components.txt, but the new module is absent from that inventory. scripts/pr archives only its trusted component closure, so extracted wrappers lack this dependency. Reviewed-head CI confirms both the missing inventory entry and the unresolved import in the extracted tree. Add src/config/sessions/transcript-payload-ownership.ts to the existing inventory.

Findings

  • [P2] Migrate the remaining performance-script ownership imports — src/config/sessions/transcript-json.ts:3-6
  • [P2] Include the extracted module in the trusted wrapper inventory — src/config/sessions/transcript-json.ts:3-6

Tests

  • Missing end-to-end proof: No shipped Control UI route-load trace for this head is supplied; the reported Chromium proof exercises browser test imports.
Agent review details

How this fits together

Control UI transcript readers consume shared media facts; server-side transcript normalization establishes immutable payload ownership that cloning and replay consumers reuse.

flowchart LR
  A[Control UI transcript reader] --> B[Shared media facts]
  B --> C[Payload ownership registry]
  D[Node JSON normalizer] --> C
  E[Transcript append] --> D
  C --> F[Envelope cloning and replay]
Loading

Technical review

Best possible solution:

Keep one dependency-free ownership registry, migrate the remaining script consumers, and include its module in the trusted wrapper inventory.

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

Current-main source traces message-extract.ts through media-facts.ts into node:util/types; the body reports the corresponding Chromium import failure, but this review ran no target code.

Is this the best way to solve the issue?

Extracting the existing registry is the smallest complete architectural fix: it preserves admission and sharing without shims or duplicate state, provided every consumer and extraction inventory is migrated.

Full review comments:

  • [P2] Migrate the remaining performance-script ownership imports — src/config/sessions/transcript-json.ts:3-6
    Removing the exported ownership query breaks scripts/perf/prompt-cache-observation-measure.ts, hook-isolation-measure.ts, and replay-history-measure.ts, which still import it from transcript-json.js. The existing request-observer regression launches the first script and now fails during ESM instantiation with a missing-export SyntaxError, as recorded by the reviewed-head CI annotation. Import the query from transcript-payload-ownership.js in all three scripts while keeping normalization imports in their existing owner.
    Confidence: 1
  • [P2] Include the extracted module in the trusted wrapper inventory — src/config/sessions/transcript-json.ts:3-6
    The new runtime import is reachable from files listed in scripts/pr-lib/wrapper-components.txt, but the new module is absent from that inventory. scripts/pr archives only its trusted component closure, so extracted wrappers lack this dependency. Reviewed-head CI confirms both the missing inventory entry and the unresolved import in the extracted tree. Add src/config/sessions/transcript-payload-ownership.ts to the existing inventory.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8662c66b9050.

Provenance checked

  • Transcript ownership and envelope cloning keeps the original intent (2992c0b: Preserve immutable child sharing across replacement envelopes while retaining byte fidelity, serialization ordering, and mutable-view isolation.)
  • Root-only ownership bookkeeping keeps the original intent (717509e: Retain immutable payload roots rather than every descendant, preserving aliases through temporary admission state.)
  • Media ownership propagation keeps the original intent (3186665: Avoid recopying admitted children during media canonicalization without bypassing raw ingress normalization.)
  • Hook isolation ownership queries keeps the original intent (4e62be1: Skip redundant scans of transcript-owned JSON while retaining isolation checks for unowned values and cloned snapshots.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/agents/embedded-agent-runner/prompt-cache-request-observer.test.ts
  • pnpm test test/scripts/eager-import-closure.test.ts
  • pnpm tsgo:scripts
  • pnpm test src/config/sessions/transcript-json.test.ts
  • pnpm --dir ui test --project browser src/lib/chat/message-extract.browser.test.ts

What I checked:

PR surface

Source +8, Tests +19. Total +27 across 16 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 13 42 34 +8
Tests 3 24 5 +19
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 66 39 +27

Review metrics

Metric Value Why it matters
Production versus test LOC Production +42/-34; tests +24/-5 The small production increase separates the existing registry from Node dependencies; the added browser regression protects a distinct import boundary.

Labels

Label changes:

  • add P1: The PR addresses a newly introduced current-main import failure that blocks affected Control UI routes.
  • add merge-risk: 🚨 automation: The extracted module is absent from the trusted wrapper inventory, and remaining obsolete imports break a CI-exercised diagnostic script.
  • 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:

  • P1: The PR addresses a newly introduced current-main import failure that blocks affected Control UI routes.
  • merge-risk: 🚨 automation: The extracted module is absent from the trusted wrapper inventory, and remaining obsolete imports break a CI-exercised diagnostic script.
  • 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, 12:48 AM ET / 04:48 UTC.

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Nov 1, 2026
@steipete steipete changed the title fix(ui): keep transcript ownership imports browser-safe test(ui): isolate sidebar deletion setup and guard media imports Nov 1, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: XS and removed scripts Repository scripts agents Agent runtime and tooling size: S labels Nov 1, 2026
@steipete steipete changed the title test(ui): isolate sidebar deletion setup and guard media imports test(ui): guard browser transcript media imports Nov 1, 2026
@steipete
steipete merged commit cb72b4b into main Nov 1, 2026
94 of 96 checks passed
@steipete
steipete deleted the fix/transcript-browser-ownership branch November 1, 2026 06:07
@steipete

steipete commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 2, 2026
* fix(ui): keep transcript ownership imports browser-safe

* fix(scripts): complete transcript ownership import cutover

* test(ui): start sidebar invalidation tabs before snapshot capture

* test(ui): keep browser import regression narrowly scoped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui ci:full Keep ordinary native-locale CI selection on the next PR run. 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. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant