Skip to content

fix(test): stabilize hardware and UI integration tests - #1302

Merged
shanselman merged 2 commits into
mainfrom
karkarl-fix-camera-test-flake
Sep 2, 2026
Merged

shanselman merged 2 commits into
mainfrom
karkarl-fix-camera-test-flake

Conversation

@karkarl

@karkarl karkarl commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • seed screen and camera consent in the isolated tray integration fixture so unattended MCP tests do not wait on modal UI
  • preflight video-capture devices before MediaCapture.InitializeAsync, returning a deterministic tool error when no camera exists or a requested device is unavailable
  • retry one delayed accessibility deep-link activation while retaining the original 10-second per-attempt readiness check and all Axe rules

Root cause

GitHub Actions run 33664243199 timed out in CameraSnap_ReturnsImageOrWellFormedError for two reasons: the isolated fixture had not granted newly required capture consent, then Windows left MediaCapture.InitializeAsync pending on a camera-less runner. The blocked MCP request also caused the following screen.snapshot request to time out.

The next PR run failed SandboxPage accessibility scanning before Axe executed. Its TRX showed the app-owned navigation acknowledgement missed the fixed 10-second window under sustained UI automation load. Five isolated Sandbox scans passed, and merely increasing the timeout later reproduced the same failure on Chat after 20 seconds. The harness now re-sends the idempotent deep link once. Hub same-page deduplication emits a fresh readiness signal, while a second failure still propagates and the full Axe scan remains unchanged.

Suppressing either test would hide real product or harness behavior and was not necessary.

Required proof pools

  • windows-winui-interactive: the real-process accessibility navigation harness changed and was exercised against the live isolated WinUI app.

Validation

  • ./build.ps1: passed
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: 3,873 passed, 32 skipped
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore: 2,824 passed
  • full OpenClaw.Tray.IntegrationTests on win-x64: 22 passed
  • focused camera and screen capture integration tests repeated five times: 10/10 passed
  • focused Sandbox accessibility scan repeated five times before the harness change: 5/5 passed
  • dotnet test ./tests/OpenClaw.Tray.UITests/OpenClaw.Tray.UITests.csproj -c Debug -r win-x64 --no-build --filter "Category=Accessibility": 21/21 passed after the retry change
  • rubber-duck reviews: no blocking findings; default-camera semantics and second-attempt failure propagation were verified

Real behavior proof

Current-head black-box MCP integration output on a Windows host without a camera:

Passed OpenClaw.Tray.IntegrationTests.McpHttpServerIntegrationTests.CameraSnap_ReturnsImageOrWellFormedError [541 ms]
Passed OpenClaw.Tray.IntegrationTests.McpHttpServerIntegrationTests.ScreenSnapshot_ReturnsImageOrWellFormedError [262 ms]

Current-head real-process Axe run:

Passed OpenClaw.Tray.UITests.AccessibilityScanTests.Page_PassesAccessibilityScan(pageName: "SandboxPage", pageTag: "sandbox", pageMarkerAutomationId: "SandboxPageMarker") [27 s]
Test Run Successful.
Total tests: 21
Passed: 21

Sandbox completing in 27 seconds demonstrates that the first bounded readiness attempt expired under sustained load, the idempotent retry recovered, and Axe still scanned the live page successfully. No visible UI changed, so screenshot proof is not applicable.

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

Copilot-Session: ffe78bbb-0a14-472d-9854-479c3d25430c
@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

@karkarl karkarl added the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Sep 2, 2026
@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. 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 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 6:40 PM ET / 22:40 UTC.

ClawSweeper review

What this changes

The PR preflights camera devices before capture, grants consent in the isolated integration fixture, and retries one delayed deep-link activation in the live accessibility harness.

Merge readiness

✅ Ready for maintainer review

Keep open. The PR has a distinct, bounded fix beyond current main’s consent-prompt timeout: it prevents camera-less hosts from entering MediaCapture initialization and retries a lost accessibility activation. The current head has direct Windows MCP and real-process accessibility evidence, with no blocking review finding.

Priority: P2
Reviewed head: 4de81be9a77ad1bb83e97a4bc8e773b6341dc320

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused patch with direct current-head Windows MCP and real-process accessibility evidence, and no blocking defect found.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The changed camera owner is exercised through the local MCP camera.snap integration path on a Windows host without a camera, where it returned within 541 ms; the changed accessibility harness is exercised against the isolated real WinUI process, where the retry reached Sandbox and the complete 21-test Axe run passed.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed camera owner is exercised through the local MCP camera.snap integration path on a Windows host without a camera, where it returned within 541 ms; the changed accessibility harness is exercised against the isolated real WinUI process, where the retry reached Sandbox and the complete 21-test Axe run passed.
Evidence reviewed 5 items Introduced camera preflight: The introduced helper enumerates video devices before MediaCapture initialization, returns the default-device behavior for an empty request, and rejects unavailable requested IDs; both snapshot and clip paths call it.
Current-main consent fix is complementary: Current main’s merged commit #1300 bounds unanswered capture-consent prompts at three seconds in the isolated fixture. This PR instead seeds isolated consent and reaches the separate camera-device initialization path.
Retry matches app navigation semantics: The retry waits for both the app-owned signal and the requested UI Automation marker. Same-page hub navigation writes a fresh readiness signal without duplicating the page, so resending the identical deep link is compatible with the application path.
Findings None None.
Security None None.

How this fits together

The tray app exposes camera capture through its local MCP server, which passes approved requests to Windows MediaCapture. Its UI accessibility suite opens the isolated WinUI app through deep links and waits for app-owned readiness signals before running Axe.

flowchart LR
  A[Local MCP camera request] --> B[Consent gate]
  B --> C[Camera device preflight]
  C --> D[Windows MediaCapture]
  E[Accessibility test] --> F[Deep-link activation]
  F --> G[Hub navigation signal]
  G --> H[Live Axe scan]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 3 files, production +32, tests +29 The production growth is limited to camera validation; the remaining changes keep isolated integration and accessibility tests deterministic.
Behavior evidence 2 MCP cases passed in 803 ms; 21 accessibility tests passed The supplied current-head runs exercise both the camera-less MCP path and the delayed WinUI navigation path.

Technical review

Best possible solution:

Merge the small preflight and retry changes after normal checks complete, retaining the direct Windows MCP and real-process accessibility coverage as the regression guard.

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

Yes. The source identifies the camera-less MediaCapture path and the bounded readiness retry, and the PR provides current-head Windows MCP and real-process accessibility results for those paths.

Is this the best way to solve the issue?

Yes. Device enumeration is a narrow guard before the hanging initialization path, while one idempotent deep-link retry preserves the existing timeout and failure behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded reliability repair for Windows hardware and UI integration paths, without evidence of an active user-facing outage.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster 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 changed camera owner is exercised through the local MCP camera.snap integration path on a Windows host without a camera, where it returned within 541 ms; the changed accessibility harness is exercised against the isolated real WinUI process, where the retry reached Sandbox and the complete 21-test Axe run passed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed camera owner is exercised through the local MCP camera.snap integration path on a Windows host without a camera, where it returned within 541 ms; the changed accessibility harness is exercised against the isolated real WinUI process, where the retry reached Sandbox and the complete 21-test Axe run passed.

Evidence

What I checked:

Likely related people:

  • Scott Hanselman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Caleb Eden: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Karen Lai: 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-02T21:00:28.841Z sha ab23d5c :: needs maintainer review before merge. :: none

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

Copilot-Session: ffe78bbb-0a14-472d-9854-479c3d25430c
@karkarl karkarl changed the title fix(test): avoid camera capture timeouts fix(test): stabilize hardware and UI integration tests Sep 2, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 2, 2026
@shanselman
shanselman merged commit 0b5d860 into main Sep 2, 2026
23 checks passed
@shanselman
shanselman deleted the karkarl-fix-camera-test-flake branch September 2, 2026 23:03
@shanselman shanselman removed the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Sep 2, 2026
larroy pushed a commit to larroy/openclaw-windows-node that referenced this pull request Sep 3, 2026
* fix(test): avoid camera capture timeouts

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

Copilot-Session: ffe78bbb-0a14-472d-9854-479c3d25430c

* fix(test): retry delayed UI navigation

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

Copilot-Session: ffe78bbb-0a14-472d-9854-479c3d25430c

---------

Copilot-Session: ffe78bbb-0a14-472d-9854-479c3d25430c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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.

2 participants