Skip to content

test(ui): assert positive New Session draft behavior - #124253

Merged
vyctorbrzezowski merged 2 commits into
mainfrom
brzezowski/draft-e2e-positive
Aug 15, 2026
Merged

vyctorbrzezowski merged 2 commits into
mainfrom
brzezowski/draft-e2e-positive

Conversation

@vyctorbrzezowski

@vyctorbrzezowski vyctorbrzezowski commented Aug 15, 2026 •

Copy link
Copy Markdown
Member

Fixes #124237

What Problem This Solves

The first case in ui/src/e2e/new-session-page.places.e2e.test.ts boots the full mocked New Session page but its only assertion is expect.poll(() => page.locator(".sidebar-recent-session--draft").count()).toBe(0). That selector does not appear anywhere in production code, so the check is vacuous: it passes regardless of whether the pre-creation draft actually stays on the composer, the sidebar reflects real session data, or the composer avoids creating a session before submit.

Why This Change Was Made

Replaced the vacuous selector check with positive assertions inside the same mocked-Gateway suite, reusing the existing submission pattern from the neighboring test case: after typing a draft on /new?agent=main, the test now confirms the route and agent query param stay put, the composer textarea holds the typed value, the sidebar shows exactly the one canonical session sessions.list returned (no phantom draft row), and zero sessions.create requests have fired. It then submits and confirms exactly one sessions.create request with the expected params plus navigation to the canonical session route. The change is test-only; no production code was touched.

Review follow-up: the exactly-once sessions.create assertion originally ran immediately after gateway.waitForRequest("sessions.create") resolved, before waiting for the navigation-settle signal the neighboring submission test uses. That ordering could pass prematurely if a late duplicate create landed after the count check but before navigation finished. Reordered so the test polls for navigation to the canonical session route first, then asserts the request count, matching the neighboring test's wait pattern.

User Impact

No user-facing behavior changes. This closes a coverage gap so a real regression in the New Session draft-preservation flow (draft-navigation-handoff.ts / new-session-page.ts) would now fail this test instead of passing silently.

Evidence

  • Pre-fix browser proof (not vacuous): on a Blacksmith Testbox lease (tbx_01m03mdvkmyakbab0e4w4xsncz), temporarily changed expect(await page.locator(".sidebar-recent-session").count()).toBe(1) to .toBe(2) and ran the test with real Chromium/Playwright. It failed for the right reason: AssertionError: expected 1 to be 2 at the sidebar-count assertion line. Restored the correct value and reran: passed. This proves the new positive assertion is wired to real DOM state, not vacuous like the selector it replaced.
  • Full-suite Testbox run: node scripts/run-vitest.mjs ui/src/e2e/new-session-page.places.e2e.test.ts on the same Testbox lease — all 10 tests in the file pass, including the reordered exactly-once assertion.
  • CI diagnosis (checks-ui and checks-ui-e2e (4/12) on the exact-head rollup): both failures are pre-existing, unrelated flakes, not caused by this test-only change:
    • checks-ui-e2e (4/12) failed in ui/src/e2e/agent-file-lifecycle.e2e.test.ts:294 (AssertionError: expected '# Real main instructions\n# Saved thr…' to be '# Saved through real Gateway\n') — a different file entirely. The identical assertion failed on unrelated, concurrently open PRs at different shard indices: brzezowski/sharing-identity-kind shard 10/12 (run 31908362789) and another run at shard 6/12 (run 31904182917). Two more unrelated PRs failed checks-ui-e2e at yet other shards on different tests (config-safe-write.e2e.test.ts timeout at shard 6/12 in run 31908362789, lobster-pet-dismiss-menu-overflow.e2e.test.ts assertion at shard 8/12 in run 31904527461) — consistent with general checks-ui-e2e lane flakiness rather than anything in this PR's diff.
    • checks-ui failed in src/pages/chat/chat-responsive.browser.test.ts (Error: page.evaluate: Resulting promise was garbage collected) — an unrelated browser-mode test for the chat responsive layout, in a file this PR never touches. The error is a Playwright/GC timing artifact, not a content assertion tied to this change.
  • node scripts/check-changed.mjs -- ui/src/e2e/new-session-page.places.e2e.test.ts — delegated through Testbox, exit 0. Conflict markers, max-lines ratchet, changelog attributions, doctor deprecation registry, extension/plugin-sdk wildcard re-export guards, duplicate scan coverage, coercion helper guard, dependency pin guard, formatting (oxfmt --check), package patch guard, dead-export scan, Control UI i18n catalog, and core-test typecheck all passed.
  • .agents/skills/autoreview/scripts/autoreview --mode uncommitted — clean: "no accepted/actionable findings reported", overall correctness 0.99.
  • Direct oxfmt run on the changed file: "All matched files use the correct format."

Replace the New Session draft E2E's only assertion, a zero-count check
against a CSS selector that appears nowhere in production code, with
positive coverage: the draft text stays on the composer, the route and
sidebar stay put, no sessions.create request fires before submit, and
submitting creates exactly one session with canonical navigation.

Fixes #124237
@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XS maintainer Maintainer-authored PR labels Aug 15, 2026
@vyctorbrzezowski
vyctorbrzezowski marked this pull request as ready for review August 15, 2026 19:28
@vyctorbrzezowski vyctorbrzezowski self-assigned this Aug 15, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Aug 15, 2026
@clawsweeper

clawsweeper Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 5:30 PM ET / 21:30 UTC.

ClawSweeper review

What this changes

The PR replaces a New Session E2E check for a retired CSS class with assertions that a draft stays in the composer until one session is created and the app navigates to it.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open for normal maintainer handling. Current main still contains the vacuous obsolete-selector assertion, while this focused test-only PR replaces it with behavior-level coverage; no blocking correctness or security finding was identified.

Priority: P3
Reviewed head: 17a77e10ee3a6c9f947dfe690425e7ebf2c70703
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-oriented test improvement with supplied browser validation and no identified patch defect.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored test-only PR is outside the external contributor proof gate; its supplied Testbox Chromium run is nevertheless relevant validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored test-only PR is outside the external contributor proof gate; its supplied Testbox Chromium run is nevertheless relevant validation.
Evidence reviewed 6 items Current-main coverage gap: Current main's first New Session test only waits for .sidebar-recent-session--draft, while the current sidebar row renderer uses session-row-host--draft; the old selector is not a product contract.
Owner-boundary behavior: The production flow retains/restores route-owned drafts and, on submit, calls session creation before navigating to the resulting chat route; the proposed assertions observe that existing boundary rather than adding a test seam.
Browser harness contract: The shared harness installs a mocked WebSocket Gateway into a real Playwright page and exposes recorded requests, so route, composer, sidebar, and request-count assertions exercise the intended UI boundary.
Findings None None.
Security None None.

How this fits together

The Control UI New Session page holds an unsent draft locally, renders canonical sessions from the Gateway, and creates a session only after submit. Its E2E suite drives that browser flow with a mocked Gateway and records requests.

flowchart LR
  A[New Session route] --> B[Draft composer]
  B --> C[Draft submission flow]
  C --> D[Mock Gateway request recorder]
  D --> E[Canonical session route]
  D --> F[Sidebar session list]
Loading

Decision needed

Question Recommendation
Should the assigned maintainer land this member-authored, test-only coverage improvement now that its exact-head checks are green? Land the focused coverage improvement: Merge the test-only change to replace the obsolete selector assertion with verified user-flow assertions.

Why: The protected maintainer label and member authorship require an explicit human merge decision even though the patch has no supported blocker.

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +32. Total +32 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 40 8 +32
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 40 8 +32

Review metrics

Metric Value Why it matters
Production vs test LOC production +0/-0; tests +40/-8 All changes are in one browser E2E test, increasing behavior coverage without changing shipped runtime behavior.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #124237
Summary: This PR is the explicitly linked candidate implementation for the canonical New Session coverage-gap issue.

Members:

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

Technical review

Best possible solution:

Land one browser-level regression test that protects the existing composer-owned draft and canonical create-and-navigate flow without restoring sidebar-markup coupling.

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

Yes for the coverage defect: current main's test checks only a retired selector and never types or submits a draft; the supplied Testbox Chromium run further exercises the proposed positive assertions.

Is this the best way to solve the issue?

Yes. The patch tests the existing route, composer, Gateway request, sidebar, and navigation boundary without adding production hooks or preserving retired markup.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a focused test-quality improvement with no direct user-visible production change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored test-only PR is outside the external contributor proof gate; its supplied Testbox Chromium run is nevertheless relevant validation.

Evidence

What I checked:

  • Current-main coverage gap: Current main's first New Session test only waits for .sidebar-recent-session--draft, while the current sidebar row renderer uses session-row-host--draft; the old selector is not a product contract. (ui/src/e2e/new-session-page.places.e2e.test.ts:57, 73c45824e1e2)
  • Owner-boundary behavior: The production flow retains/restores route-owned drafts and, on submit, calls session creation before navigating to the resulting chat route; the proposed assertions observe that existing boundary rather than adding a test seam. (ui/src/pages/new-session/draft-submission-flow.ts:396, 73c45824e1e2)
  • Browser harness contract: The shared harness installs a mocked WebSocket Gateway into a real Playwright page and exposes recorded requests, so route, composer, sidebar, and request-count assertions exercise the intended UI boundary. (ui/src/test-helpers/control-ui-e2e.ts:2250, 73c45824e1e2)
  • Submitted validation: The supplied PR context records a Chromium/Testbox run of the complete 10-test file, a deliberate failing sidebar-count mutation, and successful exact-head UI and UI-E2E checks after the follow-up ordering commit. (ui/src/e2e/new-session-page.places.e2e.test.ts:26, 17a77e10ee3a)
  • Feature provenance: Blame attributes the current vacuous test block and current draft-flow lines to the current-main consolidation commit; history also shows Vyctor Brzezowski's earlier removal of the pre-creation session row in commit cfc684e. (ui/src/e2e/new-session-page.places.e2e.test.ts:26, 1610771b1d7a)
  • Codex dependency boundary: No affirmative Codex-runtime, protocol, harness, import, or compatibility signal is present: this change is confined to the Control UI Vitest/Playwright test and its mocked Gateway seam, so the sibling Codex-source gate does not apply. (ui/src/e2e/new-session-page.places.e2e.test.ts:1, 73c45824e1e2)

Likely related people:

  • vyctorbrzezowski: Commit cfc684e removed the pre-creation session row that made the old assertion obsolete, and this contributor has prior history in the exact New Session paths. (role: recent New Session regression contributor; confidence: high; commits: cfc684e49c1f; files: ui/src/e2e/new-session-page.places.e2e.test.ts, ui/src/pages/new-session/draft-submission-flow.ts)
  • steipete: Blame attributes the current test block and draft submission/navigation flow to the current-main consolidation commit. (role: recent current-main contributor; confidence: high; commits: 1610771b1d7a; files: ui/src/e2e/new-session-page.places.e2e.test.ts, ui/src/pages/new-session/draft-submission-flow.ts, ui/src/pages/new-session/new-session-page.ts)
  • fuller-stack-dev: History shows prior New Session composer and prompt-flow work in the same owner area. (role: historical feature contributor; confidence: medium; commits: 01a7f4fb3fc0, 21bfc75648d1; files: ui/src/pages/new-session/draft-submission-flow.ts, ui/src/pages/new-session/new-session-page.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-15T19:34:40.751Z sha 3940711 :: needs maintainer review before merge. :: none

Reorders the exactly-once sessions.create assertion to run after the
canonical navigation-settle poll (the same signal the neighboring
submission test waits on), instead of right after waitForRequest
resolves. The old order could pass prematurely if a late duplicate
create landed after the count check but before navigation completed.
@vyctorbrzezowski
vyctorbrzezowski merged commit abe9800 into main Aug 15, 2026
99 checks passed
@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Merged via squash.

@vyctorbrzezowski
vyctorbrzezowski deleted the brzezowski/draft-e2e-positive branch August 15, 2026 21:51
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 16, 2026
* test(ui): assert positive New Session draft behavior

Replace the New Session draft E2E's only assertion, a zero-count check
against a CSS selector that appears nowhere in production code, with
positive coverage: the draft text stays on the composer, the route and
sidebar stay put, no sessions.create request fires before submit, and
submitting creates exactly one session with canonical navigation.

Fixes openclaw#124237

* test(ui): settle before asserting exactly-once sessions.create

Reorders the exactly-once sessions.create assertion to run after the
canonical navigation-settle poll (the same signal the neighboring
submission test waits on), instead of right after waitForRequest
resolves. The old order could pass prematurely if a late duplicate
create landed after the count check but before navigation completed.
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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.

Make the New Session draft E2E assert positive behavior

1 participant