Skip to content

test(ui): stop cloud-workers save assertions racing form state - #125456

Merged
steipete merged 1 commit into
mainfrom
steipete/fix-cloud-workers-save-race
Aug 18, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/fix-cloud-workers-save-race

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

ui/src/e2e/cloud-workers-settings.e2e.test.ts ("adds and edits profiles while distinguishing advertised
state") fails intermittently on CI — it blocked PR #125105 with expected { Object (cloudWorkers) } to match object { Object (cloudWorkers) }, while passing on main, passing isolated on that branch (3/3), and
passing when run directly after an unrelated e2e in the same invocation (12/12).

The cause is the gap between the last edit and the Save click. The test fills several Web Awesome form
controls and toggles a wa-switch, then clicks Save immediately:

await page.getByLabel("Custom machine class").fill("ccx53");
await page.getByLabel("Max lifetime").fill("12h");
await page.locator(".settings-row").filter({ hasText: "Desktop" }).locator("wa-switch").click();
await page.getByLabel("Crabbox binary").fill("/opt/bin/crabbox");
await gateway.deferNext("config.patch");
await page.getByRole("button", { name: "Save" }).click();

Nothing there proves those controls have committed their values to component state, so the patch can be
assembled from a value the form has not absorbed yet. The test synchronized on when a request arrived
rather than on the UI reaching an asserted state — a timing dependency in the shape of a wait.

Why This Change Was Made

A settings test that fails under load teaches people to hit rerun, which is how a real serialization
regression would slip past. The fix makes the precondition explicit: before each Save, every edited control
is asserted to hold its new value — inputs by inputValue(), the Desktop switch by aria-checked="true" —
so the click cannot outrun the form. All three save paths in the file get the same treatment.

Deliberately unchanged: the toMatchObject expectations. Trimming fields from them, polling the assertion
until it matched, sleeping, or raising timeouts would each have made the test stop failing without making it
correct — and this case exists to catch exactly the class of bug where an edited field never reaches the
patch.

User Impact

None. Test-only; no production file is touched.

Evidence

Ten consecutive runs, since one green run says nothing about a race:

10/10 passed
pnpm test ui/src/e2e/cloud-workers-settings.e2e.test.ts
 Test Files  1 passed (1)
      Tests  3 passed (3)

pnpm check:changed green; Codex autoreview clean.

reviewMetrics — production vs test LOC: production 0, tests +17 / −0 — pure addition, so no existing
assertion was relaxed to achieve it.

No CHANGELOG.md edit — release-only per repo policy; test-only change.

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 17, 2026 23:43
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XS maintainer Maintainer-authored PR labels Aug 17, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 17, 2026, 9:04 PM ET / August 18, 2026, 01:04 UTC.

ClawSweeper review

What this changes

The PR adds pre-Save polling assertions to the Cloud Workers Control UI end-to-end test after form edits.

Merge readiness

⛔ Blocked by patch quality or review findings - 5 items remain

Keep open: the revised polls still observe only control values, not the draft captured by Save, so they do not prove or repair the claimed race.

Priority: P3
Reviewed head: d9a38c73a36e644bced996b5da21da385d5415c7

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has a concrete test-boundary flaw, so its claimed flake repair is not yet merge-ready.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-owned, test-only PR does not change user-visible runtime behavior; its needed proof is a valid regression at the Save boundary.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-owned, test-only PR does not change user-visible runtime behavior; its needed proof is a valid regression at the Save boundary.
Evidence reviewed 4 items Changed assertions: The PR adds polling reads of input values and switch ARIA state immediately before Save; none observes the page draft or Save payload.
Draft owner: Input and change handlers synchronously call patchDraft, which replaces the page-local draft; DOM value polling is not an observation of a separate deferred commit.
Save boundary: Save receives this.draft directly from the click handler and passes that captured value to the patch builder, so the outgoing config patch is the relevant regression boundary.
Findings 1 actionable finding [P2] Prove synchronization at the draft-to-Save boundary
Security None None.

How this fits together

Cloud Workers settings flow from browser controls into a page-local draft, then Save serializes that draft into a Gateway configuration patch. The affected E2E test validates the resulting patch through a mocked Gateway.

flowchart LR
  A[Browser form controls] --> B[Cloud Workers draft]
  B --> C[Save action]
  C --> D[Configuration patch]
  D --> E[Mock Gateway assertion]
Loading

Before merge

  • Prove synchronization at the draft-to-Save boundary (P2) - This remains the prior blocker: these polls reread raw DOM state, but each form handler synchronously updates the draft and Save passes that draft to the patch builder. The polls will normally pass immediately without proving what Save serializes, so replace them with a demonstrated pre-fix boundary regression or remove them.
  • Resolve merge risk (P1) - Merging these waits would present raw DOM reads as synchronization while leaving the actual intermittent CI cause unproven and potentially unfixed.
  • Complete next step (P2) - The narrow test correction is clear, but this member-authored maintainer-labeled PR should remain with its author or a maintainer rather than enter an automated repair lane.
  • Improve patch quality - Demonstrate the failure on pre-fix code at the draft-to-Save or outgoing-patch boundary.
  • Improve patch quality - Remove the added DOM polls if that failure cannot be established.

Findings

  • [P2] Prove synchronization at the draft-to-Save boundary — ui/src/e2e/cloud-workers-settings.e2e.test.ts:144-156
Agent review details

Security

None.

PR surface

Tests +17. Total +17 across 1 file.

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

Review metrics

Metric Value Why it matters
Production versus test delta production +0, tests +17 All added lines are E2E polling assertions, but they do not currently establish an owner-boundary regression.

Merge-risk options

Maintainer options:

  1. Prove the Save-boundary regression (recommended)
    Capture a pre-fix failure that observes the draft consumed by Save or the outgoing configuration patch, then keep only synchronization that changes that result.
  2. Drop the speculative waits
    If no draft-to-Save failure can be demonstrated, remove the DOM polls and investigate the original CI failure separately.

Technical review

Best possible solution:

Replace the polls only with a regression that demonstrably fails before the repair at the draft-to-Save/config.patch boundary; otherwise remove the redundant waits.

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

No: the PR reports intermittent CI behavior but provides no failing pre-fix draft-to-Save reproduction; source shows the proposed polls do not test that boundary.

Is this the best way to solve the issue?

No: polling form-control state is not the best fix because Save uses the page draft; the existing outgoing-patch assertion is the relevant boundary to reproduce and protect.

Full review comments:

  • [P2] Prove synchronization at the draft-to-Save boundary — ui/src/e2e/cloud-workers-settings.e2e.test.ts:144-156
    This remains the prior blocker: these polls reread raw DOM state, but each form handler synchronously updates the draft and Save passes that draft to the patch builder. The polls will normally pass immediately without proving what Save serializes, so replace them with a demonstrated pre-fix boundary regression or remove them.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P3: This is an internal test-reliability change with no production behavior change.
  • merge-risk: 🚨 automation: The PR changes CI test synchronization and could leave the intermittent test failure unresolved while appearing to address it.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-owned, test-only PR does not change user-visible runtime behavior; its needed proof is a valid regression at the Save boundary.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main history attributes the Cloud Workers draft and Save path to this contributor, who also authored the proposed E2E revision. (role: feature author and recent area contributor; confidence: high; commits: 57e862980be1, d9a38c73a36e; files: ui/src/pages/cloud-workers/cloud-workers-page.ts, ui/src/e2e/cloud-workers-settings.e2e.test.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-17T23:50:13.604Z sha 355b991 :: found issues before merge. :: [P2] Synchronize with the draft-to-save boundary

@steipete steipete self-assigned this Aug 18, 2026
@steipete
steipete force-pushed the steipete/fix-cloud-workers-save-race branch from 355b991 to d9a38c7 Compare August 18, 2026 00:58
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 18, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready verification for exact head d9a38c73a36e644bced996b5da21da385d5415c7:

  • Exact-head CI run 32086499880 is green, including checks-ui-e2e (1/12) job 95560131004.
  • Focused local proof passed: node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/cloud-workers-settings.e2e.test.ts (3/3).
  • git diff --check origin/main...HEAD passed.
  • Fresh branch autoreview is clean with no accepted/actionable findings.
  • Production delta is +0/-0; test delta is +17/-0. No payload assertion was weakened.
  • Native review-init, review artifacts, artifact validation, and Testbox-required prepare-run completed. prepare-run reused the green exact-head hosted gate, so there is no separate Testbox lease/run ID.

Latest ClawSweeper item disposition:

  1. Prove synchronization at the draft-to-Save boundary — Applied at the public boundary already present in this test: every Save is followed by capture and assertion of the outgoing config.patch payload. The added polls are only rendered-control preconditions; they are not being presented as a replacement for the patch assertion. Exposing the private draft would require a test-only production seam, which the test-audit gate rejects.
  2. Resolve merge risk — Skipped as a blocker. Exact-head CI, the focused UI E2E, and the unchanged emitted-patch assertions are green. The remaining uncertainty is causal attribution for the old intermittent failure, not a production or assertion regression introduced by this test-only diff.
  3. Complete next step — Applied. The author/maintainer explicitly requested this landing, and the native maintainer review/prepare flow is complete.
  4. Demonstrate the failure on pre-fix code at the draft-to-Save or outgoing-patch boundary — Skipped: the historical failure was intermittent and no deterministic pre-fix trace is available. This proof gap is recorded in the review artifact and is not being described as reproduced.
  5. Remove the DOM polls if that failure cannot be established — Skipped: the polls retain value as explicit observable UI-state preconditions, while the existing outgoing-patch assertions remain the authoritative behavior check. They add no production seam, timeout, sleep, or relaxed assertion.

@steipete
steipete merged commit 05b9b39 into main Aug 18, 2026
96 checks passed
@steipete
steipete deleted the steipete/fix-cloud-workers-save-race branch August 18, 2026 01:19
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS 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