Repository navigation
feat(workers): install workers with a script or over ssh - #5
Merged
Merged
Conversation
nixuuu
added a commit
that referenced
this pull request
Nov 3, 2026
The nightly for #5 failed in `images (gateway)`: ssh2 (install over SSH) pulls optional native addons (`cpu-features`, `sshcrypto`). The images install with `--ignore-scripts`, so `bun build --compile` could not resolve `cpufeatures.node`. On the runners the addon was built for the build machine and embedded into every cross-compiled target, which is wrong for other platforms anyway. `scripts/build-binaries.ts` now stubs both addons (requiring them throws), and ssh2 falls back to its pure-JS path as it already does when they are missing. Checked: `docker build --target gateway` succeeds and the image runs; local linux-x64 gateway binary builds and starts.
nixuuu
added a commit
that referenced
this pull request
Nov 3, 2026
One Canopy install replaces the separate Stable/Beta/Nightly products. **Settings → App updates** (desktop only) stores the update channel locally, shows the version and download progress, checks for releases and restarts into an update. Moving to a more stable channel asks for native confirmation of a one-off downgrade, with the data-compatibility risk spelled out (`allowDowngrade` only for that attempt). | Channel | Gets | Feed | |---|---|---| | Stable | stable | `latest` | | Beta | stable, beta | `beta` | | Nightly | stable, beta, nightly | `nightly` | Feeds are cumulative and the highest semver wins; a stable release publishes the `latest`/`beta`/`nightly` aliases, a beta `beta`/`nightly`. Each release ships one Canopy artifact set, macOS ZIP/blockmaps, manifest and checksums. The installed build's icon tint stays. Existing Canopy Beta/Nightly installs (e.g. 0.2.0-nightly.2) need a one-time manual install of Canopy (Squirrel can't change the bundle identity); their data stays untouched, no automatic import. The desktop channel is independent of the gateway/worker update channel. Checks: bun install, typecheck, gen:check, actionlint, production web/desktop builds; AppImage and deb for all three channels (identity, names, SHA-512, feed aliases, manifests); six update tests with real electron-updater against a local feed server; `check:tmp` 662 pass / 0 fail. Rebased on dev (#5–#8): typecheck, web and desktop builds, release script tests and actionlint pass again. To confirm on a Mac: signing/notarization/Gatekeeper, Squirrel install of the ZIP, channel switches with Cancel/downgrade consent, data preserved.
nixuuu
added a commit
that referenced
this pull request
Nov 5, 2026
Installing a worker over SSH from the desktop app (local mode) failed, and the dialog layout broke. **Causes** - **Download URL:** the remote installer was given the desktop's loopback web origin (`127.0.0.1:<port>`) to download the worker binary, which the SSH target cannot reach. - **GitHub fallback:** the fallback's release metadata came from the same loopback origin, so it ended with "No GitHub release available for the gateway channel", even though `v0.2.0-nightly.74` exists with its Linux x64 binary, manifest and checksums. This was checked read-only. - **Dialog layout:** dialog content had no horizontal containment, so long output lines and fingerprints widened the dialog and added a horizontal scrollbar. **Fix** - **Release lookup:** the gateway resolves the exact release for its version first, then the newest compatible release on its channel. The output says which one it picked. - **Download:** SSH install sends public GitHub HTTPS asset URLs and the manifest SHA-256 over encrypted stdin, and the target verifies the checksum. - **Enrollment:** keeps a reachable gateway URL and its TLS pin. A missing or loopback address for a remote target is refused before anything runs, with one action: turn on network access or set a gateway address for workers. - **Dialogs:** long content wraps. The installation output and the fingerprint can be copied, and the output sits behind "Show details". Rename, Revoke and Archive dialogs were checked with long names too. - **Errors:** name the step that failed and what to do. The speculative "systemd user session or macOS GUI login" hint now appears only for real service-install failures. **Tests** - The installer and URL builder never send loopback addresses to a remote target. - A missing reachable address is refused. - Release selection for nightly, beta and stable, and the fallback, use fixtures. - ShellCheck passes on the installer. - `check:tmp`: 1372 passed, 0 failed. No real host was contacted. **Copy audit (§8):** cause plus action instead of a guess, shorter install buttons, details collapsed. Checked in light and dark, at desktop and phone width. **To retry:** turn on Network access or set a reachable "Gateway address for workers", then install again. An existing `worker.json` is kept; a previously saved wrong gateway address needs correcting or a fresh enrollment. Related: #5
This was referenced Nov 7, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 7, 2026
ssh2's ed25519 key generation drops a leading zero byte of the public key about once in 256 keys (83 of 20,000) and writes a private key that neither ssh2 nor OpenSSH can read (`Malformed OpenSSH private key`). The gateway uses it for each owner's SSH install key, so an affected owner's SSH worker installs fail until the key is rotated. A generated pair that doesn't parse is now generated again (`apps/gateway/src/core/ssh-keys.ts`); 0 of 20,000 bad afterwards. Owners who already have a bad stored key still need to rotate it once. Split out of the release flake PR (#325), where the SSH installer test's own host key hit the same bug. Copy audit: no UI text changed. Fixes: #5
nixuuu
added a commit
that referenced
this pull request
Nov 7, 2026
Scheduled Release runs on dev were cancelled when one flaky integration
test failed in a test shard. This PR collects every test failure from
the Release runs and PR CI runs of 2026-11-05 to 2026-11-07, finds the
cause of each, and fixes it deterministically. It adds no retries,
skips, global timeout increases or workflow changes.
Evidence was collected locally: gateway suites ran one file at a time,
mostly pinned to one CPU (`taskset -c 3`). Where a race could not be
forced naturally, a temporary delay was injected at the racing point,
and the same test was run with and without the fix. No injected delay is
committed.
### Fixed here
| Test | Cause | Fix | Before → after |
| --- | --- | --- | --- |
| `worker-ssh-command` › fixed SSH stdin … preserves the gateway and TLS
pin (nightly 42352444980) | After enrollment the installer runs `npm
prefix -g`. The test ran the runner's real npm, which cold-starts Node:
the success path took 0.3–4.1 s on CI (the tampering path, which exits
earlier, takes ~10 ms) and once went over the 5 s test timeout ("killed
1 dangling process"). | A stub `npm` in `$HOME/.local/bin`, which the
installer searches before the system paths. | 20 reruns with 6 busy
loops on the same CPU: mean 211 → 133 ms, max 662 → 314 ms; unloaded
mean 62 → 20 ms. |
| `full-access-mode` › an agent's side thread never gets Full access;
plus `agent-bus` › spawn options (PR CI) and the same race in 3 more
`agent-bus`/`agent-bus-cross` assertions | `spawn_thread` answers once
the side thread is stored. The gateway delivers the `createThread`
command to the worker afterwards, and the tests read `worker.created`
right away (Expected: 4, Received: undefined). |
`ScriptedWorker.createdThread(id)` waits for that command. | With the
worker's `createThread` handling delayed 200 ms: full-access 1 fail → 0;
agent-bus 3 relevant fails → 0; agent-bus-cross 2 fails → 0.
full-access-mode with 10 reruns on one CPU: 30/30. |
| `bots` › an expired lease cannot commit an old model answer (PR #318
CI) | The old gateway's 250 ms queue tick could re-claim the turn whose
lease the test expired before the competitor ticked. The held model then
ran again and the turn never settled (10 s timeout, last message "take
over"). | The old gateway drains, like one handing over: it keeps its
running turn but claims nothing. | With a 300 ms gap before the
competitor's tick: fail (identical error) → 3/3 pass. 10/10 on one CPU.
|
| `lan-routes` › routes are tried in order of last success (PR CI) | The
announcement test left B's withdrawn loopback route `127.0.5.2` in A's
routes. It is the newest route, so A's dial after the dead route
succeeded through it (dumped locally). B's next 1 s advertisement then
withdrew it, and the stale `127.0.0.1` route came first. On CI
`lastSuccessMs` was exactly one hour old, the value the test writes. |
The announcement test waits for the withdrawal and removes the route. |
The CI interleaving was not forced locally; the route dumps show each
step. After: 8/8 file runs on one CPU. |
| `config-sync-environment` › a document, a skill and a plugin arrive on
B (PR CI) | The test waited for the plugin only. A skill stays `WAITING`
until its version blob is fetched, one blob at a time (Expected:
`aeb81c…`, Received: undefined). | Wait for the document, the skill
version and the plugin artifact. | With B's blob fetches delayed 400 ms:
1 pass / 7 fail, the first with the exact CI error → 8/8. 5 runs on one
CPU: 8/8 each. |
| `composer-shell` › Codex steer executes at delivery (PR CI) | A watch
snapshot reads items before steers (`core-watch.ts`). When the
provider's user message item is ingested between the two reads, the
steer shows as delivered without its item. The stream sends the event
right after, so clients converge; the test only reads the first
snapshot. | Wait for a snapshot that has both. | 15 reruns on one CPU:
2/15 and 4/15 failed (the debug dump showed an empty item list) → 15/15.
|
| `schedules-new-thread` › offline pools retry the same occurrence (PR
CI) | A test closed a scripted worker's link while a command was on its
way. The worker loop replied on the closed link, and the `ConnectError`
escaped as an unhandled rejection that failed whichever test was
running. | The scripted worker's loop ends quietly on an unavailable
link. | Throwaway repro (close right after `createThread`, 20
iterations): 10/20 fail → 20/20 pass in 7 consecutive runs. The file
with 3 reruns: 21/21. |
| `worker-ssh` › owner-scoped SSH enrollment trust boundary (PR CI) |
ssh2's ed25519 keygen drops a leading zero byte of the public key (1 key
in 256). It writes a 31-byte public and 63-byte private key that neither
ssh2 nor OpenSSH (`ssh-keygen -y`) can read. The test's server host key
failed with "Malformed OpenSSH private key". | Product fix below; the
test uses the same helper. | `generateKeyPairSync`: 60/20000 and
83/20000 unreadable; `ed25519KeyPair`: 0/20000. worker-ssh 6/6. |
### Product fix (separate commit `fix(gateway): never store an
unreadable ssh install key`)
The gateway generates each owner's SSH install key with the same ssh2
call (`apps/gateway/src/core/worker-ssh.ts`, introduced in #5) and keeps
it until rotation. About 1 owner in 256 got a truncated public key and a
private key that can never be parsed, so every SSH install failed until
they rotated the key. `ed25519KeyPair` generates the pair again when it
does not parse. Keys already stored in that state still need Rotate. The
commit body carries `Fixes: #5`. This PR squashes under a `test:` title,
so that link and the patch release only apply if the fix is split out or
the PR is retitled.
### Already fixed by #262 (no change here)
- `config-sync-execution` › an unreachable home fails immediately…: all
6 failures were before #262 merged (last one 2026-11-06 09:01; #262
merged 10:27), and none since. 8/8 runs on one CPU.
- `remote-threads` › a file attached on A… / a file placed in the text
on A…: a cascade from the first test (worker `created` read without
waiting, thread not settled before the next test held turns). #262 fixed
exactly that, and none have recurred since.
- `computer-relay` › Share onward, `process-governor`, `bots-harness` ›
gateway restart: fixed by #262, and none have recurred since.
### Not flakes
Failures from in-progress feature-branch pushes, not on dev: the CLI
import suites on `feat/cli-import-*`, and the migration list and
error-text failures on `feat/linked-shared-config-7`.
### Gates
`bun install`, `bun run gen:check`, `bun run typecheck`, `bun run lint`,
`bun run format:check`, the web build and `bun run check:tmp` (1671
pass, 0 fail, 162 skip; nothing left in the temp dir) are all clean.
One thing to know: if TMPDIR is inside a Git checkout, `add-project` and
`linked-projects` fail locally, because their "folder without Git"
fixtures inherit the checkout's origin. `check:tmp` above ran with
TMPDIR on disk outside any repository.
Copy audit: no UI text changed.
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.
Replaces the repository-cloning instructions in Add worker with a verified binary installer, Docker and manual options, and gateway-driven installation over SSH.
/install/worker.sh, POSIX sh): detects OS/arch (Linux x64/arm64, macOS arm64), downloads the worker binary for the gateway's exact version from the web origin (gateway mirror) with SHA-256 verification, installs it where self-update can replace it, enrolls with the one-time token, sets up a systemd user unit / LaunchAgent, and reports which agent CLIs it found. Re-runs keep the existing enrollment; source builds fall back to the matching GitHub Release.sh -s, token over the encrypted stdin), sanitized live output, timeouts, cancellation, owner scoping and audit.0047_worker_ssh; additive UI RPCs; UpdateService v1 unchanged. Docs updated (worker-config, deploy, updates, data-model, ui-api).Validation: bun install, gen:check, typecheck,
check:tmp(660 pass, 149 skip, 0 fail), web build, ShellCheck; 7 focused integration tests with real worker binaries and a real sshd container. Chromium: every tab, light/dark, 1440/390 px.Real systemd/launchd activation and macOS/arm64 installs still need platform QA.