Skip to content

fix(desktop): surface silent client failures - #10084

Merged
kodjima33 merged 2 commits into
mainfrom
fix/silent-failure-hardening
Aug 13, 2026
Merged

kodjima33 merged 2 commits into
mainfrom
fix/silent-failure-hardening

Conversation

@undivisible

@undivisible undivisible commented Jul 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Surface previously swallowed desktop client failures in macOS app setup checks and Windows connected-account, screen-capture, and retention cleanup paths.

Product invariants affected

  • INV-VOICE-1
  • INV-CHAT-1

Verification

  • xcrun swift test -c debug --package-path Desktop --filter APIClientSetupCompletedTests compiled successfully. The local XCTest runner could not load Sparkle under host Xcode Beta 27; the authoritative rerun uses CI’s pinned Xcode 16.4.
  • Windows dependencies are not installed in this isolated worktree; the fresh Windows CI run is authoritative for TypeScript checks.

Failure-Class: none


Note

Low Risk
Logging-only changes with no altered success paths; failures remain handled as before but are easier to diagnose in support and CI logs.

Overview
Replaces swallowed errors with diagnostic logging on macOS and Windows desktop paths where failures were previously invisible. Runtime behavior on failure stays the same (e.g. setup still reports not completed, token load still returns null).

macOS: isAppSetupCompleted now logs when the setup-status response is not JSON and when the network request fails, instead of an empty catch.

Windows: Google refresh token load warns on corrupt secure storage (still returns null so UI does not treat corruption as “never connected”). Screen capture fallback warns when primary display lookup fails before using the first screen. Rewind retention logs non-ENOENT frame delete failures during prune; launch and hourly prune already had top-level failure warnings.

Also adds an unreleased changelog entry and extends the macOS apps e2e flow covers to include APIClient+Apps.swift.

Reviewed by Cursor Bugbot for commit c71a0a6. Bugbot is set up for automated code reviews on this repo. Configure here.

@undivisible undivisible added the no-changelog-needed Skip desktop changelog enforcement for internal-only changes label Jul 20, 2026
@Git-on-my-level Git-on-my-level added needs-maintainer-review Needs a human maintainer to sign off before merge security-review Touches auth, provider routing, secrets, or security-sensitive surfaces workflow-review Needs maintainer review for workflow, automation, hooks, or CI behavior labels Jul 20, 2026

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tightening these fail-open/silent-failure paths. I reviewed the diff and the direction looks good: the Rust agent VM recovery paths now log and fail closed for authoritative Firestore transitions, use_custom_token=true no longer returns a partial success when custom-token minting is unavailable, and the desktop/Electron changes surface previously swallowed errors without changing the fallback behavior.

A few maintainer notes before this should merge:

  • This touches auth, agent VM state, and CI/workflow behavior, so I’m not going to formally approve it from automation; it needs human maintainer sign-off on the intended fail-closed UX and the no-changelog-needed CI bypass semantics.
  • GitHub currently reports the branch as not cleanly mergeable (DIRTY), so it needs to be brought up to date with main before final review/merge.
  • I could not run the Rust check locally in this sandbox because cargo is not installed here, but the PR’s GitHub checks show the Rust Backend and Desktop Swift Build & Tests jobs passing.

No blocking code issue jumped out from the patch review; after the merge conflict is resolved, I’d mainly want a maintainer to confirm the auth/agent failure behavior is the desired product behavior.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level

Copy link
Copy Markdown
Member

Scope and behavioral-proof follow-up

The fail-closed direction is promising, but this remains a cross-cutting auth/agent-state/workflow PR. Before merge:

  • split the CI-label/changelog-bypass behavior from auth and agent state changes;
  • add focused behavioral coverage for failed Firestore/GCE authoritative transitions and the custom-token error contract; and
  • rebase/rerun after the split.

A maintainer still needs to explicitly sign off on the intended user-facing fail-closed UX.

@undivisible
undivisible force-pushed the fix/silent-failure-hardening branch 2 times, most recently from adb59ed to 4e3b27d Compare July 21, 2026 23:16
@undivisible
undivisible force-pushed the fix/silent-failure-hardening branch 5 times, most recently from 533013a to 767f7ea Compare July 22, 2026 03:22
@undivisible

Copy link
Copy Markdown
Collaborator Author

retriggering CI

@undivisible undivisible reopened this Jul 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hey @undivisible 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

@undivisible
undivisible force-pushed the fix/silent-failure-hardening branch from 767f7ea to 5d00a1f Compare July 22, 2026 08:38

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the follow-up on this head. The fail-closed/silent-failure direction still looks worthwhile, but I’m going to keep this in changes-requested state before merge.

Blocking items that still apply on f0955b8:

  • The Desktop Swift CI no-changelog-needed / --skip-changelog behavior is still bundled with the auth and agent-state runtime hardening. That workflow policy change is independently reviewable/rollbackable, so please split it from the auth/agent/desktop failure-surfacing changes.
  • I still don’t see focused behavioral coverage for the Rust auth custom-token error contract (use_custom_token=true should hard-error rather than return a partial payload) or for failed Firestore/GCE authoritative agent-VM transitions. The existing CI is helpful, but these are security/user-state-sensitive behavior changes and need direct regression coverage.
  • A human maintainer still needs to sign off on the intended fail-closed UX for the auth and agent-state paths before merge.

No security attack concern from my review; this is normal heightened review because the PR touches auth, agent VM state, and workflow/changelog enforcement.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@skanderkaroui skanderkaroui left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid reliability fix that surfaces errors instead of hiding them, without breaking any working path or the changelog automation. Safe to merge.

@skanderkaroui

Copy link
Copy Markdown
Contributor

@undivisible this looks good to merge on review but has merge conflicts with main — could you rebase/resolve the conflicts and merge? Thanks!

@undivisible
undivisible force-pushed the fix/silent-failure-hardening branch from f0955b8 to 3748b45 Compare July 24, 2026 05:10
@cursor

cursor Bot commented Jul 24, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@undivisible

Copy link
Copy Markdown
Collaborator Author

Addressed CHANGES_REQUESTED on 3748b45a26 (rebased onto main):

  1. Split — removed Desktop Swift CI no-changelog-needed / --skip-changelog workflow changes from this PR (auth/agent/desktop failure-surfacing only).
  2. Behavioral tests — extracted require_custom_token (fails closed with custom_token_unavailable) and fail_closed_firestore_transition / recovered_vm_external_ip; unit tests cover mint failure, successful mint, write→500 mapping, and empty/missing NAT IP rejection.
  3. Dropped unrelated CI harness commits that had ridden along earlier.

Human maintainer sign-off on fail-closed UX still needed per prior review.

undivisible added a commit that referenced this pull request Jul 24, 2026
Restore backend/database/memories.py so this PR no longer triggers the
full backend unit suite (unrelated dead-code removal). Add HTTP-level
auth token fail-closed tests and an async agent transition contract test
alongside the existing helper unit coverage.

Failure-Class: none
Co-authored-by: Cursor <[email protected]>
@undivisible

Copy link
Copy Markdown
Collaborator Author

Review blocker follow-up (8a15569024)

Addressed the remaining automated CHANGES_REQUESTED items on top of 40b211f520:

1. Desktop Swift CI / changelog policy split

Already scoped out of this PR — git diff origin/main...HEAD touches zero .github/** files. No no-changelog-needed / --skip-changelog workflow work rides on this branch.

2. Behavioral fail-closed coverage (Rust)

Added route-level regression tests in 8a15569024:

Contract Test
use_custom_token=true hard-errors instead of partial payload auth_token_with_custom_token_fails_closed_when_mint_unavailable (POST /v1/auth/token → 400 custom_token_unavailable, no id_token)
Mint skipped when custom token not requested auth_token_without_custom_token_returns_id_token_without_mint
Authoritative Firestore agent-VM transition fails closed authoritative_agent_vm_transition_fails_closed_in_async_handler (+ existing fail_closed_firestore_transition_* helper tests)
Custom-token helper existing require_custom_token_* unit tests

Local verification: cargo test auth_token_ fail_closed authoritative_agent in desktop/macos/Backend-Rust.

3. Backend unit suite failure

Root cause: the earlier backend/database/memories.py deletion forced the full backend unit suite (backend/database/** → full run). That suite was failing in parallel CI due to unrelated langchain_core stub pollution in other test files — not caused by the auth/agent/desktop runtime changes.

Fix: restored memories.py on this branch so backend unit selection is now “no backend files changed” and the suite should skip for this PR.


Ready for human maintainer sign-off (cannot be automated)

Please confirm the intended fail-closed UX for:

  1. Auth token exchange — desktop clients sending use_custom_token=true now receive 400 { error: "custom_token_unavailable" } when minting is unavailable, instead of a partial token payload. Clients must surface/handle that hard error.
  2. Agent VM status recovery — when an authoritative Firestore write during stopped/missing-VM recovery fails, the handler returns 500 (via ? on fail_closed_firestore_transition) rather than proceeding as if the transition succeeded.

Desktop failure-surfacing (Swift APIClient+Apps, Windows token/screen/retention logging) remains unchanged from 3748b45a26.

Head for re-review: 8a15569024

@Git-on-my-level
Git-on-my-level dismissed their stale review July 31, 2026 05:43

Current head resolves the stale automation blockers: wording now matches the desktop-only diagnostic diff and relevant checks are green.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the follow-up. I re-reviewed the current head against the last automation blockers.

The two items from the previous changes-requested review now look resolved: the changelog/PR wording is narrowed to desktop/client diagnostics rather than agent behavior, and the Desktop Swift/Windows checks are green on this head. The remaining diff is cohesive and low-risk: it surfaces previously swallowed macOS app-setup and Windows token/screen/retention failures while preserving the existing fallback return behavior.

I’m dismissing the stale automated changes-requested review. I’m still not formally approving from automation because the PR touches auth-adjacent token-storage diagnostics and screen/retention logging, so please keep the existing human/security review labels until a maintainer is comfortable with the diagnostic/logging surface.

No security attack concern from my review.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@undivisible undivisible added bug Something isn't working macOS windows Windows desktop work labels Jul 31, 2026
@Git-on-my-level Git-on-my-level added desktop and removed macOS windows Windows desktop work labels Jul 31, 2026
@undivisible
undivisible force-pushed the fix/silent-failure-hardening branch from 9668b55 to c71a0a6 Compare August 4, 2026 19:19
@cursor

cursor Bot commented Aug 4, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_50bf9f4c-5d1c-4f44-ac31-19827ff15367)

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the current head (c71a0a6). The narrowed diff looks cohesive: it surfaces previously swallowed desktop client failures in macOS app setup and Windows token/screen/retention paths while preserving the existing fallback behavior. I do not see a code blocker or a security-attack concern in these changed files.

I’m still not formally approving from automation. This touches auth-adjacent token-storage diagnostics plus screen/retention logging, and the current Backend Hermetic Merge Gate check is failing, so please keep needs-maintainer-review / security-review until a maintainer signs off on the diagnostic/logging surface and the checks are green.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the current head (c16240d). This is still a cohesive desktop diagnostics cleanup, and the current checks are green. I do not see a code blocker or a security-attack concern in the changed files:

  • desktop/macos/Desktop/Sources/Services/APIClient/APIClient+Apps.swift now logs both non-JSON setup-status responses and thrown request failures, while preserving the existing false fallback from isAppSetupCompleted().
  • desktop/macos/changelog/unreleased/20260724-silent-failure-logging.json accurately scopes the release note to desktop diagnostics for app setup, connected accounts, screen capture, and retention cleanup.
  • desktop/macos/e2e/flows/apps.yaml adds APIClient+Apps.swift to the manual apps flow coverage list, which matches where the app setup diagnostics are exercised.
  • desktop/windows/src/main/integrations/tokenStore.ts logs corrupt/unreadable secure-storage failures but still returns null, so the Google-token load behavior remains fail-soft.
  • desktop/windows/src/main/ipc/screen.ts logs primary-screen lookup failures and keeps the existing fallback to the first captured screen.
  • desktop/windows/src/main/rewind/retentionRunner.ts continues treating ENOENT as idempotent while surfacing other frame-deletion failures so retention disk-growth issues are diagnosable.

I’m still not formally approving from automation because this touches auth-adjacent token-storage diagnostics plus screen/retention logging surfaces, and the existing security-review / needs-maintainer-review labels are the right place for maintainer sign-off on the diagnostic/logging behavior before merge.


by AI on behalf of David — security-sensitive desktop diagnostics need human maintainer sign-off before merge.

@undivisible undivisible added human Human-authored pull request macOS javascript JavaScript or TypeScript implementation work privacy-review Touches user-data persistence, permissions, or privacy-sensitive surfaces labels Aug 10, 2026
@undivisible
undivisible force-pushed the fix/silent-failure-hardening branch from c16240d to 72fbe24 Compare August 10, 2026 21:11
@undivisible
undivisible force-pushed the fix/silent-failure-hardening branch from 72fbe24 to 4101216 Compare August 10, 2026 23:11
@Git-on-my-level Git-on-my-level removed macOS javascript JavaScript or TypeScript implementation work labels Aug 11, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swallowed desktop client failures are now logged on both macOS setup checks and the Windows connected-account/capture/retention paths; logging-only, success paths unchanged.

@kodjima33
kodjima33 merged commit 2eca80b into main Aug 13, 2026
39 of 40 checks passed
@kodjima33
kodjima33 deleted the fix/silent-failure-hardening branch August 13, 2026 14:46

This branch was successfully deployed

1 active deployment
staging - docs — 4101216b Deployed Aug 10, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working desktop human Human-authored pull request needs-maintainer-review Needs a human maintainer to sign off before merge privacy-review Touches user-data persistence, permissions, or privacy-sensitive surfaces security-review Touches auth, provider routing, secrets, or security-sensitive surfaces

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants