Skip to content

fix(tests): avoid false failures during fixture startup - #137101

Merged
steipete merged 1 commit into
mainfrom
codex/test-modal-readiness-20260903
Sep 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-modal-readiness-20260903

Conversation

@steipete

@steipete steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Closes #136708. Follow-up to the unrelated CI failures observed while landing the Android cleanup in #136934.

What Problem This Solves

Resolves false CI failures when cold dialog imports or native child startup consume short deadlines intended to test rendering, pipe draining, or termination behavior. Retrying the Android PR passed unchanged; it did not repair these races.

Why This Change Was Made

Fixture readiness now precedes the behavior clock. The existing modal helpers join lazy imports before starting their unchanged DOM waits; placement prerequisites use the same helper. They deliberately do not await the action being confirmed or an intentionally held RPC.

The terminal-child fixture starts its real drain budget at native exit. The gauntlet's isolated controller waits for actual descendant IPC readiness before driving its existing 200 ms timeout, verifies native child closure, then sends a real parent SIGTERM during the unchanged 150 ms kill grace. Native process-group inspection handles Linux zombies, and failure cleanup joins the harness and known children. The pre-exit marker/sleep inference and duplicate PID probe are removed.

The refusal/retry and UTF-8 initialization cases from #136708 were already repaired by 6187bd6; their complete owning suites remain covered here.

User Impact

No product or runtime behavior changes. No longer deadlines, retries, new configuration, dependencies, or weaker business assertions. Production LOC: +0/-0. Tests and test support: +160/-63 (net +97).

Evidence

Controlled regressions on base 2fffd4e8ba116813222b28b89179fd911784aeae, repeated after the fix:

Real fixture path Controlled setup delay Before → after
Placement restart 2,000 ms real Vite module load Missing profile selector → pass
Stop confirmation 2,000 ms real Vite module load Missing confirmation → pass
Markdown expanded-table modal 2,000 ms real Vite module load Missing modal → pass
Header group input 2,000 ms real Vite module load Missing input → pass
Terminal child with inherited stderr 600 ms child initialization Readiness timeout instead of exit 7 → pass
Parent termination during gauntlet timeout cleanup 600 ms child initialization Descendant never ready before timeout → pass

The Vite hook returns null after its delay, preserving real module exports, components, catalog fixtures, and actions. Each delay overlaps the selected test. All four passing dialog probes finish after import release with zero remaining modals/body children, restored dialog methods, and no unhandled errors. Temporary delay injection is not in this patch.

Normal final-source checks on Darwin/arm64, Node 24.19.0:

  • Canonical shared UI caller group: 518 passed across seven files.
  • Canonical isolated UI caller group: 50 passed across two files.
  • Both complete subprocess owning suites: 104 passed, one existing Windows-only test skipped.
  • Three existing managed-child deadline/cleanup sibling cases passed.
  • Both changed-check selections passed: formatting, relevant typechecking/lint, and architectural guards. Initial test-style lint failures were corrected before the final pass.
  • Fresh independent Codex review: no actionable P0–P2 findings.

Commands:

OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs --config test/vitest/vitest.ui.config.ts ui/src/components/app-sidebar.test.ts ui/src/components/session-organizer-batch-mutations.test.ts ui/src/pages/config/config-page.test.ts ui/src/pages/devices/devices-page.test.ts ui/src/pages/chat/chat-pane-placement.test.ts ui/src/pages/chat/chat-pane-placement-restart.test.ts ui/src/pages/chat/chat-pane-placement-stop.test.ts
OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs --config test/vitest/vitest.ui-isolated.config.ts ui/src/components/markdown-tables.test.ts ui/src/pages/chat/chat-pane.test.ts
node scripts/run-vitest.mjs --config test/vitest/vitest.tooling.config.ts test/helpers/openclaw-test-instance.test.ts test/scripts/plugin-gateway-gauntlet.test.ts
node scripts/check-changed.mjs -- ui/src/pages/chat/chat-pane-placement-restart.test.ts ui/src/pages/chat/chat-pane-placement.test.ts ui/src/test-helpers/modal-dialog.ts
node scripts/check-changed.mjs -- test/helpers/openclaw-test-instance.test.ts test/scripts/plugin-gateway-gauntlet.test.ts

Limits: the original interleaved Linux logs do not identify same-worker predecessor order, and the historical full shards were not replayed locally. Controlled failing synchronization regressions establish the mechanism. Exact-head hosted Linux CI is still required before landing. No browser screenshot is needed for these test-only changes. Historical introduction provenance is unknown; this does not attribute the flakes to the Android changes.

Follow-up: some generic dialog callers have owner-specific failure-teardown needs, especially token-reveal dialogs that intentionally reject cancellation. This patch preserves their behavior; blindly applying generic cancel-and-join cleanup would deadlock those fixtures.

Wait for lazy dialog modules before starting DOM readiness polling. Gate
subprocess timeout fixtures on native readiness and exit events while keeping
their original timeout, signal, pipe-drain, and ownership assertions.

Reproduced four dialog failures with delayed real imports and two subprocess
failures with delayed child startup; all six pass after synchronization.
Normal caller/owner coverage: 672 tests passed, one platform skip. Changed
gates and an independent Codex P0-P2 review passed. No production changes.

Related: #136934
Fixes #136708
@clawsweeper

clawsweeper Bot commented Sep 3, 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: M maintainer Maintainer-authored PR labels Sep 3, 2026
@steipete
steipete marked this pull request as ready for review September 3, 2026 06:42
@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 Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 3, 2026, 2:51 AM ET / 06:51 UTC.

ClawSweeper review

What this changes

The PR updates UI dialog and subprocess test fixtures so lazy imports and child startup complete before the tests begin timing the behavior they are intended to assert.

Regression provenance

Possible regression — suspected (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 2 items remain

No blocking source-level findings. This maintainer-authored PR preserves the asserted UI and process-cleanup behaviors while separating fixture bootstrap from their deadlines; exact-head CI remains the normal merge gate.

Priority: P3
Reviewed head: 6634ca86fa9ad58a0e81d38bb8baafa19b9ea814

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a coherent owner-boundary test repair with focused controlled evidence and no actionable defect found; hosted exact-head validation is still pending.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR changes test fixtures only; its supplied controlled UI and native-child fixture evidence is relevant validation, while exact-head CI remains the merge gate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR changes test fixtures only; its supplied controlled UI and native-child fixture evidence is relevant validation, while exact-head CI remains the merge gate.
Evidence reviewed 5 items Dialog readiness owner: The shared modal helper now waits for pending lazy imports before starting its unchanged DOM polling, and the changed placement callers use that helper. Existing UI tests elsewhere already use the same Vitest synchronization primitive, supporting the chosen fixture boundary.
Process-cleanup owner and caller: The gauntlet harness waits for descendant IPC readiness before ticking the existing timeout, then exercises the production controller’s parent-signal, kill-grace, process-group, and rethrow paths. The production owner starts timeout teardown at the child close event and rethrows a parent signal after cleanup.
Inherited-pipe regression boundary: The gateway fixture records native leader exit before advancing the teardown clock, retains the failed-restart assertion while inherited stderr is open, and restores the clock in both normal and abort cleanup paths.
Findings None None.
Security None None.

How this fits together

OpenClaw tests use shared fixtures to launch modal dialogs and managed child processes, then verify UI actions, process termination, and inherited-pipe cleanup. These changes affect that test synchronization layer rather than shipped Gateway or Control UI behavior.

flowchart LR
  A[Lazy dialog module] --> B[Shared dialog fixture]
  B --> C[DOM readiness assertion]
  D[Child process startup] --> E[Gauntlet controller]
  E --> F[Timeout and signal cleanup]
  C --> G[UI test result]
  F --> H[Process test result]
Loading

Before merge

  • Resolve merge risk (P1) - The direct Vitest synchronization contract and complete current-main source comparison could not be independently inspected in this node_modules-less partial checkout while GitHub DNS was unavailable; exact-head CI should remain required before merge.
  • Resolve review confidence - ClawSweeper must reach high confidence before merge readiness is known.
Agent review details

Security

None.

PR surface

Tests +97. Total +97 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 5 160 63 +97
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 160 63 +97

Review metrics

Metric Value Why it matters
Production versus test LOC production +0/-0; tests and test support +160/-63 All introduced lines are fixture/test synchronization and cleanup coverage; no shipped runtime surface grows.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #136708
Summary: This PR is the explicit proposed repair for the fixture-startup synchronization failures tracked by the linked issue.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the shared readiness boundary and native-event-driven process fixture, then merge once exact-head CI confirms the unchanged assertions across the supported environments.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the shared readiness boundary and native-event-driven process fixture, then merge once exact-head CI confirms the unchanged assertions across the supported environments.

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

Yes, at source level: the prior waits began before lazy-import or child-readiness completion, and the PR supplies controlled delayed-start scenarios. Local execution is intentionally unavailable in this read-only review checkout.

Is this the best way to solve the issue?

Yes, provisionally: moving the synchronization into the shared dialog fixture and using native readiness/exit events keeps the existing assertion deadlines intact instead of extending them or weakening cleanup checks.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is bounded test-fixture reliability cleanup with no claimed user-facing runtime change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR changes test fixtures only; its supplied controlled UI and native-child fixture evidence is relevant validation, while exact-head CI remains the merge gate.

Label justifications:

  • P3: This is bounded test-fixture reliability cleanup with no claimed user-facing runtime 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 maintainer-authored PR changes test fixtures only; its supplied controlled UI and native-child fixture evidence is relevant validation, while exact-head CI remains the merge gate.

Evidence

What I checked:

  • Dialog readiness owner: The shared modal helper now waits for pending lazy imports before starting its unchanged DOM polling, and the changed placement callers use that helper. Existing UI tests elsewhere already use the same Vitest synchronization primitive, supporting the chosen fixture boundary. (ui/src/test-helpers/modal-dialog.ts:45, 6634ca86fa9a)
  • Process-cleanup owner and caller: The gauntlet harness waits for descendant IPC readiness before ticking the existing timeout, then exercises the production controller’s parent-signal, kill-grace, process-group, and rethrow paths. The production owner starts timeout teardown at the child close event and rethrows a parent signal after cleanup. (scripts/check-plugin-gateway-gauntlet.mts:767, 6634ca86fa9a)
  • Inherited-pipe regression boundary: The gateway fixture records native leader exit before advancing the teardown clock, retains the failed-restart assertion while inherited stderr is open, and restores the clock in both normal and abort cleanup paths. (test/helpers/openclaw-test-instance.test.ts:1148, 6634ca86fa9a)
  • Introduction identity: The reviewed head has the verified merge-base parent and introduces the five supplied fixture/test-support edits; no product source or dependency manifest is changed. (test/scripts/plugin-gateway-gauntlet.test.ts:979, 6634ca86fa9a)
  • Current-main inspection limitation: The checkout identifies current origin/main as 71ccf51, but its promisor objects could not be retrieved because GitHub DNS was unavailable; a full source comparison with current main could not be completed locally. (71ccf5130b15)

Likely related people:

  • 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.

@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Ready to land 6634ca86fa9ad58a0e81d38bb8baafa19b9ea814: exact-head CI is completed/success, and native prepare passed without changing the head.

The Linux subprocess job ran both complete changed suites on Ubuntu 24.04.3: 104 passed, one existing Windows-only skip. Its actual log contains passing refusal/retry, inherited-stdio, UTF-8 trimming, and parent-termination-during-cleanup cases. This is hosted execution evidence, not just a green workflow badge. Local proof remains 672 passing caller/owner tests, six controlled RED→GREEN scenarios, and the passing changed checks documented above.

The fresh ClawSweeper review reported no source defect. Its two before-merge evidence gaps are covered:

  • Direct dependency inspection: installed Vitest 4.1.11 dist/chunks/test.DNmyFkvJ.js:3359–3420 confirms the independent 1,000 ms DOM wait; utils.BX5Fg8C4.js:48–56 recursively joins unresolved dynamic imports. Readiness waits for that import boundary, not pending user decisions. The paired real-module probes prove this distinction. A separate managed Codex P0–P2 review received the owner/dependency context and found no actionable issue.
  • Main comparison and CI: the affected files and their relevant runtime owners remain unchanged from the inspected base through main 2fa4ef7894547174d97f657f3f2189449e5cee04; the test framework versions are unchanged. Exact-head hosted validation is now green.

CI attempt 1 was retired only after a fresh 134-job census showed no executing jobs and one unassigned typecheck (check-test-types-core-4). GitHub refused to rerun that queued job. Once the stalled attempt was canceled, the targeted retry ran only that stripe and its dependent gate on the existing hosted fallback. Successful test jobs were preserved; no failed assertion was retried and no source, deadline, or shared runner setting changed.

The historical same-worker Linux ordering remains unknown, as documented. Production LOC remains 0; all changes are test/fixture synchronization and cleanup.

@steipete
steipete merged commit 24422bd into main Sep 3, 2026
348 of 350 checks passed
@steipete
steipete deleted the codex/test-modal-readiness-20260903 branch September 3, 2026 07:27
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Wait for lazy dialog modules before starting DOM readiness polling. Gate
subprocess timeout fixtures on native readiness and exit events while keeping
their original timeout, signal, pipe-drain, and ownership assertions.

Reproduced four dialog failures with delayed real imports and two subprocess
failures with delayed child startup; all six pass after synchronization.
Normal caller/owner coverage: 672 tests passed, one platform skip. Changed
gates and an independent Codex P0-P2 review passed. No production changes.

Related: openclaw#136934
Fixes openclaw#136708
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: 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.

tests: synchronize subprocess fixtures before deadline assertions

1 participant