Repository navigation
feat(desktop): ship signed windows x64 builds on every channel - #335
Merged
Merged
Conversation
nixuuu
marked this pull request as ready for review
November 7, 2026 13:14
nixuuu
added a commit
that referenced
this pull request
Nov 10, 2026
## Change A worker event containing NUL could roll back an entire transcript batch. The gateway then drained the worker link, and journal replay sent the same event again. This fixes long-standing storage behavior exposed by Windows output. The supplied logs show 448 PostgreSQL NUL storage failures for the same thread and 448 matching worker drains/reconnects, between 2026-11-09 22:06 UTC and 2026-11-10 08:50 UTC. Consecutive active retries were approximately 11 seconds apart. The logs establish the rejected character and replay cycle; they do not establish which command or source encoding produced it. - Normalize U+0000 and lone UTF-16 surrogates to U+FFFD at gateway persistence boundaries, before event projections. This covers raw JSON keys/values, item identifiers, messages, tool input/output, bot projections, command results and generated titles. Valid surrogate pairs and literal backslash-u text stay intact. - Isolate PostgreSQL data exceptions (`22xxx`) after the failed batch rolls back. Migration `0111_worker_event_quarantine` stores the original protobuf as `bytea`; a visible warning and journal cursor commit atomically with it. The warning reuses the original event identity, so replay remains idempotent. Later events continue on the existing link. - Keep connection, deadlock and serialization failures on the existing unacked drain/redelivery path. Failure to save quarantine also rolls back the marker, cursor and preceding events in that recovery batch. - Existing journals recover automatically after updating the gateway. No journal deletion or worker protocol change is needed. Polish protocol, durability, transcript and data-model documentation explains the replacement and quarantine guarantees, including that quarantined events do not apply their original projections. Normal event ingestion scans string values and skips numbers/bytes. Clean strings retain their value; ordinary events need no event clone or raw-JSON parse. The work is linear in the event's fields and string length. Only suspicious raw JSON is parsed, and only changed events are cloned. Savepoints and per-event fallback writes are restricted to a failed data batch; the normal batch path adds no SQL round trips. Worker output decoding remains unchanged. Normal tool output reaches the adapters as text already decoded by the harness. Guessing UTF-16 from embedded NUL would risk altering valid output without access to its original encoding. The gateway remains the persistence guarantee. Linked-computer inspection found no dependency that turns a local worker disconnect into a computer-link disconnect: peer presence uses its own connections and heartbeats. The logs contain **770 local** and **89 linked** thread-watch resubscriptions, rather than 770 linked resubscriptions. They begin at 19:30 UTC, before the first NUL failure, so they are not solely a consequence of this loop. Worker hello/heartbeat writes also advance shared metadata revisions and trigger watch refreshes even with stable links. Flapping adds refreshes; avoiding unrelated heartbeat-driven refreshes is a separate follow-up, outside this storage fix. This conclusion comes from logs and code inspection, not a live Windows/macOS reproduction. Copy audit (§8): no recovery notice → “Some output could not be saved. Later output will still appear.” Two short English sentences explain the loss and automatic continuation; no new glossary terms, buttons, duplicated labels or humor. SQLSTATE stays in structured details and logs, without event payloads or secrets. The existing notice component renders the warning; no frontend layout changed. ## Verification - `bun install`, `bun run typecheck`, `bun run lint`, `bun run format:check`, and `git diff --check` passed. - `TMPDIR=/var/tmp bun test --rerun-each 5 tests/integration/event-storage.test.ts`: **35 passed**, no failures. Real PostgreSQL + gRPC + file-backed SQLite journal cover automatic replay, multiple NUL fields, raw JSON keys, lone surrogates, preserved emoji/literal escapes, later output, quarantine (`22P02`/`22021`), replay deduplication, transient serialization redelivery, bot projections, titles/results and rollback if quarantine persistence fails. - Focused files run separately: database schema/migrations **23 passed**; durable threads **6 passed**; journal delivery **2 passed**. - Full suite, generated-code check and web build are left to CI under the requested shared-machine limits. No browser/E2E runs or protected services were used. Related: #335
nixuuu
added a commit
that referenced
this pull request
Nov 10, 2026
## Behavior Windows updates currently launch the assisted NSIS installer and require someone at the computer. Windows now uses `quitAndInstall(true, true)` after service shutdown, so local **Restart to update**, gateway requests, and linked-computer requests install silently and relaunch Canopy. The first-time installer stays assisted (`oneClick: false`, directory selection, per-user default). macOS keeps the conditional feed replay introduced by #471 and its existing flags; Linux keeps its existing flags. Existing machine-wide installations can still require UAC even when update metadata describes a per-user installer. A preflight checks `isAdminRightsRequired`, the machine-wide NSIS registry entry, and installation-directory write access before shutdown. It refuses these updates with an actionable local message and a remote `failed` reason, releases the worker's drain barrier, and keeps services running. Update those installations manually with administrator approval, or replace them with a per-user installation. The Windows main-process shutdown timeout now uses `taskkill.exe /PID <owned-controller-pid> /T /F` instead of terminating only the controller. The normal supervisor already closes sidecar stdin, stops PostgreSQL with `pg_ctl stop -m fast`, waits for child closure, and uses owned-PID tree cleanup on timeout. NSIS starts after the controller exits. ## Pinned source verification Checked the lockfile and installed sources for **electron-updater 6.8.3** and **electron-builder / app-builder-lib 26.18.0**, plus their versioned upstream documentation and templates: - [AppUpdater API](https://github.com/electron-userland/electron-builder/blob/electron-updater%406.8.3/packages/electron-updater/src/AppUpdater.ts), [BaseUpdater](https://github.com/electron-userland/electron-builder/blob/electron-updater%406.8.3/packages/electron-updater/src/BaseUpdater.ts), and [NsisUpdater](https://github.com/electron-userland/electron-builder/blob/electron-updater%406.8.3/packages/electron-updater/src/NsisUpdater.ts): Windows receives `--updated /S --force-run`; metadata can select `elevate.exe`, and launch permission failures can also trigger elevation. - [NSIS documentation](https://github.com/electron-userland/electron-builder/blob/electron-builder%4026.18.0/website/docs/nsis.md), [assisted installer](https://github.com/electron-userland/electron-builder/blob/electron-builder%4026.18.0/packages/app-builder-lib/templates/nsis/assistedInstaller.nsh), and [multi-user macros](https://github.com/electron-userland/electron-builder/blob/electron-builder%4026.18.0/packages/app-builder-lib/templates/nsis/multiUser.nsh): silent updates select the previous install scope and read its `InstallLocation`, preserving a custom per-user directory. - [Installer](https://github.com/electron-userland/electron-builder/blob/electron-builder%4026.18.0/packages/app-builder-lib/templates/nsis/installer.nsi) and [install section](https://github.com/electron-userland/electron-builder/blob/electron-builder%4026.18.0/packages/app-builder-lib/templates/nsis/installSection.nsh): assisted silent updates can elevate for a previous machine installation; `/S --force-run` relaunches the installed app. - [Running-process check](https://github.com/electron-userland/electron-builder/blob/electron-builder%4026.18.0/packages/app-builder-lib/templates/nsis/include/allowOnlyOneInstallerInstance.nsh): `--updated` allows time to exit, then attempts cleanup. Silent prompts use default responses and can cancel installation if processes cannot be stopped. Our shutdown must finish first. Polish documentation in `docs/updates.md` and `docs/desktop.md` covers unattended updates, UAC refusal, shutdown, relaunch, and the rollout limitation: older clients still use their previous installer behavior for the first update that installs this fix. ## Validation - `bun install --frozen-lockfile` — passed. - `TMPDIR=/var/tmp bun test apps/desktop/test/updates.test.ts apps/desktop/test/update-install.test.ts apps/desktop/test/update-controller.test.ts apps/desktop/test/mac-update-feed.test.ts` — **37 passed**. Covers Windows silent/force-run flags, unchanged Darwin/Linux flags, both remote request sources, successful journal recovery at the target version, elevation refusal/retry, and the macOS conditional feed replay. - `bun run typecheck` — passed; Svelte reports 0 errors and 0 warnings. - `bun run lint` and `bun run format:check` — passed. CI remains the merge gate. No E2E suite or packaged installation was run. **Real Windows installation, UAC behavior, process-tree termination, and relaunch cannot be verified on this Linux machine.** Signing, publishing, and release workflows are unchanged. ## Windows tester checklist Start with a Windows desktop build containing this change and offer a newer release on its selected channel. 1. Run a local **Restart to update** and confirm the target version is installed. 2. Request remote updates from both a linked computer and a gateway while nobody interacts with the Windows computer; confirm reconnect reports the same request as `succeeded` at the target version. 3. Install per-user into a custom directory and confirm the update preserves that exact directory and install scope. 4. Confirm no installer wizard, directory prompt, finish screen, or UAC prompt appears for the per-user update. 5. Confirm Canopy relaunches automatically and gateway, worker, BFF, and PostgreSQL return. Check that old bundled `bun.exe` processes do not retain file locks; exercise normal shutdown and the forced cleanup path. Also test a machine-wide installation (including a custom machine-wide directory): local and remote requests must show the administrator-approval reason before shutdown, with no installer/UAC prompt, and services must remain available. The initial installation must still show the assisted directory-selection flow. ## Copy audit (§8) Before: machine-wide silent-update limitations had no specific preflight message. After: “Update needs attention” and “This installation needs administrator approval to update. Install Canopy for your user account to enable unattended updates.” A separate probe failure says “Could not check installation permissions. Retry the update on this computer.” Generic preparation failures also provide a retry action. Static audit passed: sentence case, short sentences, plain language, explicit next actions, no new glossary terms, no decorative copy, and no color-only cues. Existing native dialogs and error fields are reused; no buttons, confirmations, empty states, or layout changed. No browser or Windows dialog layout validation was performed on this Linux machine. Related: #335 Related: #471
This was referenced Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Windows x64 becomes a required desktop target on nightly, beta and stable, using
windows-2025andpackage:windows. Linux arm64 keeps its existing experimental behaviour. The existing publication pipeline uploads the NSIS installer, channel feeds and blockmaps, adds the Windows desktop manifest entry, and includes all assets inchecksums.txt.Windows signing now uses electron-builder's Azure Trusted Signing support. The non-secret configuration uses the ITSOL account, profile
canopy, endpointhttps://plc.codesigning.azure.net/, and publisherIT SOL SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ. Beta/stable fail clearly if credentials are incomplete. Nightly signs with complete credentials and otherwise builds unsigned with a notice. A signing failure never falls back to unsigned.The signing path covers the installer/uninstaller, app executable, Electron executable helpers and bundled
resources/runtime/bun.exe. Gateway, worker, web and controller are JS bundles run by that Bun executable; PostgreSQL is downloaded at runtime and is not bundled. After signing,Get-AuthenticodeSignaturemust reportValidand the exact publisher for the installer and every packaged.exe, otherwise the Windows artifact is not uploaded. Signed builds retain electron-updater's publisher verification across all channels. A valid signature identifies the publisher; SmartScreen also applies its own reputation and policy checks.Required repository Actions secrets in
itsoltech/canopy:AZURE_TENANT_ID,AZURE_CLIENT_ID,AZURE_CLIENT_SECRET. They come from the Azure service principal of the ITSOL Trusted Signing account, with the Trusted Signing Certificate Profile Signer role on certificate profilecanopy. The maintainer has now configured all three secrets. No values were read, copied or invented. The PR packaging job uses them for a real signing attempt. SmartScreen behaviour still requires a user-machine check.Verification:
bun install,bun run gen:check,bun run typecheck,bun run lint,bun run format:check, andbun scripts/build-web.ts. The foreground fullbun run check:tmprerun finished with 1,728 passed, 162 skipped, 1 failed, and no leftover temp files. Its only failure was an unchanged Grok provider fixture timing out (ConnectError: [canceled] The operation was aborted.); that file then passed alone throughbun run check:tmp(1 passed, 0 failed, no leftovers). Full sharded CI passed every selected test on the final head. Local temp data stayed inside the worktree; setting a Git discovery ceiling for its temp directory resolved fixtures incorrectly discovering the parent repository. No unrelated production/test code was changed.actionlintwith ShellCheck passed for both changed workflows.windows-2025: https://github.com/itsoltech/canopy/actions/runs/42374930788 (final head0fb05840fa3ebfa780925d0fbb7cc585a25d2673). NSIS installation, installed gateway/worker smoke, real updater metadata validation, manifest generation and artifact upload all passed. Repository PRs sign and verify; fork PRs build unsigned and check rejection by the signature gate. The workflow creates no releases, tags or images. The previous signed run also passed; its downloaded installer, blockmap and feed passedsha256sum --checkagainst its workflow artifact'schecksums.txt.Exact verification output from the signed packaging run (no secret values):
The build log also confirms Azure signing of the embedded NSIS uninstaller. Live Azure authentication/permissions and the positive signature verification path are verified. Interactive SmartScreen behaviour and a real cross-release GUI update were not exercised.
No release or promotion workflow was triggered. No merge is requested.
Copy audit: no UI text changed.