fix(cua-driver/windows): retry transient BuildUpdatedCache failures instead of returning elements=0 (#1881) - #1996
Conversation
…nstead of returning elements=0 (#1881) A single transient UIA provider error (commonly E_FAIL / 0x80004005 from a control rebuilding its automation subtree mid-walk) made get_window_state return an empty tree (elements=0), forcing all element_index tools to fall back to pixel clicks for that window. The same call usually succeeds moments later. Retry the bulk BuildUpdatedCache up to 3 times with a 40ms backoff before giving up, and report the attempt count in the failure message. Addresses the issue's suggestion #1 (retry) + part of #3 (diagnostics). The per-node partial-tree fallback (suggestion #2) remains a larger follow-up. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KMXCW4M5uK1HRGjjH4wueZ
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn ChangesBuildUpdatedCache Retry Logic
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Linux visual regression artifactsMatrix jobs now run independently. Download visual artifacts from this workflow run.
|
Problem
get_window_statesometimes returns an empty tree (elements=0) withBuildUpdatedCache failed: Unbekannter Fehler (0x80004005)— even though the same call returned a full tree moments earlier. One misbehaving/transient UIA provider (e.g. a rich-text control rebuilding its automation subtree, or a virtualized list re-realizing items) takes down the entire snapshot, forcing everyelement_indextool (click, type_text, …) down to pixel coordinates for that window. Fixes #1881.Root cause
uia/mod.rsdid a singleBuildUpdatedCache(TreeScope_Subtree)on the window root and hard-failed on any error — no retry, no fallback. A transientE_FAILfrom one provider yields a total outage:Fix
Retry the bulk cache build up to 3 attempts with a 40 ms backoff before giving up (the issue notes a second call right after frequently succeeds), and report the attempt count in the failure message. This is the issue's suggestion #1 (retry) plus part of #3 (diagnostics).
The per-node partial-tree fallback (suggestion #2 — return
elements=Nfor the subtrees that did resolve, skipping the broken one) is a larger change to the walker and is left as a follow-up.Verification
windowscrate):cargo build -p platform-windowsrecompiled green at commit17adb54.IRawElementProviderFragmentreturningE_FAILfrom one child) would make a good regression test — noted in the issue.🤖 Generated with Claude Code
Summary by CodeRabbit