Skip to content

fix(updates): update every computer and agent CLI - #669

Merged
nixuuu merged 4 commits into
devfrom
fix/update-all-computers
Nov 13, 2026
Merged

nixuuu merged 4 commits into
devfrom
fix/update-all-computers

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Update all now uses the same supported update actions as the individual buttons, including ready packages on linked computers and installed native/npm/Bun/Volta/pnpm agent CLIs. Previously the plan excluded linked workers/CLIs, required an app feed version even for downloaded packages, and stopped on the first failure; slow installer acknowledgements also hid progress. Concurrent automatic worker updates and bulk launches could also overwrite the command ID and ignore the worker's result; they now share one durable command. The integration regression reproduced two different command IDs before this fix.

The durable owner-scoped run updates the gateway, binary workers, agent CLIs, paired apps and linked computers sequentially, then this computer's app last. Independent failures continue; a failed gateway blocks its workers/CLIs and a failed worker blocks its CLIs. Results show skipped items and their installer, individual retries, and completion in the popover, settings and mobile. Repeated clicks return the active run; restarting the gateway resumes persisted progress without replaying an installer.

Validation: authenticated gateway/worker integration with fake installers covers ready linked apps across three gateways, order, external skips, partial failures, dependency blocking, per-item retry, duplicate clicks, slow acknowledgements, owner scoping and gateway restart. update-center.test.ts: 11 pass / 55 assertions; update-all-computers.test.ts: 4 pass / 50 assertions; updates.test.ts: 19 pass / 118 assertions, all temp-clean after the final runtime fix. The linked and paired app update suites also passed locally. Install, generation check, full typecheck, lint and formatting passed again after merging current dev and regenerating the conflicting contract output. The web production build passed locally and on the isolated review host; the final merged-head local production build also passed. The full local suite reported heartbeat/unreachable failures in unchanged computer-moves tests and later stalled on the worker command race; it was terminated, the race was fixed and its suite rerun successfully. The isolated computer-moves rerun reproduced the unrelated heartbeat timeout: 23 pass / 3 fail (thread move repetitions 18–20), temp-clean. The complete local suite therefore has no passing result; this limitation is not hidden by the targeted successes. Final CI is pending, so this PR remains a draft. No real machine updates were run.

Browser: checked development fixtures for running/failed/completed states in the actual popover and panel, light/dark, desktop/390 px phone width, and short/typical/long computer names. Verified result disclosure, per-item retry visibility, skipped installer reasons, fixed header/footer and no horizontal overflow. Progress now precedes computer rows in the panel. The isolated gateway, database container, server, tunnel and review directory have been removed.

Copy audit (§8): long Update all tooltip → Update all / Update details, with order and exceptions in the panel. Generic stopped-run feedback → per-item Failed, Blocked, Skipped, Retry update and explicit completion. Actions use verbs, states have textual labels, errors include recovery, and there is no decorative humour. Short/typical/long names checked at desktop and phone widths; no meaning depends on colour or icon shape.

@nixuuu
nixuuu force-pushed the fix/update-all-computers branch from b43b7fd to a114490 Compare November 13, 2026 18:53
@nixuuu
nixuuu force-pushed the fix/update-all-computers branch from a114490 to 8e58509 Compare November 13, 2026 18:56
@nixuuu
nixuuu marked this pull request as ready for review November 13, 2026 19:58
@nixuuu
nixuuu merged commit 2273aa5 into dev Nov 13, 2026
20 checks passed
@nixuuu
nixuuu deleted the fix/update-all-computers branch November 13, 2026 19:59
nixuuu added a commit that referenced this pull request Nov 14, 2026
Repeated mirror commits published unchanged computer presence,
invalidating `GetComputers` and `ListWorkerRecords` in both desktop/web
and mobile shared caches. Compare computer content excluding
`lastSeenMs`; meaningful presence, name and sharing changes still
invalidate. Remove the configuration-notice timer and send invalidation
through the existing owner feed when the configuration clock or open
notices change (including dismissal and expiry).

Paired measurement on dev 7137e9a vs this branch: two real linked
desktop gateways, desktop SSE, mobile Connect client simulation, 12 idle
threads per gateway, diagnostics enabled, 5 s warmup then 30 s. The
opt-in `gateway-chatter.test.ts` emits the same RPC starts /
database-query counters as Diagnostics. No rendering or device
performance is inferred.

| Counter, 30 s | Before | After |
| --- | ---: | ---: |
| GetComputers, gateway A | 12 | 0 |
| Database queries, A | 2,910 | 2,748 |
| Database queries, B | 2,623 | 2,641 |
| WatchThread new openings during window | 0 | 0 |
| AckThreadRange, each gateway | 6 | 6 |

The after column was refreshed on the route-corrected head with the same
harness. GetComputers remains at zero new idle calls; the scoped route
lookup is included in the SQL totals.

The earlier composed seven-PR workload recorded 826/765 SQL queries per
30 s versus 2910/2623 on the baseline. That result predates the
independent review corrections and is historical, not a measurement of
the final combined heads. Use the refreshed independent measurements in
this PR and #678 for the corrected implementations. Collection-only
control is recorded in #679. These are idle local multi-client
measurements, not extrapolations of the production window.

Update timeout investigation: `LocalAppControl.check()` coalesces checks
and resolves normally after a 30 s soft wait if the desktop has not
acknowledged a newer check timestamp; it does not wait for an
installation. Linked requests use a separate 120 s check deadline and 15
min installation deadline. No confirmed hang was reproduced, so no
speculative update patch is included. An actual deadline failure in the
reported three requests cannot be distinguished from the soft wait using
durations alone. #669 adds no GetComputers polling.

Diagnostics itself remained enabled in both runs. Its dropped-detail
counters are still nonzero and are a separate issue; query totals are
exact in this workload. Setup/teardown is excluded. Reproduce with
`CANOPY_CHATTER_BENCH=1 bun run check:tmp
tests/integration/gateway-chatter.test.ts`.

Validation: bun install; gen:check; full typecheck; lint; format:check;
web build; shared-query-events tests; gateway overview-feed integration
tests (configuration revisions, resolved notices, owner isolation and
idle streams); paired workload through check:tmp with cleanup. All
commands used nice. The full local check:tmp suite was not run because
concurrent unrelated heavy suites already load the host; CI must cover
the full suite. Native mobile checks remain blocked by the reported
device-host error; no native/mobile source or fingerprint changes.

WatchThread verification of Related: #673: extended the existing
real-transport progress/drop regression to the mobile Connect client.
Both transports retain 1/2/4 s backoff across partial progress and stop
after resume/resume/stop. The focused thread-watch-failures suite passes
14 tests / 90 assertions, including premature clean EOF, oversized
frames and cursor repair. Normal desktop SSE and mobile foreground
streams stayed open through the 30 s idle workload (zero new openings).
No additional gateway close/GOAWAY defect was reproduced. The benchmark
now exposes collector allocation, all global SQL-family counters and
optional trace counts (`CANOPY_CHATTER_TRACE=1`).

Composed validation before review corrections: linked update integration
passed 13 tests / 112 assertions with clean check:tmp; typecheck, lint,
format:check, gen:check and web build passed with all seven fixes
applied. iOS and Android exports passed and native fingerprints remained
unchanged; device-host verification remains unavailable.

Independent review correction: computer overview events now include the
current owner-scoped route list, matching GetComputers snapshots. Manual
add/remove, authenticated route announcements and LAN discovery
therefore remain visible to the content comparison. A real
linked-gateway regression verifies cached routes refresh through
overview on manual add and remove without a name or presence change. It
fails against the old empty-route serialization and passes after the
correction (7 assertions, clean check:tmp). Shared-query events pass 8
tests / 25 assertions; gateway typecheck and focused lint/format pass.
The optional resolved-notice double read is unchanged.
nixuuu added a commit that referenced this pull request Nov 14, 2026
## Problem

On mobile, tapping **Update** on a computer (or **Update all**) in the
update sheet did nothing. After the user closed the sheet, the app
stopped responding to touch.

## Root cause

- **Update did nothing.** Since #536, computer/app updates (and since
#669, Update all with a home app restart) need a restart confirmation.
`confirmAppUpdate` calls the shared `confirm()`, whose single
`ConfirmHost` is mounted at the app root. Its React Native `Modal` is
presented from the root view controller (`RCTModalHostViewComponentView
presentViewController` → `[self reactViewController]`) while that
controller is already presenting the update sheet's `Modal`. UIKit
refuses the second presentation, so no dialog appears and the confirmed
request is never sent. The gateway path (`ManageUpdates`, owner scoping,
`confirm_restart`) is the one web uses and is unchanged; worker updates,
which need no confirmation, were not affected.
- **Invisible touch blocker.** React Native sets `_isPresented = YES`
before UIKit refuses the presentation and never resets it, so the
confirmation stays mounted in a "presented" state that nobody can close.
The orphaned transparent modal is what is left behind after the sheet
closes. I couldn't confirm the exact UIKit sequence on a device; the
device host is unavailable. The same structure has another trap:
dismissing a parent modal while a modal nested in it is still presented
makes UIKit dismiss only the topmost one, which leaves the parent on
screen, invisible and catching touches. `BotSettingsExtras`
(confirmations inside Bot settings) had the same pattern.

## Fix (JS only)

- `ui/overlay-stack.ts` registers every `Overlay` with its parent
overlay (or the app window) and a phase: `waiting`, `shown` or
`closing`.
- Sibling overlays take turns. A waiting overlay presents only when no
sibling is on screen or still dismissing, and only while its parent is
open. "Gone" means native dismissal (iOS `Modal.onDismiss`, the Android
commit), with a 1 s fallback so a lost callback can't block later
overlays.
- A parent keeps its native modal while nested overlays are attached, so
UIKit never dismisses the wrong one.
- `confirm()` renders inside the topmost open overlay: `OverlayLayer`
renders `ConfirmHost` in every `Overlay`. The dialog appears above the
update sheet, and the sheet stays open to show progress. If the host
closes before the dialog appears, the dialog moves down a level (picker
→ root, after the picker is gone). If the host closes under the dialog,
the dialog is cancelled.
- While `ManageUpdates` is in flight (up to 150 s), the sheet shows
"Starting update…". Then the rows show progress and the result, and
`UpdateFeedback` shows errors with details.
- Docs: `docs/mobile.md` (overlay ordering) and `docs/updates.md`
(mobile confirmation).

## Verification

- `bun install`, `bun run gen:check`, `bun run typecheck`, `bun run
lint`, `bun run format:check`: clean.
- `expo export` for iOS and Android: both pass.
- `expo-updates fingerprint:generate`: iOS
`138e0c6b171c82b4933e86808cdfef56da73b8c6`, Android
`906dc944f94eb8333fa384ed9f198834fdd30d13`. These are identical to
`dev`, so the fix ships OTA.
- No gateway, contract or web code changed, so no gateway integration
test and no web build. `check:tmp` was not run, since no server code
changed.
- **Not device-verified:** the device host reports "Could not
communicate with device support".

## Please re-test on a device (iOS first, then Android)

1. Open Updates from the sidebar. Tap **Update** on a linked computer
(or this computer's app). A "Update “Name”?" dialog appears **above the
sheet**.
2. Tap **Cancel**. The dialog closes, the sheet stays open and responds
to touch. Close the sheet. The app responds everywhere.
3. Repeat and tap **Update computer**. The sheet shows "Starting
update…", then the row's progress or state
(Queued/Downloading…/Restarting…), or a red error with details.
4. With an unsent draft or attachment, tap Update on this computer. The
sheet shows "Send or discard your drafts and files before updating this
computer."
5. **Update all** (when this computer's app has an update): same as 1–3,
with "Update all?".
6. Tap Update on a worker. The request goes out without a dialog and the
row shows progress.
7. Dialogs over other sheets:
   - Bot settings → Delete/Archive (confirmation inside the sheet).
- Bot actions menu → Delete bot (menu closes, then the dialog appears).
   - Thread actions → Delete.
After each: Cancel and Confirm, close everything, then check that the
whole app responds to touch.
8. Open a confirmation inside Bot settings, then swipe the sheet down if
possible, or background and resume the app. There should be no frozen
screen.

## Copy audit (docs/copy.md §8)

- New: `Starting update…`. Before, nothing was shown while the request
ran. It is a progress state (§4.6: -ing verb plus ellipsis), in sentence
case, a polite live region, and doesn't repeat the row badges.
- Existing confirmation texts are unchanged: the title is a question and
the button repeats its verb.
- Short, typical and long computer names: the dialog uses the existing
wrapping layout, not checked on a device (see above).

Fixes: #536
Related: #669
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