Skip to content

fix(test/ui): prevent shared history pollution - #117348

Merged
steipete merged 1 commit into
mainfrom
codex/issue-115355
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/issue-115355

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Keep the tool-chip browser test from leaking history.replaceState changes into shared UI tests.
  • Scope and restore the spy while still asserting the intended tool-anchor URL.
  • Production LOC: 0.

Verification

  • Original test: deterministic shared-history regression reproduced (RED).
  • Patched shared isolate: false JSDOM test and sibling suites: GREEN.
  • Real Playwright Chromium project: 535 files, 7,805 tests passed.
  • Targeted changed-file gate, formatting, TypeScript, lint, and UI i18n: GREEN.
  • Independent source/security reviews and authenticated Codex review: PASS.

Fixes #115355

Reproducible remote terminal proof

Trusted Blacksmith Testbox tbx_01kyyc7n61p9bf0nf9rsh5y4cz; reviewed head d935f772ea9b00ec2c99a59fd50dbe991a56d9bb; exact patch SHA-256 d3608595eb84ca627c4eed848b211d9eedb651c0b7e0ca1978f4544c99351179. The original test was exercised first with a temporary assertion against its existing shared-history side effect, then the reviewed patch was restored unchanged.

$ node scripts/run-vitest.mjs run --config test/vitest/vitest.ui.config.ts ui/src/pages/agents/panels-tools-skills.browser.test.ts --maxWorkers=1
FAIL ui/src/pages/agents/panels-tools-skills.browser.test.ts (8 tests | 1 failed)
AssertionError: BASELINE_SHARED_HISTORY_CHANGED: expected 'http://localhost:3000/#agent-tool-read' to be 'http://localhost:3000/'
BASELINE_EXPECTED_RED_CONFIRMED

$ node scripts/run-vitest.mjs run --config test/vitest/vitest.ui.config.ts ui/src/pages/agents/panels-tools-skills.browser.test.ts ui/src/pages/config/config-page.test.ts ui/src/test-helpers/browser-history.test.ts --maxWorkers=1
SHARED_ISOLATE_FALSE_JSDOM_AND_SIBLINGS_PASS

$ node scripts/ensure-playwright-chromium.mjs
$ pnpm --dir ui test -- --project browser src/pages/agents/panels-tools-skills.browser.test.ts
Test Files  535 passed (535)
Tests       7805 passed (7805)
REAL_PLAYWRIGHT_CHROMIUM_PASS

$ pnpm check:changed -- ui/src/pages/agents/panels-tools-skills.browser.test.ts
TARGETED_CHANGED_GATE_PASS
FINAL_REMOTE_HEAD aa743c9f818652b09ede4d22333e14f3ca7cf249
FINAL_REMOTE_FULL_INDEX_HASH d3608595eb84ca627c4eed848b211d9eedb651c0b7e0ca1978f4544c99351179
OPENCLAW_ISSUE_115355_PROOF_COMPLETE
blacksmith run summary sync=delegated command=4m43.023s total=4m43.062s exit=0

The approved one-file patch was rebased onto aa2a5c96f69a1be639c602649d4aa2e4de8da0a8 after confirming the test, production owner, and both Vitest configuration blobs were unchanged; its exact reviewed patch SHA-256 remained identical.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XS maintainer Maintainer-authored PR labels Aug 1, 2026
@clawsweeper clawsweeper Bot added 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 Aug 1, 2026
@clawsweeper clawsweeper Bot added the P2 Normal backlog priority with limited blast radius. label Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 6:34 AM ET / 10:34 UTC.

ClawSweeper review

What this changes

The PR changes a Control UI browser test so clicking an agent tool chip verifies its requested #agent-tool-read deep link without changing history shared by later UI tests.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

This PR remains necessary: current main still restores real JSDOM history after the click, whereas the branch prevents the mutation at its source while asserting the requested deep link. The patch is correct, its refreshed remote terminal proof is sufficient, and the protected maintainer label leaves the final merge decision to a human reviewer.

Priority: P2
Reviewed head: d935f772ea9b00ec2c99a59fd50dbe991a56d9bb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A precise one-file test repair has a source-confirmed root cause, clean implementation, and credible after-fix terminal evidence.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The updated PR body contains a redacted remote terminal transcript showing a baseline shared-history failure and after-fix focused shared-worker and Chromium Playwright passes on the reviewed patch.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The updated PR body contains a redacted remote terminal transcript showing a baseline shared-history failure and after-fix focused shared-worker and Chromium Playwright passes on the reviewed patch.
Evidence reviewed 6 items Current runtime behavior: The tool-chip handler opens the target group and tool card, builds a URL with the anchor hash, and calls browser history replacement synchronously; this is the mutation the test must observe without allowing it to escape into the shared worker.
Shared-worker boundary: The UI Vitest configuration uses JSDOM with isolate: false, while the existing helper restores history only in afterEach; that confirms a per-click spy is a direct prevention of the shared-state side effect rather than redundant cleanup.
Patch behavior: The branch spies on window.history.replaceState, verifies one URL request with #agent-tool-read, verifies the actual URL is unchanged, then restores the spy before shared cleanup runs.
Findings None None.
Security None None.

How this fits together

The Control UI renders agent tool chips that open a corresponding tool card and request a URL hash. The UI Vitest configuration deliberately runs most JSDOM tests without isolation, so a history mutation in one test can affect later route tests in the same worker.

flowchart LR
  A[Agent tool chip] --> B[Click handler]
  B --> C[Open tool card]
  C --> D[Request tool hash URL]
  D --> E[Shared JSDOM worker]
  E --> F[Later route tests]
Loading

Before merge

  • Complete next step (P2) - The branch already contains the narrow repair, has sufficient proof, and needs ordinary human merge handling because it carries the protected maintainer label.
Agent review details

Security

None.

PR surface

Tests +6. Total +6 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 11 5 +6
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 11 5 +6

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #115355
Summary: This PR is the concrete candidate fix for the linked shared-JSDOM history-pollution bug.

Members:

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

Technical review

Best possible solution:

Merge the focused test-only repair after the designated maintainer confirms the current clean merge result; preserve the handler’s real deep-link behavior while making the shared-worker test observe it without changing global history.

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

Yes, source and the PR’s remote transcript give a high-confidence path: run the non-isolated UI Vitest shard containing the tool-chip and route tests, where the prior click changed the shared hash. This read-only review did not rerun it locally.

Is this the best way to solve the issue?

Yes. Spying only during the click captures the real handler’s requested URL while preventing the harmful shared-state write; retaining cleanup alone is weaker because it allows the mutation to exist before finally and afterEach run.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b6b440d07680.

Labels

Label justifications:

  • P2: The patch repairs an intermittent shared Control UI test-state defect with limited blast radius and no production runtime change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The updated PR body contains a redacted remote terminal transcript showing a baseline shared-history failure and after-fix focused shared-worker and Chromium Playwright passes on the reviewed patch.
  • proof: sufficient: Contributor real behavior proof is sufficient. The updated PR body contains a redacted remote terminal transcript showing a baseline shared-history failure and after-fix focused shared-worker and Chromium Playwright passes on the reviewed patch.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame attributes the affected test cleanup and the shared browser-history helper to Peter Steinberger, and he authored this focused successor repair. (role: feature owner and recent area contributor; confidence: high; commits: ee320a6e4114, d935f772ea9b; files: ui/src/pages/agents/panels-tools-skills.browser.test.ts, ui/src/test-helpers/browser-history.ts, ui/src/pages/agents/panels-tools-skills.ts)

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 (1 earlier review cycle)
  • reviewed 2026-08-01T10:21:57.696Z sha d935f77 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed 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 Aug 1, 2026
@steipete
steipete merged commit 4982b39 into main Aug 1, 2026
96 of 110 checks passed
@steipete
steipete deleted the codex/issue-115355 branch August 1, 2026 10:39
vincentkoc added a commit to Alix-007/openclaw that referenced this pull request Aug 1, 2026
* origin/main:
  fix(test/ui): prevent shared history pollution (openclaw#117348)
  fix(openrouter): apply image request transport policy (openclaw#117336)
  perf(gateway): skip clean transcript workers (openclaw#117342)
  test(testing): assert relay smoke readiness
  fix(testing): activate relay live smoke transport
  feat(channels): record account lifecycle facts and retire inferred health vocabularies (openclaw#117300)
  fix(canvas): remove unsupported snapshot delay hint (openclaw#117326)
  refactor(agents): fold cache TTL pruning into prompt projection (openclaw#117313)
  fix(canvas): honor paired-node invocation deadlines (openclaw#117316)
  fix(system-agent): make exit-and-run-a-terminal guidance surface-correct (openclaw#114633)
  fix(ai): assistant text blocks are run together on replay (openclaw#115743)
  refactor(agents): canonicalize subagent execution state (openclaw#117267)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* origin/main:
  fix(test/ui): prevent shared history pollution (openclaw#117348)
  fix(openrouter): apply image request transport policy (openclaw#117336)
  perf(gateway): skip clean transcript workers (openclaw#117342)
  test(testing): assert relay smoke readiness
  fix(testing): activate relay live smoke transport
  feat(channels): record account lifecycle facts and retire inferred health vocabularies (openclaw#117300)
  fix(canvas): remove unsupported snapshot delay hint (openclaw#117326)
  refactor(agents): fold cache TTL pruning into prompt projection (openclaw#117313)
  fix(canvas): honor paired-node invocation deadlines (openclaw#117316)
  fix(system-agent): make exit-and-run-a-terminal guidance surface-correct (openclaw#114633)
  fix(ai): assistant text blocks are run together on replay (openclaw#115743)
  refactor(agents): canonicalize subagent execution state (openclaw#117267)
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 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: XS 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.

jsdom hash pollution: agent-tool chip click leaks #agent-tool-read into shared UI vitest workers

1 participant