fix(focus): prime VS Code's Electron AX tree so suggestions work#671
Merged
Conversation
VS Code produced no suggestions anywhere (editor, Copilot chat, OR the integrated terminal) because the Electron AX-priming allowlist only held ClickUp. Chromium/Electron build their web accessibility tree lazily, so without AXManualAccessibility priming VS Code's tree stays dormant and no focused text element ever resolves. Debug logs confirm it: Chrome, cmux, Finder, etc. all resolve focus, but 'Code' never appears once. Add the VS Code family (Code, Insiders, VSCodium) to the priming allowlist and make isElectronEditor case-insensitive: VS Code's real bundle id is the mixed-case com.microsoft.VSCode, which the prior exact Set.contains would have missed even after adding it. Cursor/Windsurf stay uncovered (opaque ToDesktop bundle ids that change per build); noted inline.
Observed live on VS Code: the first AXManualAccessibility write returns success on a long-running process, yet the web-AX tree stays dormant for minutes; a later re-assert wakes it promptly. Re-prime named Electron editors on every activation edge (one cheap AX write per app switch) instead of once per PID. Chromium browsers keep once-per-PID, which already works for them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VS Code produced no suggestions anywhere (editor, chat, integrated terminal), even with the integrated-terminal setting on, while OCR kept working. Root cause: the Electron AX-priming allowlist (
BrowserAppDetector.electronEditorBundleIdentifiers) only contained ClickUp, so Cotabby never setAXManualAccessibilityon VS Code and its lazily-built web accessibility tree stayed dormant — no focused text element ever resolved.Two changes:
isElectronEditorcase-insensitive (VS Code's real bundle id is the mixed-casecom.microsoft.VSCode, which the prior exactSet.containswould have missed).AXManualAccessibilitywrite returns success but the tree stays dormant for minutes; a re-assert on app switch wakes it promptly. Chromium browsers keep the existing once-per-PID behavior.Validation
Verified live on a macOS 26 machine with the dev build (
Cotabby Dev,-cotabby-debug), driving real VS Code:CHROME-PRIME enabled web accessibility for Code(never present in any pre-fix log).Resolve timing: app=Code …up tocapability=Supported; terminal caretderived primary, chat caretexact primary.xterm-helper-textareafocused, confirmed via direct AX query):cotabbySuggestInIntegratedTerminals=1→ no terminal suppression; prediction pipeline proceeds.=0→Predictions disabled: Cotabby is not available in the integrated terminal.capability=Supportedwithin ~200 ms of launch against an already-frontmost VS Code.Linked issues
Refs the "no suggestions in VS Code" report.
Risk / rollout notes
native-edit-context, whoseAXValuestays empty (and the editor's focus proxy has a zero-width frame), so those surfaces resolve but cannot produce content-aware suggestions yet — that needs a native-edit-context text source (follow-up; related to the TextKit caret work).AXManualAccessibilitywrite per activation of a named Electron editor; Chromium browsers unchanged.suggestInIntegratedTerminals(off by default).Greptile Summary
This PR fixes VS Code (and VSCodium / VS Code Insiders) receiving no suggestions by adding them to the Electron AX-priming allowlist and making the
isElectronEditorcheck case-insensitive — VS Code's real bundle id is the mixed-casecom.microsoft.VSCode, which the prior case-sensitiveSet.containssilently missed.BrowserAppDetector.swift: Addscom.microsoft.vscode,com.microsoft.vscodeinsiders, andcom.vscodiumtoelectronEditorBundleIdentifiers(all lowercased) and lowercases the input inisElectronEditorbefore the Set lookup.ChromiumAccessibilityEnabler.swift: IntroduceslastFrontmostPIDto track activation edges; Electron editors are re-primed on every app-switch back, working around VS Code's observed behaviour of ignoring the firstAXManualAccessibilitywrite.BrowserAppDetectorTests.swift: New assertions cover VS Code's mixed-case bundle id, Insiders, VSCodium, and the Discord negative case, with aneedsWebAccessibilityPrimingsmoke test for the mixed-case id.Confidence Score: 5/5
Safe to merge — the change wakes VS Code's AX tree the same way Chrome and ClickUp have been primed all along, using no new mechanism.
The core fix (lowercasing before the Set lookup and adding the VS Code bundle ids) is straightforward and well-tested. The activation-edge re-priming in ChromiumAccessibilityEnabler is narrowly scoped to isElectronEditor apps and incurs at most one extra AX write per app switch. Chromium browsers retain the existing once-per-PID path untouched. The lastFrontmostPID update is placed before the needsWebAccessibilityPriming guard, so it correctly tracks activation edges even for apps that are not primed. No data is persisted, no new IPC is introduced, and the change is fully reversible.
No files require special attention.
Important Files Changed
Reviews (2): Last reviewed commit: "fix(focus): re-assert Electron editor pr..." | Re-trigger Greptile