Skip to content

fix(desktop): recover remote OAuth without blocking healthy gateways - #108183

Merged
OutThisLife merged 3 commits into
mainfrom
bb/triage-remote-oauth
Sep 11, 2026
Merged

OutThisLife merged 3 commits into
mainfrom
bb/triage-remote-oauth

Conversation

@OutThisLife

@OutThisLife OutThisLife commented Sep 11, 2026 •

Copy link
Copy Markdown

What does this PR do?

Keeps Desktop recoverable when a remote gateway restarts or rejects its saved session. Consolidates the remaining startup, response-stream, foreground-isolation, and roster-recovery fixes from the linked PRs.

Related issues and credit

Closes #72530.
Closes #101339.

Supersedes:

All contributors are credited in commit trailers. The larger route-identity architecture issue #90149 remains open and is not claimed fixed.

Type of change

  • Bug fix

Changes made

  • Use the WebSocket-ticket mint as the authoritative OAuth check instead of rejecting on a cookie preflight. Preserve pre-mint native-session history for error copy and retain structured 401/403 versus transport/Cloud-down classification.
  • Handle Electron response-stream errors, including truncated bodies, without uncaught exceptions. Reuse httpStatusError and prevent repeated response settlement.
  • Keep post-boot primary authentication recovery off a healthy secondary. Ignore startup snapshots superseded by newer progress or a successful connection.
  • Give OAuth roster dials a bounded longer deadline. Retry incomplete caches sooner without a focus-event hot loop; a successful connection Test queues a fresh enumeration even when another is still pending.

Current main already latches failures before awaiting teardown, checks attempt ownership before latching, uses connection-aware primary/pooled probes, scopes recovery logout to the failed gateway, and clears the latch on confirmed login. Those fixes are retained. This does not carry the unsafe pre-ownership latch reorder, message matching without a demonstrated production boundary, source-regex tests, or stale transport changes from the older PRs.

Verification

  • Built the renderer and bundled Electron main/preload from this worktree.
  • Real Electron/IPC/renderer E2E: both 401 and 403 cases pass. A loopback gateway first truncates a response, then rejects auth; the actual Gateway settings URL input stays usable during 20 concurrent connection calls. Embedded login establishes a fixture HttpOnly cookie and a subsequent connection returns a fresh remote descriptor.
  • Post-rebase targeted backend/renderer run: 300 tests across 13 files passed, including forced-refresh overlap and stale-snapshot regressions. The foreground bug failed on main before the fix; the overlap and snapshot review findings were separately reproduced red then fixed.
  • All three Desktop TypeScript projects pass. Changed production files pass ESLint; git diff --check passes.
  • Full Electron suite: 2168 passed, 6 skipped, 2 failed. Failures are the POSIX launcher status and installer-wrapper PID recognition tests in unchanged managed-ssh-update.test.ts and remote-lifecycle.test.ts; both also fail in an isolated rerun. No unrelated SSH code or tests were changed.

The E2E gateway is an explicit loopback fixture, not the reporter's NAS or a hosted OAuth service. No real credentials or installed user state were used. Native Windows/Linux, packaged installers, the full renderer suite, and Python tests were not run.

Checklist

  • Read contribution guidance and checked sibling PRs/current main.
  • Topical commits with contributor credit.
  • Added behavioral regression coverage and exercised the Electron boundary on macOS.
  • No new dependencies, config keys, model tools, or visual redesign.
  • Reported CI checks pass; no unresolved review threads.

OutThisLife and others added 3 commits September 11, 2026 05:08
Handle truncated OAuth responses and keep confirmed auth recovery stable. Preserve the current attempt guard before latching failures; the older pre-guard latch proposal is not carried forward.

Co-authored-by: xxxigm <tuancanhnguyen706@gmail.com>
Co-authored-by: FalconOrtiz <falcon.ortiz11@gmail.com>
Co-authored-by: Ugo Enyioha <ugo.enyioha@outlook.com>
Co-authored-by: Bartok9 <259807879+Bartok9@users.noreply.github.com>
Ignore startup snapshots superseded by newer progress or an open socket.

Co-authored-by: Carl Taylor <carl@carltaylor.com.au>
Queue a forced follow-up when Test overlaps an older enumeration; retain bounded caching for incidental focus events.

Co-authored-by: FalconOrtiz <falcon.ortiz11@gmail.com>
@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

૮ >ﻌ< ა ci review

ran on 4f5b4d7 — fix(desktop): refresh missing roster sources after recovery

⚠️ Warnings

OSV vulnerability scan · View job

80 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 3m vs 5m15s (-42.9%). 3 job(s) slower, 2 faster, 3 unchanged.

  • JS & TS checks / JS & TS checks: +34.0s
  • OSV scan / Emit review status: +32.0s
  • OSV scan / Scan lockfiles / osv-scan: +5.0s
  • Profile artifact check / Reject profile archives: -4.0s
  • Check no committed infographics / check-no-committed-infographics: -3.0s

@OutThisLife
OutThisLife merged commit a319062 into main Sep 11, 2026
31 checks passed
@OutThisLife
OutThisLife deleted the bb/triage-remote-oauth branch September 11, 2026 12:14
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/desktop Electron desktop app (apps/desktop/*) area/auth Authentication, OAuth, credential pools sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools comp/desktop Electron desktop app (apps/desktop/*) P2 Medium — degraded but workaround exists sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

2 participants