Repository navigation
Description
Summary
Some users report that Omi Desktop cannot see what is on their screen, while local repro on David's machine works. Current prod/beta telemetry is not sufficient to tell whether current reports are permission/capture failures, Rewind DB/image failures, local-tool policy/approval failures, or model/tool-routing failures.
This issue should do both:
- Add end-to-end telemetry for screen context availability and use.
- Fix the most likely root causes that make screen context unavailable or unusable.
Evidence from quick production/beta check
PostHog project Omi (project_id=302298), macOS prod namespace com.omi.computer-macos, last 30d:
| Metric | Value |
|---|---|
| Active macOS users | 4,288 |
Screen Capture Broken Detected users |
65 |
Screen Capture Broken Detected events |
2,842 |
| Affected user rate | 1.52% |
| Screen reset clicked users | 33 |
| Screen reset completed users | 34 |
| Screen permission requested users | 930 |
| Screen permission granted users | 612 |
| Chat users | 510 |
Chat users with Chat Message Sent.has_context=true |
9 |
| Rewind screenshot viewed users | 597 |
14-day daily trend showed Screen Capture Broken Detected basically absent after 2026-06-26, so current reports are not well explained by that event alone.
Sentry examples:
OMI-DESKTOP-20A—Screen Capture Broken Detected: 37 events / 11 users, last seen 2026-06-23.OMI-DESKTOP-16—ScreenCaptureKit: Permission request failed: The user declined TCCs...: 2,370 events / 795 users, last seen 2026-06-23.OMI-DESKTOP-1T8—PTTContextVocabulary: failed to load screenshot context: Rewind database is not initialized: 7 events / 3 users, last seen 2026-06-21.- Rewind DB/image failures also exist, e.g. malformed screenshot DB / OCR backfill failures.
Local sanity check on David's machine:
- Local API status reports
screen_history_available: true,database_available: true, 16k+ indexed screenshots, latest capture current. - Local tools exposed include
get_local_status,get_screenshot,get_work_context.
Current instrumentation gaps
Chat Message Sent.has_context is not a valid screen-awareness metric today:
- In
ChatPage.swift/DashboardPage.swift, it is set fromselectedApp != nil, not from actual screen context availability. - Dashboard chat emits
has_context=falseeven when screen context may be available.
chat_agent_query_completed.tool_names can show that a tool like capture_screen was requested, but not whether:
- the capture succeeded,
- permissions failed,
get_work_context.screen_now.availablewas true,- OCR/timeline was present,
get_screenshotimage bytes were loadable,- the agent actually used the screen result.
desktop_health_event had no recent screen/context rows in the quick query.
Likely root causes to investigate/fix
-
Permission/capture state
- ScreenCaptureKit/TCC denial or stale state.
- Existing recovery path lives around
ScreenCaptureService.isScreenCaptureKitBroken()andProactiveAssistantsPlugin.attemptAutoReset(). - Verify reset/recovery UX and ensure failures emit structured telemetry.
-
Rewind DB/image availability
get_work_contextdepends on recent finalized Rewind frames and image loadability.- Failures can come from database unavailable, active chunk pending, missing image, corrupted chunk, or malformed DB.
LocalAgentAPIServer.screenshotUnavailableResponsealready classifies someget_screenshotfailures; emit telemetry for these.
-
Local tool policy / approval path
ChatToolExecutor.localPolicyDecisiondeniescapture_screen/get_screenshotwithapproval_requiredunless the proper approval/grant flow is used.- Make sure desktop chat handles that denial by surfacing approval / retrying correctly rather than making the model answer as if it cannot see the screen.
-
Model/tool routing
- Tool descriptions say to call
capture_screenwhen asked what is on screen, whileget_work_contextgives current screen plus timeline and is likely the better first tool for desktop chat. - Ensure prompts/tool priority route screen-awareness questions to
get_work_contextfirst, andget_screenshotonly when pixels are needed.
- Tool descriptions say to call
-
Telemetry semantics
- Replace or deprecate
Chat Message Sent.has_context; it currently means selected app/persona context, not screen context.
- Replace or deprecate
Proposed telemetry
Add one structured event, for example Screen Context Tool Result / desktop_screen_context_result, emitted for local desktop screen-context tools:
Required properties:
tool_name:get_work_context,capture_screen,get_screenshot,search_screen_historysurface:dashboard_chat,main_chat,floating_bar,voice,local_api, etc.ok: booleanfailure_code: enum/null, e.g.permission_denied,database_unavailable,screen_now_unavailable,screenshot_pending,screenshot_file_missing,screenshot_chunk_corrupted,image_unavailable,policy_approval_required,capture_failed,unknownscreen_now_available: boolean/nulltimeline_count: number/nulllatest_capture_age_seconds: number/nullhas_ocr_preview: boolean/nullimage_bytes_bucket:0,1-50kb,50-250kb,250kb+or similarpermission_tcc_granted: boolean/nullsck_available: boolean/null- standard version/build/namespace properties
Also add a chat-cycle level summary event/property:
- whether a screen tool was requested,
- whether any screen tool succeeded,
- whether an approval was required/denied,
- whether the final answer included/used screen context if detectable.
Acceptance criteria
- A dashboard/query can answer: “Of macOS users who ask screen-aware chat questions, what percent get usable current screen context?”
- Telemetry distinguishes permission failures vs Rewind DB/image failures vs local policy/approval failures vs model never called a screen tool.
-
get_work_contextemits success/failure telemetry withscreen_now_available, timeline count, latest capture age, and classified failure codes. -
capture_screen/get_screenshotemit telemetry for permission/policy/image failures without logging screen contents or OCR text. -
Chat Message Sent.has_contextis renamed, removed, or replaced with correctly named fields so dashboards do not interpret selected app/persona context as screen context. - Desktop chat routes “what is on my screen?” / “do you see my screen?” style prompts to
get_work_contextfirst, thenget_screenshot/image access only when necessary. - If image access requires approval, the UI shows the approval flow and retries or clearly explains the permission request; it should not silently answer without screen context.
- Add unit/regression tests for telemetry classification and local policy/approval handling.
Privacy constraints
Do not send OCR text, window titles, image bytes, file paths, or raw screenshots to PostHog/Sentry. Only send booleans, counts, age buckets, failure codes, and app version/build metadata.
Activity