Skip to content

fix(updater): include starting chats and spawning terminals in restart impact - #51439

Merged
AmoabaKelvin merged 2 commits into
mainfrom
fix/restart-impact-starting-sessions
Nov 28, 2026
Merged

AmoabaKelvin merged 2 commits into
mainfrom
fix/restart-impact-starting-sessions

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

Before a phone or another desktop updates an Orca desktop, it can ask what the restart would stop. That answer missed two short-lived cases: a chat whose agent was still starting, and a terminal still being created. Both do stop on restart, so they're now included.

Files Added Deleted Net
Test 0 0 0 0
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​36 $\color{#cf222e}{\Huge{\mathbf{−}}}$​17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​19

What Changed

  • Before: updater.restartImpact listed only chats with a running agent that quit would stop, and terminals already running inside the app.
  • After: it also lists:
    • chats whose agent start is still in flight with no agent attached yet. A start that is reattaching an agent the terminal daemon kept is left out, because quit hands that agent back to the daemon.
    • terminal spawns still in flight in the app's own PTY provider.
  • Mechanism:
    • StartFlights.startingSessionIds() exposes the starts in flight.
    • quitKeepsStartingStructuredAgent sits next to quit's existing keep rule and decides which childless starts survive.
    • inProcessTerminalPtyIds now adds pendingLocalPtySpawns keys.

Why

  • The answer has to match what quit actually does:
    • Quit's chat teardown aborts every in-flight agent acquisition ("abort-acquires") before it evicts running agents.
    • killAllLocalPtys cancels pending PTY spawns before killing running ones.
  • The kept-agent exclusion uses the same relay facts quit uses (the kept-relay listing and reattach state), so the confirm doesn't report daemon-kept work as interrupted.

Linked Issue

No GitHub issue; follow-up to #51246.

Visual Proof

N/A, no UI. This is a host read with no client caller yet.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

  • pnpm check:changed and tc:node pass.

  • Not exercised live. The inputs exist only for the moments between a start or spawn beginning and its process registering, and on macOS/Linux most chats are kept by the daemon.

  • Instead, the sets were checked in code against what quit aborts:

    • start flights are a subset of the acquisitions quit aborts;
    • pending spawn ids are the same ids spawnLocalPty registers in ptyProcesses;
    • kept reattaches go back to the daemon through the relay hand-off.
  • No automated test: these are transient in-memory states owned by the live provider relay and PTY provider.

Performance

None, because the read runs only when a client asks. It adds one pass over in-flight starts (normally none) and the pending-spawn map keys, both in memory, with no I/O or retained state.

Risk

Level: Low

  • A wrong rule would only change what a confirm dialog lists; quit itself is untouched.
  • Known remaining gap: a chat created by an older client through the legacy attach path registers no start flight, so it is still left out until its agent attaches.
  • Back out: plain revert.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • The wire shape is unchanged; only more entries can appear. updater.restartImpact is not on the phone allowlist yet.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…in restart impact

Quit aborts every chat start still acquiring its agent and cancels local PTY
spawns in flight, so updater.restartImpact now names those too.
@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

PTY ID enumeration now includes pending local spawns and deduplicates them with active IDs. Quit reporting now includes eligible sessions whose agents are still starting, excluding sessions with an attached child or a kept or reattaching provider relay. Remote-server update documentation now describes chats with starting agents and states that listed terminal PTYs end their shells.

Merge Risk: Minimal · up to 201a5

This change makes the restart-impact report list more in-flight chats and terminals that quitting would stop. No concrete defect was found, and no client currently calls this read, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the updater restart-impact response now includes starting chats and spawning terminals. It follows the conventional fix(scope) format and matches the changeset (start …
Description check Passed The description follows the template. It has ELI5, What Changed (before/after and mechanism), Why, Linked Issue (explains there is no issue and refers to follow-up to #51246), Visual Proof (N/A with r…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the updater restart-impact response now includes starting chats and spawning terminals. It follows the conventional fix(scope) format and matches the changeset (start flights, quit-keep rule, pending PTY spawns, and the restart-impact doc update). It is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description follows the template. It has ELI5, What Changed (before/after and mechanism), Why, Linked Issue (explains there is no issue and refers to follow-up to #51246), Visual Proof (N/A with reason), Testing (explains why no automated test and what was checked), Performance (None, with reasoning), Risk (Low, with gap and back-out plan), Agent skill boundary, Notes, and Checklist. Gaps: the Linked Issue section does not use the required 'Fixes #' form, and the template asks for an actual issue for outside contributors. The AI Disclosure section is empty, and the local lint/typecheck/test/build checkbox is unchecked. The checklist mentions pnpm checks, but the Testing section states that pnpm check:changed and tc:node pass, which is not the same set of commands. These gaps are non-critical for a maintainer-authored PR.

  • 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 415987d0-96d3-48a7-ae1d-1569e631fd94
Commits

Reviewing files that changed from the base of the PR and between 55ba27d and 201a584.

Files selected for processing: 5

  • src/main/ipc/pty/provider/kill-all.ts
  • src/main/native-chat/agent-session-wire/host/structured-agent-session-conversation-reads.ts
  • src/main/native-chat/agent-session-wire/startup/structured-agent-session-start-flight.ts
  • src/main/native-chat/agent-session-wire/termination/structured-agent-session-quit-keeps-agent.ts
  • src/shared/remote-runtime/host-catalog/remote-server-update.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@AmoabaKelvin
AmoabaKelvin merged commit 521176e into main Nov 28, 2026
56 checks passed
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.

1 participant