Skip to content

fix: keep HTML preview section links inside the document - #154393

Merged
steipete merged 7 commits into
mainfrom
codex/fix-html-fragment-preview
Sep 21, 2026
Merged

steipete merged 7 commits into
mainfrom
codex/fix-html-fragment-preview

Conversation

@steipete

@steipete steipete commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

In-page section links in an HTML preview could leave the preview blank instead of scrolling to their target because the sandbox's srcdoc document inherited another base URL.

User Impact

Authored section links scroll within ordinary HTML previews, including strict mode, while preserving form values and the original file. Authored base URLs, other-window targets, downloads, and foreign-namespace links retain their behavior. Links generated later by page scripts remain outside this repair. No configuration or migration is required.

Why This Change Was Made

The preview owner prepares only displayed document bytes, using the frame's actual script mode. A standards-based parser locates eligible link attributes; source offsets preserve the rest of the authored document. The Gateway response, source editor, sandbox transport, and content security policy retain their contracts.

The already-resolved parse5 8.0.1 becomes a direct UI dependency. The lockfile differs from current main only by the three UI importer lines. The deferred preview chunk grows approximately 26 KiB gzip; parser sources stay out of the startup bundle. Very large or pathological documents beyond the tested 1.7 MiB case remain a performance uncertainty.

Evidence

Inspected before/after screenshots show the same strict-mode section-link click on baseline 103115f and the same HTML implementation retained by this candidate. The baseline reproduces a blocked, blank frame (37.37 seconds); the candidate retains the document and scrolls to Discrepancies (25.05 seconds). This uses synthetic data in the production-UI isolated browser harness; source hashes bind both runs. The images were also delivered in the originating chat.

The original strict-mode sandbox browser flow fails before the repair. Existing passing browser assertions cover ordinary, C0/space-prefixed, Unicode, percent-encoded, named and empty fragments in scripts and strict modes; retained document identity and form values; unchanged outer-frame URL and source; exactly one preview RPC; and no file writes. The 1.7 MiB attachment and policy-isolation siblings also pass. The previous focused browser invocation passed three cases in 29.913 seconds wall, including production build. Mounted owner/transport siblings previously passed 53 cases in 5.37 seconds.

An earlier refresh incorporated the worker-launch fixture synchronization fix after the previous CI merge failed keeps a claimed worker alive across invoke cancel and reconnect until runtime close. That fixture now waits for the completed launch response handoff before testing cancellation; the persisted running state alone did not establish that boundary. On the refreshed tree, the worker lifetime case and all 32 mounted HTML owner cases pass in 40.577 seconds wall, including worker compilation. All four HTML implementation/test files are byte-identical to the previously reviewed candidate.

The earlier hosted regex-suppression finding was fixed with a linear C0-prefix scan. Upstream Node-fixture policy and database-worker registry repairs are already incorporated. These passing local checks do not substitute for completed CI on the replacement head.

The real shared Chrome profile reproduced the original blocked navigation using an OpenAI-generated synthetic HTML file. The prior candidate reached about:srcdoc#caf%C3%A9-%E9%9B%AA, after which Chromium's extension debugger refused frame access. That real-profile attempt does not establish post-click scroll or input retention; the deterministic production-UI browser assertions provide that boundary proof. No browser permissions or sandbox policy were changed.

Managed reviews of the HTML repair and the fixture repair report no actionable P0–P2 findings. This integration introduces no substantive merge resolution: the HTML patch and fixture bytes exactly match those reviewed changes.

Previously completed UI, chat-test and E2E-test typechecks pass (57.242, 72.186 and 67.841 seconds), as do scoped typed lint (50.668 seconds), formatting and git diff --check. Broad core/extension checks remain in completed hosted CI.

CI run 35580561560 on the previous head failed two Codex fixtures in bundle 20: the native-process fixture lost its relay before its first hook lookup, and the completed one-shot fixture timed out before cleanup assertions. This integration includes main’s native-process admission clock repair and the exact one-shot cleanup fixture repair. Both keep production deadlines and cleanup assertions unchanged while controlling the fixture clock and waiting for the actual admission boundary. The one-shot owner’s required qualification is complete: 20/20 standalone runs (9/9 cases each) and 3/3 original-shard runs (390/390 each), comprising two local runs and hosted run 35584290125, job 106284238408. The hosted run matches the ordered 12-file selection, Vitest config and two-worker setting; it passed on its first observed attempt in 122.77 seconds Vitest / 124.75 seconds wrapper time. The reviewed fixture bytes remained unchanged. This does not claim statistical elimination of flakes. The exact-head ClawSweeper review completed without correctness findings; its sole qualification item is now satisfied by the evidence above. Completed exact-head CI remains required before replacement recovery.

On the integration tree committed as 14caf6944f6, all 32 mounted HTML owner cases pass in 3.290 seconds wall. The strict-mode production-UI browser flow passes in 16.127 seconds, including an 8.82-second production build; the scripts-enabled case was intentionally filtered from this integration invocation and retains its earlier proof. The source tree remained unchanged throughout.

@clawsweeper

clawsweeper Bot commented Sep 21, 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.

@steipete
steipete marked this pull request as ready for review September 21, 2026 03:56
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Sep 21, 2026
@steipete steipete self-assigned this Sep 21, 2026
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Sep 21, 2026
@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Dependency graph changes

This maintainer PR changes the dependency graph. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: 14caf6944f64b54ebeaafb950c89b4ad30e28f34
  • Maintainer: @steipete
  • Repository role: admin

These dependency graph changes were made:

  • pnpm-lock.yaml
  • ui/package.json

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 6:18 AM ET / 10:18 UTC (Revision 6).

ClawSweeper review

What this changes

The PR keeps authored HTML section links inside sandboxed previews, adds browser coverage and documentation, and incorporates a Codex cleanup-test timing repair.

Merge readiness

✅ Ready for maintainer review

The repair remains necessary on fetched main, and no blocking defect was found. The previous review’s fixture-qualification request is satisfied by the updated evidence.

Priority: P2
Reviewed head: 14caf6944f64b54ebeaafb950c89b4ad30e28f34

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with convincing browser-boundary evidence and completed fixture qualification.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The production-UI browser flow exercises the changed preview owner through the real isolated sandbox under production CSP: recorded after-fix results retain the document, scroll to targets, preserve inputs, and avoid writes. Inspected before/after screenshots corroborate the visible result; the limited shared-profile attempt is not treated as complete proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The production-UI browser flow exercises the changed preview owner through the real isolated sandbox under production CSP: recorded after-fix results retain the document, scroll to targets, preserve inputs, and avoid writes. Inspected before/after screenshots corroborate the visible result; the limited shared-profile attempt is not treated as complete proof.
Evidence reviewed 10 items Introduced patch and ownership: Reviewed the pinned merge-base-to-head patch. The production change calls the new parser-backed link preparation from the existing preview owner; the remaining implementation preserves the transport and sandbox policy.
Still necessary on main: Fetched main still transfers view.html without fragment preparation; its tree has no chat-html-preview-links.ts. The merged related work repairs only the Codex fixture, not HTML navigation.
Release check: GitHub reports v2026.9.5 published September 19, 2026. No shipped fix for this HTML repair was established, and it remains absent from fetched main.
Findings None None.
Security None None.

How this fits together

The Control UI displays HTML files and attachments through a separate-origin sandbox. This change prepares link attributes in displayed HTML before transfer, preserving the original file and editor contents.

flowchart LR
  A[HTML file or attachment] --> B[Preview owner]
  B --> C[Identify eligible section links]
  C --> D[Prepare display bytes]
  D --> E[Isolated sandbox]
  E --> F[Scroll within retained document]
  A --> G[Original source and editor]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +72, Tests +209, Docs +4, Config +1, Other +3. Total +289 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 2 74 2 +72
Tests 3 218 9 +209
Docs 1 4 0 +4
Config 1 1 0 +1
Generated 0 0 0 0
Other 1 3 0 +3
Total 8 300 11 +289

Review metrics

Metric Value Why it matters
Deferred parser cost 1 direct UI dependency; approximately 26 KiB gzip added The author reports the parser remains outside startup bundles and supports standards-aware edits without reserializing documents.

Technical review

Best possible solution:

Keep fragment preparation in the existing preview owner, preserving authored source, explicit navigation semantics, and sandbox isolation.

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

Yes: clicking an authored fragment link in a strict HTML preview is a concrete path supported by baseline browser evidence and fetched-main source; this read-only review did not rerun it.

Is this the best way to solve the issue?

Yes: preparing eligible display attributes at the existing preview owner fixes navigation without changing persisted files, adding configuration, or relaxing sandbox policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 2d9cc4058941.

Labels

Label justifications:

  • P2: Repairs a bounded HTML-preview navigation failure while Source remains available.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The production-UI browser flow exercises the changed preview owner through the real isolated sandbox under production CSP: recorded after-fix results retain the document, scroll to targets, preserve inputs, and avoid writes. Inspected before/after screenshots corroborate the visible result; the limited shared-profile attempt is not treated as complete proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The production-UI browser flow exercises the changed preview owner through the real isolated sandbox under production CSP: recorded after-fix results retain the document, scroll to targets, preserve inputs, and avoid writes. Inspected before/after screenshots corroborate the visible result; the limited shared-profile attempt is not treated as complete proof.

Evidence

What I checked:

  • Introduced patch and ownership: Reviewed the pinned merge-base-to-head patch. The production change calls the new parser-backed link preparation from the existing preview owner; the remaining implementation preserves the transport and sandbox policy. (ui/src/pages/chat/components/chat-html-preview-element.ts:184, 14caf6944f64)
  • Still necessary on main: Fetched main still transfers view.html without fragment preparation; its tree has no chat-html-preview-links.ts. The merged related work repairs only the Codex fixture, not HTML navigation. (ui/src/pages/chat/components/chat-html-preview-element.ts:181, 2d9cc4058941)
  • Release check: GitHub reports v2026.9.5 published September 19, 2026. No shipped fix for this HTML repair was established, and it remains absent from fetched main.
  • Browser proof inspected: Inspected both downloaded screenshots linked by the supplied comment: the baseline shows a failed preview, and the candidate displays Discrepancies. The accompanying execution evidence records chrome-error navigation before repair and retained about:srcdoc navigation afterward. The production-UI harness uses the real sandbox listener and production CSP, and asserts scrolling, document identity, input retention, one preview RPC, unchanged source, and no writes. Four HTML implementation/test blobs match the previously reviewed 8a458ee tree. (ui/src/e2e/chat-html-preview.e2e.test.ts:199, 14caf6944f64)
  • Previous qualification request resolved: The supplied updated bodies record 20/20 standalone runs and 3/3 original-shard runs. GitHub independently confirms hosted job 106284238408 succeeded on c2a8464. Its log download was blocked by the artifact-host allowlist, so detailed counts remain attributed to the supplied evidence. Tree inspection confirms the fixture blob c82413e517f6ee7953e6c78ba0871907585382de is identical in that candidate, this head, and fetched main. The fixture repair merged at test(codex): stabilize one-shot cleanup during cold startup #154683. (extensions/codex/src/app-server/run-attempt-one-shot-cleanup.test.ts:76, 14caf6944f64)
  • Codex dependency signal and fixture boundary: The changed cleanup fixture exercises Codex turn/start and turn/completed through the production attempt owner, establishing a dependency-protocol inspection signal. Its new wait uses the existing turn_accepted callback; shared teardown restores real timers, and production deadlines and cleanup assertions are unchanged. (extensions/codex/src/app-server/run-attempt-one-shot-cleanup.test.ts:111, 14caf6944f64)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

History

Review history (5 earlier review cycles)
  • reviewed 2026-09-21T04:27:12.047Z sha cae6077 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T04:43:25.543Z sha 4d9342c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T05:09:18.806Z sha 4b598da :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T09:05:59.149Z sha 8a458ee :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T10:01:17.022Z sha 14caf69 :: needs changes before merge. :: none

The sparse workflow-owner fixture inherited the new bun-compatible host
policy and attempted to import runtime discovery that its five-file Node
adapter intentionally excludes. Own both the fixture's Node policy and
its empty job environment overlay before running the real boundary.

Reproduced all three failures from CI35560122489 on main. The unchanged
six cases pass after this repair; 102 owner and runner sibling tests pass
with conflicting inherited policy. All selected checks and independent
review pass. No production code, timeout, retry, or assertions changed.
The previous merge-ref preflight failed on the duplicate database-worker registration fixed on main by f76d38a. Refresh the merge-ref checks with that known producer repair; the reviewed and live-tested candidate tree is unchanged.
@steipete
steipete enabled auto-merge (squash) September 21, 2026 05:10
@steipete
steipete disabled auto-merge September 21, 2026 08:42
@steipete

Copy link
Copy Markdown
Contributor Author

Matched before/after captures of the first “Jump to discrepancies” link in strict-mode HTML preview. Both use the existing synthetic production-UI/sandbox test flow at 1440×1000. The baseline is main 103115f2f0b; the candidate overlays this PR's unchanged HTML owner and dependency files. The temporary capture instrumentation is confined to a disposable proof checkout.

Before: the frame becomes chrome-error://chromewebdata/ and the original target-visibility assertion fails (37.37 seconds test invocation). After: the same action stays in about:srcdoc#discrepancies, displays the target, and the existing strict-mode flow passes, including document identity, entered input, source and write-count assertions (25.05 seconds). Screenshots were captured at the first link action before later locator queries could change the viewport, and inspected for synthetic-only content.

These images are automated browser boundary evidence. They do not replace the PR's explicitly limited shared-profile attempt.

Before

Before: strict HTML section link leaves the preview blocked

After

After: the same link keeps the preview open at Discrepancies

The prior merge-ref CI failed the worker cancel/reconnect lifetime fixture because persisted running state preceded the launch response handoff. Incorporate main's owning synchronization repair (5beff9c) before renewing completed CI.

The HTML fragment implementation and test bytes remain unchanged. The original accepted auto request was reconciled and its cancellation confirmed through the retained native outcome before this head replacement.
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 21, 2026
Control the completed/cancelled fixture clock and await turn acceptance so cold startup cannot exhaust the unrelated attempt deadline before cleanup assertions run. Production deadlines and cleanup assertions stay unchanged.
@steipete
steipete merged commit b95f900 into main Sep 21, 2026
236 of 237 checks passed
@steipete
steipete deleted the codex/fix-html-fragment-preview branch September 21, 2026 10:22
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
…4393)

* fix: keep HTML preview section links inside the document

* fix: normalize fragment prefixes without a lint suppression

* test: isolate historical Node runner policy from CI

The sparse workflow-owner fixture inherited the new bun-compatible host
policy and attempted to import runtime discovery that its five-file Node
adapter intentionally excludes. Own both the fixture's Node policy and
its empty job environment overlay before running the real boundary.

Reproduced all three failures from CI35560122489 on main. The unchanged
six cases pass after this repair; 102 owner and runner sibling tests pass
with conflicting inherited policy. All selected checks and independent
review pass. No production code, timeout, retry, or assertions changed.

* ci: validate against repaired main test registry

The previous merge-ref preflight failed on the duplicate database-worker registration fixed on main by 25ca4cf. Refresh the merge-ref checks with that known producer repair; the reviewed and live-tested candidate tree is unchanged.

* test(codex): stabilize one-shot cleanup fixture timing

Control the completed/cancelled fixture clock and await turn acceptance so cold startup cannot exhaust the unrelated attempt deadline before cleanup assertions run. Production deadlines and cleanup assertions stay unchanged.
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 dependencies-changed PR changes dependency-related files docs Improvements or additions to documentation extensions: codex maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant