Skip to content

feat(updates): update bb once all threads finish - #6203

Merged
ymichael merged 15 commits into
get-bb:mainfrom
smsunarto:scott/update-when-idle
Nov 4, 2026
Merged

ymichael merged 15 commits into
get-bb:mainfrom
smsunarto:scott/update-when-idle

Conversation

@smsunarto

@smsunarto smsunarto commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

Updating bb from Settings or bb updates app apply restarts the server, so it either interrupts running threads or refuses to start. There was no way to say "update once they finish", and an agent could not do it for itself: its own thread counts as running, so it could only interrupt itself or give up. This is #477 and the second half of #6127.

Original implementation by @smsunarto; rebased and reviewed onto current main, with the changes below.

What changed

Behind the new updateWhenIdle experiment (on for early adopters, off by default). With it off, bb behaves as on main.

  • The server owns the schedule (apps/server/src/services/system/app-update-schedule.ts). It wraps the launcher and desktop update services and starts the update once running threads (starting/active) stay at zero for five seconds; with none running it starts at once. Inside the services, confirmInterruptingThreads became a RunningThreadsPolicy (refuse | interrupt | wait), and wait.shouldDefer(count) is asked both before staging and at the restart decision. A thread that starts during the download makes the server send the launcher defer (new launcher IPC request): the launcher returns to idle without recording a failure and bb waits again. The desktop service keeps its download the same way. Schedule, manual apply, and the scheduled start run one at a time.
  • Settings → Updates: while threads run, the row shows "N threads running" and a split button, Update when idle, whose menu holds Update now (still behind the existing interrupt confirmation). Once scheduled, the same control reads Cancel with Update now in its menu, and the caption reads "Updates when all threads are idle (N running)". With no thread running the row keeps its single Update button. The running-threads dialog is unchanged from main. The update row's buttons wrap under the name instead of squeezing it at narrow widths.
  • CLI: bb updates app apply --when-idle (returns at once) and bb updates app cancel. Without a terminal, plain apply with running threads suggests --when-idle when the experiment is on; with it off, both commands fail with a message naming the experiment.
  • API: POST /system/app-update/schedule and /schedule/cancel (403 update_when_idle_experiment_disabled while the experiment is off), sdk.system.experimental_scheduleAppUpdate / experimental_cancelScheduledAppUpdate, and a nullable scheduled on the status. Turning the experiment off drops a waiting update. While it is on, the server sends app-update-changed when the running thread count changes (read once per burst of thread events, not per event), so the row follows the count. docs/api_to_audit.md, docs/configuration.md, the machines and customization guide chapters, and the bb-cli command index are updated. Plugin SDK bumped to 0.6.119.
  • No host daemon wire change, so HOST_DAEMON_PROTOCOL_VERSION is unchanged; the launcher and server always restart together from the same install.

Limits: the schedule lives in server memory (a restart for another reason drops it), and a thread waiting for the user's approval counts as running. This PR does not hold new sends or resume interrupted threads; that is the other half of #6127.

How you verified

  • pnpm exec turbo run typecheck lint --filter='...[origin/main]': pass.
  • Tests: the schedule state machine against the real launcher update service and a fake launcher (settle window, start at once, defer when a thread starts mid-download, cancel during download, re-schedule, manual apply racing the scheduled start, status kept while the start is checking, count notifications coalesced per burst, dropping the schedule when the experiment turns off); route gating; desktop deferral; launcher defer; CLI --when-idle/cancel with the experiment on and off; Settings rows for experiment on/off × threads running/not, scheduling, cancelling, and Update now through the confirmation. session-owner-runtime-status (statement count during a disconnect fan-out) caught a per-event experiment read and passes after the fix.
  • Live, on a real source-mode install (pnpm start, real launcher restarts) cloned from a local origin with pushed commits, with real Claude Code agent threads running long shell loops:
    • Cancel from the UI while a thread ran: no update after the thread finished.
    • --when-idle while a thread ran: the update started by itself when it finished; a thread started mid-download made the launcher defer (no failure, no restart), and bb restarted into the new commit after that thread finished.
    • A thread starting inside the five-second settle window kept it waiting; the caption followed the running count; bb came back on the new version.
    • Experiment off: single Update, main's dialog, CLI messages; experiment on at 1280 and 390 px in light mode; a real scheduled update with two agent threads completed; turning the experiment off dropped a waiting update.

Fixes #477
Refs #6127

AGENT GENERATED

🤖 Generated with Claude Code

@github-actions github-actions Bot added the needs-issue PR does not close an open issue label Oct 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the pull request, @smsunarto. It was closed automatically because it does not meet the requirements below yet. This is an automated check, not a review of the change.

Linked issue. Every pull request must close an open issue in this repository. The issue keeps the problem tracked even if this pull request closes or we take a different approach. Open an issue for the change, or find an existing one, and add Fixes #<number> to the pull request description. Feature requests and UI changes need a maintainer's sign-off on the issue first. This pull request reopens on its own once you save the description.

See CONTRIBUTING.md for details.

sms-yui and others added 15 commits November 3, 2026 15:48
Add an update-when-idle mode so agents and users can update bb without
interrupting running threads. The server owns the schedule (an agent's own
thread is running, so a client-side wait would never see zero): it starts the
update after running threads stay at zero for five seconds. Each scheduled
attempt carries a shouldDefer hook into the launcher and desktop services, so a
thread that starts during the download, or a cancel, sends the launcher a new
defer decision instead of restarting or recording a failure. Schedule, apply,
and the scheduled start are serialized so a manual apply keeps its own policy.

Surfaces: POST /system/app-update/schedule and /schedule/cancel,
sdk.system.experimental_scheduleAppUpdate / experimental_cancelScheduledAppUpdate,
`bb updates app apply --when-idle` and `bb updates app cancel`, and an
"Update when threads finish" choice in Settings → Updates whose waiting row
offers Cancel and Update now (which confirms before interrupting threads).
The integration harness builds ServerAppDeps directly, so it needs the
scheduling wrapper like start-server and the server test harness.
experimental_scheduleAppUpdate and experimental_cancelScheduledAppUpdate
ride into the plugin SDK's bundled types, so the published surface changed.

Co-Authored-By: Scott <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
When the schedule came due, the server re-checked the update before asking
the launcher to stage it. For that check the status said nothing was
scheduled and the launcher was idle, so Settings showed a plain Update
button and the CLI said "Run bb updates app apply" until staging began.
On a source checkout that check is a git fetch, so the gap lasts as long
as the fetch.

The CLI also named the target by version, which a source checkout shares
with the update; name the commit there, and word the settle window
instead of "once 0 running threads finish".

Co-Authored-By: Scott <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
While an update waited, Settings kept the running-thread count from when
it was scheduled ("Updates when 1 running thread finishes" after that
thread had finished), because clients only heard about the schedule's own
changes. Tell them about each thread status change while a schedule
waits, so the caption follows the real count.

A thread that starts during staging sent the launcher a defer without a
log line; log it so a deferral is visible next to the requests it
follows.

Co-Authored-By: Scott <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s button

Update when idle is now the updateWhenIdle experiment, on for early adopters
and off by default. While it is off, bb behaves as it does on main: the
schedule and cancel routes return 403 update_when_idle_experiment_disabled,
bb updates app apply --when-idle and cancel print how to turn it on, plain
apply drops its --when-idle hints, and turning the experiment off drops an
update that is waiting.

With it on, Settings → Updates offers the choice on the row instead of inside
the running-threads dialog: while threads run, the primary action is Update
when threads finish, with the running count beside it, and Update now keeps
the existing interrupt confirmation. With no threads running the row keeps its
single Update button. The dialog is back to main's two choices.

For the row to switch as threads start and stop, the server sends
app-update-changed when the running thread count changes while the experiment
is on, instead of only while an update waits.

Co-Authored-By: Scott <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The schedule's listener read the experiment from the database on every
thread status change, and then counted running threads per event. A host
disconnect fans out one status change per thread, so the disconnect test's
statement count grew from 15 to 621. Keep the flag in memory and refresh it
on config-changed, and count running threads once per burst of thread
changes.

Co-Authored-By: Scott <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
With Update now and Update when threads finish side by side, the row's
fixed two-column grid gave the buttons all of a phone's width and squeezed
the version and caption into a one-character column. Let the actions wrap
onto their own line when the name would get narrower than 12rem; a single
Update button still fits beside it.

Co-Authored-By: Scott <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
From 420 to 760 px wide the name and its caption shared one line that could
not wrap, so with two buttons beside them "3 threads running" or "Updates
when 3 running threads finish" shrank into a column a word or a letter wide.
Let that line wrap, so a caption that does not fit moves under the name and
keeps its full width. Rows that fit on one line look the same as before.

Co-Authored-By: Scott <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
"Update when threads finish" read long next to "Update now"; the caption
beside it already says how many threads are running, so the button, the
experiment, and the CLI message now say "Update when idle", matching
--when-idle.

When a bb update row has two buttons, keep its text at least 22rem wide (or
the row's full width) before the buttons wrap below it. Around 520 px the
buttons used to stay beside the text and stack it four lines tall; now they
move under it. Rows with one button are unchanged.

Co-Authored-By: Scott <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two buttons side by side made the row heavy and pushed its text around.
While threads run, the row now has one control the size of the usual Update
button: Update when idle schedules the update, and its menu's Update now
keeps the interrupt confirmation. The menu opens as a drawer on narrow
screens, like the thread header's split button.

Co-Authored-By: Scott <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The waiting row had Cancel and Update now side by side while the
running-threads row had one split button, so the control changed shape when
you scheduled. Both rows now share one split button: it reads Update when
idle, then Cancel once scheduled, and Update now stays in its menu. No row
has two separate buttons any more, so the two-button layout rule goes too.

Co-Authored-By: Scott <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
"Updates when 3 running threads finish" read as if bb waited for those
three, but it waits until no thread is running, including ones that start
while it waits. Name the condition and keep the live count:
"Updates when all threads are idle (3 running)", and "All threads are idle;
updating shortly" during the settle window. The CLI says the same.

Co-Authored-By: Scott <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main published 0.6.118 after this branch took it, and the PR still changes
the published types (experimental_scheduleAppUpdate,
experimental_cancelScheduledAppUpdate, and the updateWhenIdle experiment key).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the scott/update-when-idle branch from 3bfe4d5 to 115cd5a Compare November 3, 2026 23:50
@ymichael
ymichael merged commit b4b1e4a into get-bb:main Nov 4, 2026
50 checks passed
ymichael added a commit that referenced this pull request Nov 4, 2026
…AfterRestart) (#7007)

## Human comments

## What was wrong

With `resumeThreadsAfterRestart` on (#6955), an update restart already
resumes the threads it cuts. The source, npm and desktop updates stop
the server and its local daemon, the daemon comes back as a new
instance, and `handleHostSessionOpened` queues a "bb restarted" resume
for each cut turn. Nothing was missing in that path. But the
confirmation still said "N threads are running. Updating restarts bb and
interrupts them." in three places: the Update now dialog
(`runningThreadsWarning`), the CLI prompt and non-interactive error in
`bb updates app apply`, and the server's `threads_running` error
(`runningThreadsError`). So users were warned about losing work that bb
now resumes. Follow-up to #6203 and #6955 in #6127.

## What changed

- `runningThreadsError(count, threadsResume)` (server),
`runningThreadsWarning(count, threadsResume)` (app) and the CLI warning
take whether restarts resume threads. With the experiment on they read
"N threads are running. Updating restarts bb, and they resume after the
update." (singular: "1 thread is running. Updating restarts bb, and it
resumes after the update.").
- The launcher and desktop update services get a
`threadsResumeAfterRestart` callback, which reads the experiment, for
the `threads_running` message. Settings → Updates reads it from the
system config's experiments. The CLI reads it from `system.config`,
which it already fetched for `updateWhenIdle`.
- Without a terminal, the CLI hint now ends "or --yes to update now"
instead of "or --yes to interrupt them" when threads resume. The `--yes`
help is now "Update without asking about running threads".
- Docs: `docs/configuration.md` (`resumeThreadsAfterRestart`) and `bb
guide machines`.
- With the experiment off, every message is unchanged. No API shape,
daemon wire or plugin SDK change.

**What users see differently:** with "Resume interrupted threads after a
restart" on, the Update now dialog, `bb updates app apply` and the API's
409 say running threads resume after the update instead of being
interrupted. And they do resume (verified live below).

## How you verified

Tests:
- `apps/server/test/system/app-update.test.ts`: the `threads_running`
message is checked with the experiment off ("interrupts them") and on
("it resumes after the update").
- `apps/app/.../app-update-presentation.test.ts`: both wordings,
singular and plural. `UpdatesSettingsSection.test.tsx`: with the
experiment on, the Update now dialog shows the resume wording.
- `apps/cli/src/__tests__/command-output/updates.test.ts`:
non-interactive `apply` with two running threads and the experiment on
prints the resume wording and the "--yes to update now" hint.
- `pnpm exec turbo run lint typecheck` for server, app, cli, templates
and integration-tests passes, and so do the targeted test files above.

Live: a real source-mode install (`pnpm start` from a clone of a local
bare origin), with a marker commit pushed to the origin. A real Codex
agent thread was running a 100 s foreground shell loop. Both experiments
were on.
- `bb updates app apply` without a terminal printed: `Error: 1 thread is
running. Updating restarts bb, and it resumes after the update. Re-run
with --when-idle to update once they finish, or --yes to update now.`
- `POST /system/app-update/apply` returned:
`{"code":"threads_running","message":"1 thread is running. Updating
restarts bb, and it resumes after the
update.","details":{"runningThreadCount":1}}`
- With the experiment turned off, the CLI went back to "...interrupts
it. ... or --yes to interrupt them."
- In Settings → Updates, Update when idle ▾ → Update now opened "Update
bb now? 1 thread is running. Updating restarts bb, and it resumes after
the update."

I clicked Update and restart. bb came back on the marker commit about 10
s later. The thread showed "Thread interrupted because bb restarted / bb
will resume the thread shortly", resumed ("I'll check the running
command and wait for it to finish."), and finished with A-FINISHED.

Refs #6127

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael added a commit that referenced this pull request Nov 4, 2026
## Human comments

## What was wrong

With `updateWhenIdle` on, bb restarts once no thread is running, but
nothing stopped a new send from starting a turn in the gap between that
decision and the process exiting. The launcher's restart decision
([app-update.ts](https://github.com/get-bb/bb/blob/b77a9c9c47/apps/server/src/services/system/app-update.ts#L162-L184))
counts running threads once and answers `restart`. The launcher then
waits 1.5 s and shuts bb down, and the desktop path waits 1.5 s and
installs. A message sent in that window starts a turn, and the restart
cuts it straight away. The same applies to Update now. This is one of
the follow-ups to #6203 and #6955 in #6127.

## What changed

Behind `updateWhenIdle` (on for early adopters):

- **Send hold.**
`apps/server/src/services/system/app-update-send-hold.ts` arms a hold
flag in `app_settings` (`appUpdateSendHold`). The launcher service arms
it in `decideRestart` before it counts running threads. The desktop
service arms it once the download finishes, also before counting. The
flag is in the database, so a crash or restart can't leave it set in a
later process.
- **Dispatch checkpoint.** `dispatch-attempt.ts` queues every dispatch
attempt as a new `app-update` wait while the flag is set. That covers
sends, Send now, retries, new threads' first messages and child notices.
The turn doesn't start.
- **Release.** The flag clears in these cases:
  - The launcher decides `defer` or `cancel`.
- The launcher rejects the `restart` request, or returns to idle
afterwards.
  - The desktop defers, refuses, or fails to download or install.
- The server boots, which covers every real restart, including an update
that fails after the server stopped, where the old version comes back.

Clearing the flag sends a new `app-update-released` queue wake. Like
`host-connected`, it re-attempts each held row in order, and the normal
checkpoint routes it.
- **Ordering.** At boot the release runs before the startup sweep and
before daemons reconnect. A held row on a thread the restart cut waits
as `thread-busy` or `host-offline`. On reconnect, #6955 queues the
resume at the front, and the held rows go out after the resumed turn, in
order.
- **Wording.**
- Queue row: "Sending after bb restarts to update" with the Download
icon.
- Send now is disabled on held rows; the server refuses it with "bb is
restarting to update".
  - `bb thread queue list`: "sending after bb restarts to update".
- Domain: `app-update` added to `queuedMessageWaitingOnSchema`.
- Docs: `docs/configuration.md` (`updateWhenIdle`) and `bb guide
machines`.
- No daemon wire change, so `HOST_DAEMON_PROTOCOL_VERSION` stays the
same. No plugin SDK surface file changed.

**What users see differently:** with the experiment on, a message sent
in the second or two between "Restarting" and bb going down no longer
starts a turn that gets cut. It shows in the queue as "Sending after bb
restarts to update", and goes out once bb is back, after the thread's
resume. If the update doesn't happen, it goes out at once.

## How you verified

Tests (`apps/server`):
- `test/threads/restart-resume.test.ts` → "holding sends while bb
restarts to update" (real server harness):
  - A held send stays queued with no turn; release sends it.
  - Experiment off: the send isn't held.
- A hold followed by a server boot and daemon restart: an idle thread's
held message sends on reconnect. A cut thread runs resume, "First
follow-up", "Second follow-up", in that order.

  The first and third fail with the checkpoint disabled (checked).
- `test/system/app-update.test.ts`: the launcher service holds before it
counts threads. It keeps the hold through `restart`, and releases it
when the launcher returns to idle, on `cancel`, on `defer`, and when the
`restart` request is rejected.
- `test/system/desktop-app-update.test.ts`: hold on install; hold then
release on a refuse failure or a defer.
- `pnpm exec turbo run lint typecheck` for server, app, cli, db, domain,
templates and integration-tests passes. Targeted tests for `app-update`,
`desktop-app-update`, `restart-resume`, `public-system-app-update` and
the app's `queued-message-wait` pass.

Live: a real source-mode install (`pnpm start` from a clone of a local
bare origin), with marker commits pushed to the origin and real Codex
agent threads. A script polled `/system/app-update` and posted
`/threads/:id/send` as soon as the activity read `restarting`.
1. **Update when idle, nothing running:** the send returned
`{"delivery":"queued","waitingOn":{"kind":"app-update"}}` and the log
showed "Holding new sends until bb restarts to update". bb came back on
marker 1 about 10 s later, and the thread answered the held message.
2. **Update now (`--yes`) with a thread running a 100 s shell loop and
`resumeThreadsAfterRestart` on:** sends to the running thread and an
idle thread were both held. After the restart:
- The running thread read "Thread interrupted because bb restarted / bb
will resume the thread shortly". It resumed and answered A-FINISHED.
- Only then did it run the held message. Its queue showed it as "waiting
for the current turn to finish" during the resume.
- The idle thread's held message was requested at 20:34:08, as soon as
bb was back.
3. **Failed update:** I dirtied the checkout right after the restart
decision, so the fast-forward failed ("Update to source checkout
a51ccad183 failed: The working tree has uncommitted changes"). bb came
back on the old commit and sent the held message.

Refs #6127

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael added a commit that referenced this pull request Nov 4, 2026
…sh (updateWhenIdle) (#7011)

## Human comments

## What was wrong

With `updateWhenIdle` on (#6203), bb could only wait for threads before
updating when someone asked it to, by clicking Update when idle in
Settings or running `bb updates app apply --when-idle`. Nothing checked
for updates on its own, so a bb nobody watched never updated. This PR's
first version ran that check for everyone who had the experiment on.
That quietly changed the deal with those users from "bb updates when I
say so" to "bb updates itself", without anyone opting in. This rework
makes automatic updating a setting each user turns on. It is the "check
and update automatically" part of #6127.

## What changed

**Settings → Updates**
- **New switch: "Restart and update bb automatically"**, described as
"Checks every hour and restarts bb into a new version once no threads
are running." It is off by default and only shown while `updateWhenIdle`
is on. When the desktop app talks to a separate server, the label is
"Restart and update the server automatically". The name leads with
"Restart" because the packaged desktop app already installs downloaded
updates when you quit; what this switch adds is bb restarting itself,
without waiting for you.
- **The "Update when idle" split button is gone.** The Server row has a
plain **Update** button. When threads are running it asks first, using
#7007's wording about running threads resuming.
- **Waiting update.** The row reads "Updates when all threads are idle
(N running)". Its button is **Update now**, with **Skip this version**
in the menu.
- **Skipped version.** The row reads "Skipped until a newer version",
and **Update** still installs that version by hand.
- **Row order.** The Desktop row (shown when the desktop app has its own
update to relaunch into) now sits above Server, so the switch is
directly under the row it controls.

**Server** (`app-update-schedule.ts`)
- **Saved setting.** The switch is stored as the new `autoAppUpdate` app
setting.
- **Automatic check.** While the setting and the experiment are both on,
the server checks right away, 30 s after boot, and every hour. Hourly
matches the existing hour-long caches for the npm and source checks and
the desktop app's hourly check. bb waits for threads to finish anyway,
so checking more often would barely change when an update installs. It
uses `forceRefresh` (a `git fetch` in source mode, the npm registry, or
the desktop updater) and schedules what it finds through the existing
when-idle path.
- **Turning it off** stops the checks and drops a waiting update.
- **Versions the check leaves alone:**
  - one the user skipped (the `skippedAppUpdate` app setting);
- one whose last update attempt failed, read from the persisted
`lastResult`.

  Both last until a newer version appears.

**API, SDK and CLI**
- **Status fields.** The status gains `autoUpdate` and
`availableSkipped`.
- **New route.** `POST /system/app-update/auto { enabled }`, exposed in
the SDK as `system.experimental_setAppUpdateAuto`. Like the schedule
routes, it returns 403 while the experiment is off and refuses machine
credentials.
- **New CLI command.** `bb updates app auto [on|off]`.
- **`cancel`** now says it skips the version.
- **`apply --when-idle` stays** as a one-off wait that doesn't touch the
setting, so an agent can update bb from its own thread.

**Other**
- Docs updated: `docs/configuration.md`, `docs/api_to_audit.md`, the
`machines` and `customization` guides, the bb-cli command index, and the
Settings → Experiments description.
- The plugin SDK is bumped to 0.6.123 because its bundle includes the
status schema.
- No daemon wire change.

**What users see differently:** with the experiment on, nothing updates
by itself until you turn on "Restart and update bb automatically" (or
run `bb updates app auto on`). Once it's on, bb checks every hour and
installs new versions when threads finish. Skip this version holds a
version back until a newer one comes out.

## How you verified

Tests:
- **`apps/server/test/system/app-update.test.ts`, "checking for bb
updates automatically"** (real launcher service, fake timers):
- the 30 s and hourly checks (the real `AUTO_UPDATE_CHECK_MS`) schedule
an update and apply it after threads settle;
  - nothing is checked while the experiment is off;
- nothing is checked while the setting is off; turning it on checks at
once; turning it off drops the waiting update and nothing installs;
  - a failed version is skipped until a newer one appears;
  - a skipped version is skipped until a newer one appears.
- **`public-system-app-update.test.ts`:** the auto route returns 403
while the experiment is off, the setting persists into later status
reads, and machine credentials are refused.
- **`UpdatesSettingsSection.test.tsx`:**
  - a single Update button while threads run;
  - the switch appears only with the experiment on;
  - turning it on calls the SDK and shows the waiting row;
- Skip this version shows "Skipped until a newer version · 2 threads
running" and keeps Update;
  - Update now on a waiting update asks first;
- the Desktop row sits above Server, with "Restart and update the server
automatically".
- **CLI `updates.test.ts`:** `auto on`, `auto off` and `auto` output.

`pnpm exec turbo run typecheck lint` passes for server, app, cli, sdk,
db, server-contract, templates and integration-tests, and the targeted
tests pass.

Live: a real source-mode install (`pnpm start` from a clone of a local
bare origin), with marker commits pushed to that origin and a real Codex
thread running a 20-minute loop.

1. **Off means off.** I ran `bb updates app auto off` right after boot.
With marker 13 available and the thread running, nothing was scheduled
40 s later (past the 30 s check).
2. **On installs once idle.**
- `bb updates app auto on` scheduled marker 13 immediately. `bb updates
app` printed "bb will update to 628e88a37c when all threads are idle (1
running)" and "…or bb updates app cancel to skip this version."
- I stopped the thread at 11:53:44. bb restarted at 11:53:50 and was on
marker 13 at 11:53:59.
- `bb updates app` then printed "Updated bb to source checkout
628e88a37c", and `auto` was still on after the restart.
3. **Turning it off drops a waiting update.** With marker 14 waiting for
a running thread, `auto off` cleared the schedule. Fifteen seconds after
the thread went idle, bb was still on marker 13.
4. **UI.** I took screenshots of every state from the same install:
   - switch off;
   - switch on and waiting;
   - the Skip this version menu;
   - skipped;
   - the Update dialog;
- two rows, using a stand-in for the desktop app's update info pointed
at the real server, with Desktop first and "Restart and update the
server automatically".

The earlier version of this PR also verified the check intervals,
cancel-skip and failed-skip end to end, and that logic is unchanged. The
live runs above used the 5-minute interval from before. The hourly
change only changes that constant, and the tests now run against the
real constant.

Refs #6127

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

Update feature should have 'update when agents are finished'

3 participants