Skip to content

feat(web): confirm server updates when work is running - #451

Merged
incognitojam merged 4 commits into
mainfrom
styal/server-update-activity-confirm
Sep 25, 2026
Merged

incognitojam merged 4 commits into
mainfrom
styal/server-update-activity-confirm

Conversation

@incognitojam

@incognitojam incognitojam commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Note

The in-app Update server action now checks the server for running work before restarting it, using the same activity check and dialog wording as desktop quit and restart. Idle servers update without a dialog.

The Update server action restarted a connected server without checking what was running on it. The only confirmation was a fixed prompt for desktop-hosted servers, so updating a CLI or service-hosted server could interrupt an agent turn, a background task such as a Claude monitor, or a terminal command, including work started from another device. Desktop quit and restart already check this through the server's host activity (#362), but that check was limited to backends the desktop app hosts.

Behavior

  • Before updating, the client reads the server's host activity: active and waiting threads (including background work), running terminal commands, and terminals that could not be inspected.
  • Idle servers update immediately. Otherwise a confirmation lists what will be interrupted, for example "Update the Lab server with running work?" followed by "1 thread will be interrupted." Cancel leaves the server running.
  • With Continue threads after restarts on, threads that continuation will resume are listed as continuing after the restart, and every other active thread as interrupted. That includes a thread whose turn has finished but that still has background work such as a monitor, which continuation does not resume today (upstream pingdotgg/t3code#13400, tracked in Continue threads with background work after a server restart #454).
  • If the check fails or takes longer than five seconds, including on servers that predate this change, the dialog says activity could not be checked and still lets the user continue.
  • Desktop-hosted servers keep their unconditional relaunch confirmation, which now also lists running work.

Implementation

  • listContinuableThreads in serverRuntimeStartup.ts is now the one place that selects threads for continuation. The self-update marking step uses it, and the activity check reports how many active threads it selects as continuableSessions. If upstream widens the selection, the dialog changes with it.
  • server.getHostActivity is a new WebSocket RPC (orchestration read scope) that returns the existing inspectHostActivity result. It uses the WebSocket rather than the existing /api/environment/activity HTTP endpoint so it works over relay and tunnel connections as well as direct ones.
  • describeHostActivity in @t3tools/shared/hostActivity turns one or more activity results into the dialog lines and the kind of confirmation needed. The desktop shutdown guard and the web update action both use it, so their wording stays in sync, and a multi-server update action can pass several results in and get combined counts. Desktop quit and restart output is unchanged.
  • User docs, the styal differences overview, and the fork feature ledger describe the new check.

Screenshots

The same thread, with a Codex turn and a terminal command both running. Before this change, Update restarted the server immediately. It now asks first.

Before: Update restarts the server immediately After: confirmation lists the running work
Thread with a running Codex turn and the server update banner Confirmation: 1 thread and 1 terminal session will be interrupted

With Continue threads after restarts on, a running turn that continuation will resume is listed as continuing:

Confirmation: 1 thread will continue after the restart

Validation

Real client: a web dev server on isolated synthetic state, with the client forced to see the server as behind and supporting in-app updates. The server update RPCs were stubbed to fail, so confirming did not install anything. None of that is part of this diff.

  • Idle server, Update from Settings → Connections: no dialog; the update request was sent.
  • sleep 600 running in a thread terminal, Update from the chat banner: "Update the server with running work? 1 terminal session will be interrupted." Cancel sent no update request.
  • Same state, Update from Settings → Connections: the same dialog. Confirm sent the update request.
  • A real Codex turn running sleep 120 plus the terminal: "1 thread will be interrupted." and "1 terminal session will be interrupted."
  • A real Codex turn with Continue threads after restarts on: "1 thread will continue after the restart." With the setting off, the same turn: "1 thread will be interrupted."
  • Automated tests:
    • Server: host activity tests count continuable threads only among active threads, and the existing continuation-marking tests pass against the shared selection.
    • Server: a WebSocket test calls server.getHostActivity against the app under test with a running provider session and mocked terminal inspection, and receives those counts.
    • Web: component tests cover idle servers updating without a dialog, Cancel leaving the server alone, Confirm starting the update, and a failed activity check still asking. Logic tests cover the dialog text for server and desktop-app updates.
    • Shared: tests cover adding up counts across hosts, waiting threads, continuing versus interrupted threads, uninspected terminals, and failed or missing host checks.
    • Desktop: the existing shutdown-guard suite passes unchanged against the shared helper.
    • Typecheck passes for contracts, shared, client-runtime, server, desktop, and web.

Not exercised in a real client: a thread waiting for approval, a thread with only background work, a remote desktop-app update, and a real install after Confirm. These are covered by the automated tests above, except the real install, which this change does not touch.


Written by an agent (Claude Code, claude-opus-5-5).

@incognitojam
incognitojam force-pushed the styal/server-update-activity-confirm branch from fde2e46 to 76aa5ec Compare September 25, 2026 09:57
@incognitojam
incognitojam marked this pull request as ready for review September 25, 2026 10:08
incognitojam added a commit that referenced this pull request Sep 25, 2026
Some messages still called this app T3 Code, such as "Update the T3 Code
desktop app that runs the server?" and "T3 Code could not add the
project." They now say styal. This covers the desktop app update,
desktop app activation, OpenCode, and theme file messages, and the
**Open links in** setting. Messages about importing T3 Code data keep
the name.

#451 moves the desktop app update prompt to
`ServerUpdateAction.logic.ts`, so whichever merges second needs the
wording applied there.

Focused tests pass for desktop app updates, desktop app activation, and
theme files.

---
Written by an agent (Claude Code, claude-opus-5-5).
The Update button now reads the server's host activity before restarting it. Idle servers update without a dialog; running or waiting threads, running terminal commands, or a failed check require confirmation. The dialog text is shared with the desktop quit and restart guard.
…ations

Thread continuation resumes only turns that are still running, not background work such as a monitor left by a finished turn, so the dialog does not promise that any thread continues.
The activity check now reports how many active threads the continuation step would resume, using the same selection. With continuation requested, the update confirmation lists those threads as continuing and the rest as interrupted.
@incognitojam
incognitojam force-pushed the styal/server-update-activity-confirm branch from 22fc58d to 1a5cdb8 Compare September 25, 2026 11:44
@incognitojam
incognitojam merged commit f959dab into main Sep 25, 2026
20 checks passed
@incognitojam
incognitojam deleted the styal/server-update-activity-confirm branch September 25, 2026 11:53
incognitojam pushed a commit that referenced this pull request Sep 25, 2026
(cherry picked from commit 15193df)

Fork adaptation: Single and batch updates share one path that runs the fork's host-activity check (fork #451) before asking, so updating several machines together also warns about running work on any of them, with continuation counted per machine. canUpdateFromApp also excludes the fork's service-migration capability, which needs manual steps, and success toasts name @styal/cli. The batch confirmation test uses the fork's mocked confirm dialog.

Upstream-PR: 10596
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant