Skip to content

fix(updates): update paired desktop apps from mobile and web - #536

Merged
nixuuu merged 1 commit into
devfrom
fix/mobile-update-paired-desktop
Nov 11, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/mobile-update-paired-desktop

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

A phone paired to a desktop gateway can see its linked computers' update actions, but cannot update its own paired computer. Remote web clients have the same gap.

Expose the home desktop app as an update target and send confirmed owner UI requests through the existing LocalAppControl → RemoteAppUpdate path. Keep the installer, durable journal/receipts, idle barrier, Windows silent install and planned-departure/reconnect handling. The UI shows real updater progress and refusal reasons. Older gateways/desktops show a one-time manual-update instruction.

Home app installation requires explicit restart confirmation, lists known running turns and checks unsent-work blockers before dispatch. Update all continues to exclude the home app. Standalone gateway and worker updaters keep their existing actions. Phone credentials cannot open or report on the desktop control channel. Changes are additive in canopy.ui.v1; canopy.update.v1 is untouched.

Validation:

  • Paired-app gRPC integration: 7 passing tests / 55 assertions, including owner refusal, confirmation, old/disconnected/disabled desktop, rate limits/admin failures, receipts, idle barrier, gateway replacement and recovery using the same paired token.
  • Existing linked-updates (10), desktop-updates (8), gateway-departures (3) and updates-bundled (2) tests pass, one file at a time.
  • bun install, gen:check, typecheck, lint, format:check and web build pass.
  • Full check:tmp: passed once, sequentially: 2367 pass, 165 skip, 0 fail across 440 files (29325 assertions); “nothing left in the temp dir”.
  • Manual web fixture review in light/dark at 390, 768 and 1440 px: home action, progress, older-desktop instructions, running turns, Cancel focus, long names and blockers. The blocker was also checked again after opening confirmation.
  • EAS CLI 27.4.1 production fingerprints match on both platforms: iOS 6ddec9ef559ee0095ac33e94ff9418a942053b17; Android 5f6eae3ab278f1cd543e9ed763f923a319b65ec9. Mobile changes are JS/TS only.
  • Native mobile visual QA is unverified: local device platforms are unavailable, and the remote device host still reported “Could not communicate with device support” after its suggested refresh. No native install or Windows GUI installer was exercised; those paths are reused unchanged.

Copy audit (§8):

  • Before: the home app row had no usable update action. After: named computer + “Update Canopy on {name}”; the confirmation repeats “Update” and explains restart, automatic reconnection and the idle barrier.
  • Before: the own app needed an update from its computer without a clear route. After: “Update this computer from its own window once to enable remote updates.” The dependency and next action stay visible.
  • “Send or discard your drafts and files before updating this computer.” gives a concrete action. Existing failure details remain expandable. New text uses the glossary, sentence case, present tense, typographic quotes and correct plurals; no new jargon, empty states or decorative copy.
  • Reviewed typical/short and long names on desktop and phone widths. Actions have accessible text labels; statuses and blocker explanations do not depend on color. Native layout remains the visual-verification gap above.

Related: #373
Related: #471
Related: #479
Related: #507

Route confirmed owner UI requests through the existing desktop control channel, updater journal and idle restart barrier. Show the home app capability and real status in mobile and remote web update centers, with draft blockers and explicit restart confirmation.

Related: #373
Related: #471
Related: #479
Related: #507
@nixuuu
nixuuu merged commit 85acd3f into dev Nov 11, 2026
10 checks passed
@nixuuu
nixuuu deleted the fix/mobile-update-paired-desktop branch November 11, 2026 08:47
nixuuu added a commit that referenced this pull request Nov 12, 2026
Reconcile desktop journals, persisted gateway history and client snapshots with current versions or completed feed checks. Add durable owner-scoped dismissal and restart integration coverage.

Fixes: #70
Fixes: #210
Related: #536
nixuuu added a commit that referenced this pull request Nov 12, 2026
Reconcile desktop journals, persisted gateway history and client snapshots with current versions or completed feed checks. Add durable owner-scoped dismissal and restart integration coverage.

Fixes: #70
Fixes: #210
Related: #536
nixuuu added a commit that referenced this pull request Nov 12, 2026
Reconcile desktop journals, persisted gateway history and client snapshots with current versions or completed feed checks. Add durable owner-scoped dismissal and restart integration coverage.

Fixes: #70
Fixes: #210
Related: #536
nixuuu added a commit that referenced this pull request Nov 12, 2026
Reconcile desktop journals, persisted gateway history and client snapshots with current versions or completed feed checks. Add durable owner-scoped dismissal and restart integration coverage.

Fixes: #70
Fixes: #210
Related: #536
nixuuu added a commit that referenced this pull request Nov 12, 2026
Reconcile desktop journals, persisted gateway history and client snapshots with current versions or completed feed checks. Add durable owner-scoped dismissal and restart integration coverage.

Fixes: #70
Fixes: #210
Related: #536
nixuuu added a commit that referenced this pull request Nov 12, 2026
An interrupted remote app update can leave a failed journal and a
stopped Update all run visible after the target is already current.
Reconcile those records with the target's version or a completed Up to
date check, so obsolete failures stop driving the Updates header and
sidebar badge.

Restart recovery accepts the requested version or any newer SemVer
version, including an interrupted journal saved before `restarting`.
Returning on the old version remains a failure. Relevant failures offer
Request again and Dismiss on web and mobile. Dismissals require the
current request or run ID, remain owner-scoped, and survive gateway/app
restarts. Dismissing a stopped run also acknowledges its matching app
failure; it never acknowledges a newer request.

Reconciliation persists the result without starting queued later steps.
Linked-computer action responses replace cached snapshots, and clients
reject reads started before a newer action. Contracts are additive;
frozen `canopy.update.v1` is unchanged. Mobile edits are TypeScript
only, with no native configuration changes.

Caller audit: web popover, linked-computer settings, mobile rows and
stopped-run dismissal preserve the request IDs returned in snapshots.
Electron has no separate renderer dismissal IPC; control commands carry
the target-local ID unchanged to its journal. Linked-app dismissal now
also accepts a plain UUID scoped to the explicitly selected direct peer
of this owner. Existing qualified IDs retain their suffix, so another
computer's ID is rejected; the target still checks its exact current
failed request. Integration coverage exercises both forms, mismatched
requests, foreign computer suffixes, cache replacement and the target
journal acknowledgement.

### Validation

- Added gateway/desktop integration coverage for equal/newer version
recovery, old-version failure, completed Up to date checks, retry
success, durable owner-scoped dismissal, linked snapshot replacement,
and gateway replacement without launching later steps. Updated the
existing orchestration fixture to report the installed version on
success. No web UI tests added.
- Rebased onto the requested `origin/dev` (`f7ad51cc`). `bun install`
and `bun run gen:check` passed with a clean working tree. Changed-file
lint/formatting and whitespace review passed. Static self-review covered
persistence, request identity, owner boundaries, restart classification,
cache ordering, stopped-run safety, and copy.
- Focused local verification passed: `bun test
tests/integration/stale-app-updates.test.ts
tests/integration/desktop-updates.test.ts
tests/integration/update-center.test.ts` — **27 pass, 0 fail, 139
assertions**. Fixtures ran sequentially. The linked-computer suite stays
on CI because it needs two gateways. The maintainer explicitly requested
no local full `check:tmp`; full static/typecheck/test/build validation
runs in GitHub CI.
- Real-browser review passed at 1280×800 and 390×844 in light/dark, with
short, typical and long names. Reviewed the production sidebar/popover
using controlled snapshots: a relevant failure retains Request again and
Dismiss plus the other row; equal/newer target versions and a reconciled
stopped run remove the old failure, header and red badge. Clicking row
Dismiss through the real client request path preserved the qualified ID
and replaced the snapshot using a mocked acknowledgement. Backend
durability/ownership were verified separately by real gRPC integration
tests. The web shell intentionally had no live gateway; its connection
warning/502s were expected fixture-environment noise. No web UI test
suite was added. Browser tab and local web server were stopped after
review.
- EAS production-profile fingerprints match the `dev` baseline on both
platforms: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Mobile remains JS/TS-only;
no native runtime change.
- CI log follow-up kept rejected downgrades as failures, restored
refreshes after replacing a linked action snapshot, and corrected the
linked/request and persisted-settings test setup. Linked-app dismiss
accepts both ID forms while retaining foreign-target and stale-request
rejection.

### Copy audit — docs/copy.md §8

| Before → after | Reason |
| --- | --- |
| Failure with no acknowledgement → **Request again** and **Dismiss** |
Offer recovery and acknowledgement while keeping other update rows
visible. |
| Generic update icon label → **Request update again on {computer
name}** for a failed request | Give the retry icon a concrete accessible
action. |
| No resolved/dismissed result → **Resolved** and **Dismissed** in
mobile history | Explain terminal results without protocol terms. |
| No dismissal precondition → **Choose the current failed update to
dismiss.** / **Choose the current stopped updates to dismiss.** | State
the action when the selected request is obsolete. |
| No dismissal outcome → **The app update was dismissed. Request it
again to continue.** / **Pair this desktop app again to dismiss its
update.** | Explain the state and next action in plain English. |

- New text uses sentence case, plain glossary terms, imperative actions,
and the sentence-length limits. Action labels/statuses have no trailing
punctuation; sentences have periods.
- Error messages name the condition or the required action. Existing
restart confirmation is reused. No new empty state, external-data
warning, or humorous copy is introduced.
- Each action and outcome has one purpose. No new explanatory copy
repeats a badge or tooltip. Important information stays visible or in
existing expandable details.
- Meaning does not depend on red text or an icon alone: failures retain
text, retry icons have labels, and Dismiss has a visible label.
- Short/typical/long-name checks at desktop/phone widths and light/dark
visual review passed. Names truncate cleanly, error text wraps, recovery
actions remain available, both rows stay visible and there is no
horizontal overflow.

### Attribution

The exact-version restart classification was introduced by #70
(`16648d37b`), and #210 (`155406fc7`) introduced the linked-app
orchestration that retains the stopped result. Both predate #536; #536
is context rather than the introducing change.

Fixes: #70
Fixes: #210
Related: #536
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
nixuuu added a commit that referenced this pull request Nov 15, 2026
nixuuu added a commit that referenced this pull request Nov 15, 2026
nixuuu added a commit that referenced this pull request Nov 15, 2026
Paired desktop apps in remote gateway mode already support whole-app
updates through `DesktopControlService`. The shared updates row could
still say “Managed externally” or “Offline”, disable its action based on
the worker’s separate UpdateService connection, and show the old
“updates itself” instructions.

Use the desktop control connection and the app’s own newer release for
the row, action, and version target in both the footer popover and
Settings → Workers → Updates. Show “Update Canopy app” when available,
explain how to reconnect or pair when unavailable, and describe
whole-app updates when current. Update all skips disconnected apps with
a reason. The local bundled gateway/worker remain one row, labelled
“This Canopy app”.

Related: #536, #743

Validation passed: `bun install`, `bun run gen:check`, full `bun run
typecheck` (plus a final web typecheck after the copy changes), `bun run
lint`, `bun run format:check`, and the web build. `TMPDIR=/var/tmp nice
-n 10 bun run check:tmp tests/integration/desktop-updates.test.ts
tests/integration/updates.test.ts
tests/integration/update-center.test.ts
tests/integration/updates-bundled.test.ts`: **44 passed, 0 failed,
nothing left in the temp dir**. Full `bun run check:tmp` terminated with
SIGTERM before a final result; it is not counted as passed. This PR
stays draft pending that repository-wide gate.

Browser review passed for the shared popover and Workers updates rows in
light/dark, desktop and phone widths, with short, typical and long
names. Confirmed the enabled “Update Canopy app” action without the
worker update stream, current-version note, visible recovery
instructions, and the single local bundled app row. Used the development
gallery in an isolated review checkout, with only its shell connection
guard bypassed there; no live gateway or native Electron installation
was involved. Removed the review server and checkout afterwards.

Copy audit (§8):
- “Managed by the Canopy desktop app: it updates itself…” → “Updates
with the Canopy app. You can update it here when a new version is
available.” Explains the available remote action.
- “Update {worker name}” → “Update Canopy app”. Names the whole app
being updated.
- “Desktop app is offline.” → “Desktop app is offline. Open Canopy on
that computer and reconnect to this gateway.” Gives a recovery action,
visible below the row.
- Pairing fallback now names this gateway and Settings → App updates for
an already paired older app. Sentences follow length limits, sentence
case, active voice, glossary, and punctuation. No humour, new terms,
colour-only cues, or extra empty states.
- Unsupported-app copy now explains the version limitation and points to
Settings → App updates. “This computer” → “This Canopy app” for the
bundled local row names what updates. Checked wrapping and truncation at
desktop and phone widths.

Native signed macOS installation, notification, and Squirrel restart
require a Mac app run. Integration replaces only the Electron main
updater boundary; it exercises real pairing, worker proof, gateway, TLS
control stream, reports, idle wait, restart/reconnect, and Update all.
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