Skip to content

fix(tests): wait for onboarding cards before invocation - #1559

Closed
bkudiess wants to merge 1 commit into
mainfrom
bkudiess-onboarding-ci-readiness
Closed

bkudiess wants to merge 1 commit into
mainfrom
bkudiess-onboarding-ci-readiness

Conversation

@bkudiess

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes a synchronization gap that lets onboarding framework UI tests invoke an AI choice card before that card is ready.

Related: #1558 (fix(setup): show icon in window preview), whose rebased CI failed before the Local AI error scenario was exercised. The test/helper originated in #1531 (feat: guide Windows onboarding from setup to native AI tasks).

User Impact

No product or user-visible behavior changes. CI tests wait for the actual card instead of assuming panel visibility means its controls are ready.

Why This Change Was Made

The card-invocation helper now waits up to 10 seconds for IsLoaded, IsEnabled, IsClickEnabled, and attachment to the page's non-null XamlRoot. It retains the strict invocation assertion and XAML handler validation. Timeout diagnostics report each readiness property. Native input proof remains unchanged.

The original intermittent failure did not reproduce in five local baseline runs (56 tests each), so the exact property that was false in CI remains unknown. This fixes the identified synchronization gap without claiming the original race was conclusively reproduced.

Evidence

Four new regression cases verify that invocation waits for each readiness flag and that a permanently click-disabled card times out with diagnostic state without invoking its action. All 60 focused onboarding tests and the hosted-framework-equivalent Tray UI suite pass locally.

Automated review is blocked, not clean: python .agents\skills\autoreview\scripts\autoreview --mode commit --commit 8912d67fb87ad7bc5b49f4e41c96bbbcd5fa7ceb reached the default Codex engine but failed with HTTP 401 Unauthorized. A retry using the same engine also failed authentication. No review findings were produced. This PR remains draft pending review and CI.

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required proof pools

  • none: only framework test synchronization, diagnostics, regression tests, and test documentation change. No product UI, native-input path, gateway behavior, or custom host capability changes.

Validation

All commands used OPENCLAW_REPO_ROOT and session-isolated OPENCLAW_TRAY_DATA_DIR, OPENCLAW_TRAY_APPDATA_DIR, and OPENCLAW_TRAY_LOCALAPPDATA_DIR. Fresh Shared/Tray test projects were built first so the required --no-restore runs executed real tests.

Command Result
.\build.ps1 Passed, all five projects
dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore 4,215 passed, 34 skipped, 0 failed
dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore 3,609 passed, 0 failed
dotnet test .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -r win-x64 --filter "FullyQualifiedName~OnboardingAiPageTests&Category!=NativeOnboardingProof" 60 passed, 0 failed
dotnet test .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -r win-x64 --no-build --filter "Category!=Accessibility&Category!=NativeOnboardingProof" 407 passed, 6 skipped, 0 failed

Real Behavior Proof

  • Environment tested: local Windows, real WinUI runtime, isolated framework-test window and settings roots.
  • PR head or commit tested: 8912d67fb87ad7bc5b49f4e41c96bbbcd5fa7ceb. Validation ran immediately before committing; all three changed files retained identical SHA256 hashes through publication.
  • Exact steps or command run: focused onboarding and framework Tray UI commands above.
  • Evidence after fix: LocalAi_InvocationWaitsForCardReadiness passes for IsLoaded, IsEnabled, and IsClickEnabled. Each case blocks readiness, verifies no invocation/completion, restores readiness, and verifies exactly one action and completion. LocalAi_ReadinessTimeoutReportsCardStateWithoutInvoking passes with state-specific timeout diagnostics and zero actions/completions. The originally failing LocalAi_ConfirmedFailureShowsRepairAndProviderChoices passes.
  • Observed result: all four new regression cases and the original error-path case pass. Real roaming/local OpenClawTray file metadata was unchanged before/after isolated test runs.
  • Screenshot or artifact links verified? N/A. TRX/logs retained locally; copied runtime totals above are the published evidence. No native input or compositor proof is claimed.
  • Not verified or blocked: exact original CI false property remains unknown; hosted CI for this commit and independent automated review are pending. Native onboarding/accessibility proof was not run because production UI is unchanged.

Security Impact

  • New permissions or capabilities? No
  • Secrets or tokens handling changed? No
  • New or changed network calls? No
  • Command or tool execution surface changed? No
  • Data access scope changed? No
  • If any answer is Yes, explain the risk and mitigation: N/A

Compatibility and Migration

  • Backward compatible? Yes
  • Config or environment changes? No
  • Migration needed? No
  • If yes, list the exact upgrade steps: N/A

Review Conversations

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

Wait for loaded, enabled, click-enabled cards on the page XamlRoot before invoking onboarding AI actions. Report readiness flags on timeout and cover delayed readiness and blocked invocation.

Co-authored-by: Copilot App <[email protected]>
@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

🦞👀
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.

@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. 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 30, 2026
@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed September 30, 2026, 6:59 PM ET / 22:59 UTC (Revision 3).

ClawSweeper review

What this changes

The branch makes framework UI tests wait for onboarding AI cards to become ready, adds delayed-readiness and timeout cases, and documents the test behavior.

Merge readiness

✅ Ready for maintainer review

Current main still invokes onboarding test cards without waiting for readiness. This PR addresses that distinct test gap, and the merged setup-icon PR does not include the fix. No blocking defect was found in the introduced patch.

Priority: P3
Reviewed head: 8912d67fb87ad7bc5b49f4e41c96bbbcd5fa7ceb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test repair has direct framework-runtime evidence and no identified blocking defect, with the original intermittent condition still unconfirmed.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The changed test helper was exercised through mounted onboarding pages in a real Windows WinUI framework test window. The captured PR body reports that the reviewed head passed all 60 focused cases, including delayed-readiness and timeout observations; the original intermittent CI state remains unidentified. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The changed test helper was exercised through mounted onboarding pages in a real Windows WinUI framework test window. The captured PR body reports that the reviewed head passed all 60 focused cases, including delayed-readiness and timeout observations; the original intermittent CI state remains unidentified. No stored-data contract changes.
Evidence reviewed 7 items Introduced readiness wait: The branch waits for loaded, enabled, click-enabled, and matching non-null XamlRoot state before the existing XAML handler assertion.
Focused regression coverage: Three cases hold individual readiness flags false before releasing them; a fourth checks timeout diagnostics and zero action invocations.
Current main still has the gap: The current-main helper immediately asserts card readiness, and the onboarding test caller invokes it without a readiness wait. The three affected files are unchanged between the PR base and fetched main.
Findings None None.
Security None None.

How this fits together

Framework UI tests mount the onboarding page in a WinUI test window and invoke its AI choice cards through their XAML handlers. Card state determines whether the test invokes an action or reports a readiness timeout.

flowchart LR
 A[Mounted onboarding page] --> B[AI choice card]
 B --> C{Card ready?}
 C -->|Yes| D[XAML action assertion]
 C -->|Timeout| E[State diagnostics]
 D --> F[Framework test result]
 E --> F
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Code growth production +0, tests +89, docs +1 The added lines are focused test coverage and documentation, with no product runtime change.

Technical review

Best possible solution:

Keep the readiness guard and deterministic timeout coverage in the framework tests while retaining native input proof in its separate suite.

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

No high-confidence recreation of the original intermittent CI failure is available; five reported baseline runs did not fail. Current-main source and deliberately blocked card states establish the narrower invocation-before-readiness gap.

Is this the best way to solve the issue?

Yes. Reusing the existing render-condition wait before the XAML handler assertion is a focused repair, and the new cases check both eventual invocation and timeout behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This stabilizes framework UI tests without changing user-visible product behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The changed test helper was exercised through mounted onboarding pages in a real Windows WinUI framework test window. The captured PR body reports that the reviewed head passed all 60 focused cases, including delayed-readiness and timeout observations; the original intermittent CI state remains unidentified. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed test helper was exercised through mounted onboarding pages in a real Windows WinUI framework test window. The captured PR body reports that the reviewed head passed all 60 focused cases, including delayed-readiness and timeout observations; the original intermittent CI state remains unidentified. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Barbara Kudiess: Raw commit 3eed1f1 adds tests/OpenClaw.Tray.UITests/TestSupport.cs:27 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3eed1f1bac56; files: tests/OpenClaw.Tray.UITests/TestSupport.cs)
  • Chris Anderson: Raw commit 9fa43f3 adds tests/OpenClaw.Tray.UITests/TestSupport.cs:23 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 9fa43f347703; files: tests/OpenClaw.Tray.UITests/TestSupport.cs)

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 (2 earlier review cycles)
  • reviewed 2026-09-30T22:35:06.520Z sha 8912d67 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-30T22:41:22.430Z sha 8912d67 :: needs maintainer review before merge. :: none

@bkudiess
bkudiess marked this pull request as ready for review September 30, 2026 22:39
@bkudiess
bkudiess marked this pull request as draft September 30, 2026 22:55
@bkudiess bkudiess closed this Oct 1, 2026
shanselman added a commit that referenced this pull request Oct 6, 2026
Adapt the framework readiness seam from closed unmerged PR #1559, original commit 8912d67. Wait for the exact AI action card without changing native input or product behavior, retain strict XAML handler checks, and add delayed-state and timeout regressions.

Co-authored-by: [email protected] <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant