Skip to content

fix(desktop): keep a surfaced terminal outage across focus and remount - #8981

Draft
posthog[bot] wants to merge 2 commits into
mainfrom
posthog-self-driving/terminal-connections-fail-for-hundreds-4a3145
Draft

posthog[bot] wants to merge 2 commits into
mainfrom
posthog-self-driving/terminal-connections-fail-for-hundreds-4a3145

Conversation

@posthog

@posthog posthog Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

What & why

Problem

  • A person whose terminal host is offline or unreachable loses the cause in the header each time they focus the window, switch tabs, or wake the laptop. The pane shows "Reconnecting…" with no reason for about 10 more failed dials (tens of seconds with backoff), then the cause comes back.
  • The same reset re-arms the terminal_connect_failed latch, so one continuous outage sends the event again after each focus or tab switch. A few stuck terminals produce most of the events. The failure-to-input ratio in the report measures focus events more than outages.
  • The rise on 24–26 Oct was not a release or relay change. Most of it came from a very small number of terminals that repeated the event many times. Real host-offline and relay-unreachable failures stayed near their normal level.

Changes

Event during a diagnosed outage Before After
Window focus / visibility / wake Cause hidden for ~10 dials, event sent again Cause back after 1 failed dial, no new event
Tab switch (park → connect, same terminal) Same as above Same as above
Re-point to another terminal / manual retry Full reset Full reset

Note

After this change, terminal_connect_failed counts outages more closely. Expect event volume to drop with no change in the number of affected people. Compare people affected, not raw events, against the old baseline.

Agent context

  • Not in scope: the relay close-4404 ("stream expired") loop on one host, which shows as stream-blocked. It needs relay-side logs. Also not in scope: host-offline and relay-unreachable failures that reflect real host or network state. The header already explains those.

How I tested it

  • bun test src/renderer/lib/terminal/ in apps/desktop: all tests pass, including 4 new transport tests (resume before diagnosis, resume during an outage, remount on the same endpoint, remount on a new endpoint). The 2 "keeps the outage" tests fail on main.
  • bunx @biomejs/biome@2.4.2 check on the changed files and bun run typecheck in apps/desktop pass. I did not run the root bun run lint (the full repo script).
  • I did not check this in the running app. There is no session replay for the affected sessions. The header behavior is covered only by the unit tests through lastDiagnosis and the log entries.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (CI fails on lint warnings too)
  • "Allow edits from maintainers" is checked on fork PRs
  • I have signed the CLA (the bot asks on your first PR)

Created with PostHog Desktop from this inbox report.

Origin

  • Scout: signals-scout-general
  • First signal: 2026-10-28
  • Inbox report: open
  • Task started by: auto-start, after the report was rated P2 and ready to fix

Summary by cubic

Keeps a diagnosed terminal outage visible and single-report across window focus, tab switches, and wake events, instead of resetting the failure budget and telemetry latch each time.

  • A resume (forceReconnect) or a remount on the same endpoint during a diagnosed outage now keeps the diagnosis, failure count, and telemetry latch; the cause returns after the first failed redial instead of after ~10.
  • Resumes before any diagnosis, new endpoints, terminated sessions, disconnect(), and manual reconnect() still reset everything as before.
  • terminal_connect_failed now tracks outages rather than focus events, so event volume drops with no change in affected people.

Written for commit 1ca2b93. Summary will update on new commits.

View guided diff Turn on auto-fix

During an outage the terminal had already diagnosed, every window focus, tab switch (park + connect) or wake reset the failure budget and the telemetry latch. The header hid the cause for about 10 more failed dials, and terminal_connect_failed fired again for the same outage.

Now a resume or a same-endpoint remount keeps the budget, the diagnosis and the latch when the outage was already surfaced. A resume before any diagnosis still starts a fresh budget, so failures counted while suspended do not flag an outage. A different endpoint, a terminated session or a manual reconnect still resets everything.

Generated-By: PostHog Desktop
Task-Id: 88981d8a-cfec-49ad-b97d-c9e51164dbbe
@posthog
posthog Bot requested a review from AviPeltz October 28, 2026 00:39
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c5633774-64b4-47dd-94a6-5b44085c6125

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Generated-By: PostHog Desktop
Task-Id: 88981d8a-cfec-49ad-b97d-c9e51164dbbe
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

🔗 Preview Links

Service Status Link
Neon Database (Neon) ✅ View Branch
Vercel API (Vercel) ✅ Open Preview
Vercel Web (Vercel) ✅ Open Preview
Vercel Marketing (Vercel) ✅ Open Preview
Vercel Docs (Vercel) ✅ Open Preview

Preview updates automatically with new commits

This branch was previously deployed

1 inactive deployment
preview — 1ca2b939 Deployed Oct 28, 2026 by posthog[bot] via Deploy Docs #12993
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants