Skip to content

fix: disabled onboarding actions report the wrong automation error - #2050

Merged
karkarl merged 1 commit into
openclaw:mainfrom
karkarl:karkarl-fix-current-model-uia
Nov 6, 2026
Merged

karkarl merged 1 commit into
openclaw:mainfrom
karkarl:karkarl-fix-current-model-uia

Conversation

@karkarl

@karkarl karkarl commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Related: #1980 (fix: keep cancellation diagnostics when setup closes). This is an independent fix; it does not include that PR's changes.

What Problem This Solves

Fixes: native UI Automation reports a disabled onboarding action as unavailable when its client worker carries unrelated COM error information.

User Impact

User impact: assistive tools receive a disabled-action error without activating the action or mistaking the still-mounted card for a removed control. No visual, configuration, or migration changes.

Why This Change Was Made

SetupActionCard returned XAML's E_ELEMENTNOTENABLED (0x802B001E), not native UIA_E_ELEMENTNOTENABLED (0x80040200). WPF's UIA client handles the former through Marshal.ThrowExceptionForHR, which can substitute a stale caller-thread IErrorInfo exception. Return the standard native HRESULT at the existing guard, with no change to dispatch, mounting, or action policy.

The original CI worker's stale-error producer is unknown. The failure mechanism is independently reproduced, not inferred solely from a passing rerun. No x64 runtime validation was available locally.

Evidence

  • Original failure: Build and Test attempt 3, UI job, PR head 35cddeea46223a26ef779905cc151c9fadaac6a7. disabled: True expected COMException, received ElementNotAvailableException; the non-clickable case and enabled positive control passed. This is historical CI evidence, not this PR's CI result.
  • Before repair, seeding unrelated client-thread error info with Marshal.GetHRForException(new System.Windows.Automation.ElementNotAvailableException()) immediately before disabled native Invoke reproduced that exact exception mismatch locally: 1 failed, 2 passed. No card/window removal was needed.
  • After repair, the same seeded condition requires exact ElementNotEnabledException and 0x80040200. Both availability cases and enabled native activation passed: 3 passed, zero skipped.
  • The same runtime ID, disabled state after rejection, identical loaded managed card, shared non-null XamlRoot, dispatcher drain, detection-only calls, and zero completion guard against accepting stale elements or silently executing disabled actions.
  • Independent rubber-duck implementation/proof review found no blocking correctness issue. Its implementation-detail and cleanup-constant clarity suggestions are nonblocking; no additional code change was made. Source comparison used git diff --binary --output=... and SHA256, not a shell text-pipeline hash. Simplification review retained the three-file fix with no new abstraction.

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

  • windows-winui-interactive: native onboarding accessibility behavior changes. Focused offscreen native UIA tests ran; the full interactive accessibility scan and visible/compositor proof have not run. This declaration is not a completed-pool claim.

Validation

Local Debug validation on Windows ARM64, .NET SDK 10.0.403. Set OPENCLAW_REPO_ROOT to the task worktree. All tests used dedicated temporary OPENCLAW_TRAY_DATA_DIR, OPENCLAW_TRAY_APPDATA_DIR, and OPENCLAW_TRAY_LOCALAPPDATA_DIR roots. Managed tests cleared OPENCLAW_STATE_DIR, OPENCLAW_RUN_INTEGRATION, and OPENCLAW_RUN_GPU_PROOF.

Exact command Result
.\build.ps1 Passed, all five projects, native ARM64
dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore --logger 'trx;LogFileName=shared-final.trx' --results-directory .\TestResults\SharedFinal --verbosity quiet 4,867 passed, 24 ordinary skips, zero failed
dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --logger 'trx;LogFileName=tray-final.trx' --results-directory .\TestResults\TrayFinal --verbosity quiet 5,234 passed, zero skipped/failed
dotnet test .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Debug -r win-arm64 --filter 'FullyQualifiedName~CurrentModel_NativeUia' --logger 'trx;LogFileName=current-model-repaired.trx' --results-directory .\TestResults\CurrentModelRepaired --verbosity quiet 3 passed, zero skipped/failed
dotnet test .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Debug -r win-arm64 --no-build --filter 'FullyQualifiedName~OnboardingAiPageTests&Category!=NativeOnboardingProof' --logger 'trx;LogFileName=onboarding-repaired.trx' --results-directory .\TestResults\OnboardingRepaired --verbosity quiet 106 passed, zero skipped/failed
.\scripts\validate-docs.ps1 Passed, 72 Markdown files
git -c core.whitespace=cr-at-eol diff --check Passed; preserves the production file's existing CRLF
.\scripts\setup-dev.ps1 -CheckOnly Passed, ARM64 prerequisites

Fresh-worktree managed --no-restore attempts initially failed NETSDK1004. Both projects then executed successfully without that flag to restore assets, followed by a successful rerun of the full build and both required --no-restore commands. The initial focused -r win-x64 test launch aborted before executing tests because no x64 .NET host is installed; the executed native proof is ARM64 only.

Real Behavior Proof

  • Environment tested: Windows ARM64, Debug win-arm64, fixture-owned offscreen HWND and isolated profiles, synthetic PageTransport; no real Gateway or OS input.

  • PR head or commit tested: f96fd5ce5fcea880861b621af4c02cca401a1201. Tests ran on the identical uncommitted three-file source on parent 04f413d26531d3ea19cb108291334bb3cc5fd6e6 before commit. Manually recorded binary-capable diff SHA256: BB338051A8EA62A440175E9759043A468BF3179ADC0E2610C0E261FC5061AAA6, rechecked unchanged before commit. This is source correspondence, not a new post-commit execution or formal binary freeze.

  • Exact steps or command run: the FullyQualifiedName~CurrentModel_NativeUia command in Validation, covering CurrentModel_NativeUiaRespectsActionAvailability for disabled: True and False, plus CurrentModel_NativeUiaInvokeStartsTheSelectedActivation.

  • Evidence after fix:

    Passed!  - Failed:     0, Passed:     3, Skipped:     0, Total:     3, Duration: 599 ms - OpenClaw.Tray.UITests.dll (net10.0)
    Passed!  - Failed:     0, Passed:   106, Skipped:     0, Total:   106, Duration: 31 s - OpenClaw.Tray.UITests.dll (net10.0)
    
  • Observed result: disabled Invoke returns typed native disabled error despite stale COM error info; the card remains mounted and no activation/completion occurs. Non-clickable cards advertise no Invoke; the enabled native action activates and verifies the selected model once.

  • Screenshot or artifact links verified? (Yes/No/N/A): N/A. Copied local execution output above; no public screenshot or local-file link presented as public evidence.

  • Not verified or blocked: no x64 runtime run, no full interactive accessibility scan or pixel/compositor proof, no formal proof-pool completion. Exact producer of stale IErrorInfo in the historical CI worker is unknown. No real Gateway, WSL, installed Companion, or shared services were changed or driven. Hosted checks on this PR are pending, not claimed passed.

Security Impact

  • New permissions or capabilities? (Yes/No): No
  • Secrets or tokens handling changed? (Yes/No): No
  • New or changed network calls? (Yes/No): No
  • Command or tool execution surface changed? (Yes/No): No. Existing native UIA invocation availability is preserved; only its disabled error is corrected.
  • Data access scope changed? (Yes/No): No
  • If any answer is Yes, explain the risk and mitigation: N/A.

Compatibility and Migration

  • Backward compatible? (Yes/No): Yes. Native clients now receive the standard disabled-action HRESULT; callers depending on the prior XAML-specific code should use the UIA contract.
  • Config or environment changes? (Yes/No): No
  • Migration needed? (Yes/No): 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.

Return the standard UIA disabled HRESULT so native clients do not substitute stale worker-thread COM error info. Retain deterministic stale-error, mounted-lifetime, and no-activation coverage.

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

clawsweeper Bot commented Nov 6, 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 P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 6, 2026
@clawsweeper

clawsweeper Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR returns the standard native disabled-action error and strengthens onboarding automation regression coverage.

Example: An automation client invokes a disabled Current model card while its worker carries stale ElementNotAvailableException error information.

  • Before: The XAML HRESULT 0x802B001E can surface as ElementNotAvailableException.
  • After: Native UIA receives 0x80040200 and reports ElementNotEnabledException without activating the card.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct contract repair with useful native-boundary regression evidence; proof remains harness-based rather than shipped-app execution.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored PR is outside the ordinary contributor proof gate; its supplied output exercises production SetupActionCard through native UIA on an ARM64 offscreen fixture, with synthetic Gateway responses and explicit runtime limits.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Assistive tools can mistake a disabled onboarding card for a removed control.
Reason: The change restores the native accessibility contract at low cost; collaborator authorship already establishes direction, and no new policy or option is introduced.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes a concrete native accessibility error still present on main, and review found no introduced defect.

Priority: P2
Reviewed head: f96fd5ce5fcea880861b621af4c02cca401a1201

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Supplied base-fail/head-pass evidence covers mounted ARM64 native UIA; installed Companion and x64 execution were not supplied.
Agent review details

How this fits together

SetupActionCard bridges native UI Automation Invoke requests to existing onboarding handlers; disabled requests are rejected before dispatch.

flowchart LR
  A[Assistive client] --> B[Native UI Automation]
  B --> C[SetupActionCard peer]
  C --> D[Disabled action error]
  C --> E[UI dispatcher]
  E --> F[Guarded onboarding handler]
Loading

Technical review

Best possible solution:

Retain the existing automation peer and availability guard, returning the native disabled HRESULT with focused stale-error and no-activation coverage.

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

Source and native client error mapping establish the failure path, and the author reports a deterministic seeded pre-fix failure followed by repaired passes; this read-only review ran no target code.

Is this the best way to solve the issue?

This is the smallest complete repair: correct the error at its production owner while preserving availability, dispatch, mounting, and guarded action behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against c714954e6677.

Provenance checked

  • SetupActionCard disabled invocation and native regression changes intended behavior with a stated reason (7ef81ba: Expose native Invoke for onboarding cards while retaining guarded action handling; the earlier regression expected the XAML-specific disabled HRESULT.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Paul Campbell: Raw commit 7ef81ba adds src/OpenClaw.SetupEngine.UI/Controls/SetupActionCard.cs:17 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7ef81bac1ec6; files: src/OpenClaw.SetupEngine.UI/Controls/SetupActionCard.cs)
  • Scott Hanselman: Raw commit 2e5e219 adds tests/OpenClaw.Tray.UITests/OnboardingAiPageTests.cs:1818 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 2e5e219ade50; files: tests/OpenClaw.Tray.UITests/OnboardingAiPageTests.cs)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Introduced scope Production +5/-2; tests +23/-2; documentation +1 The small production repair reuses the existing owner; test growth protects stale-error handling, lifetime, and rejection without adding a fixture.

Labels

Label changes:

  • add P2: Incorrect disabled-action reporting affects assistive automation under a specific COM error-state condition, with no demonstrated activation bypass or general onboarding outage.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Incorrect disabled-action reporting affects assistive automation under a specific COM error-state condition, with no demonstrated activation bypass or general onboarding outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 6, 2026, 5:45 PM ET / 22:45 UTC.

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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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