Repository navigation
feat(workers): install and update agent clis on demand - #26
Merged
Merged
Conversation
Workers report each agent CLI (path, version, install method, platform) over the link and run fixed per-method recipes on the owner's click. The gateway caches the latest versions from the official sources and enforces owner scoping, running-turn refusal and managed installs.
Each expanded worker lists Claude Code, Codex and Grok with version, install method and update state, an Install/Update button with live installer output, and the command to copy for Homebrew or mise. A summary offers Update all per provider; the Workers entry shows a hint.
nixuuu
added a commit
that referenced
this pull request
Nov 6, 2026
Nightly releases were cancelled by assertions that observed an earlier asynchronous event, plus three product lifecycle bugs. This change waits for the state each assertion actually needs and fixes the product bugs in separate commits. It adds no test retries, skips, blanket timeout increases or workflow cancellation changes. ### Product fixes - Bot shutdown releases the turn lease without replying “interrupted” to a worker's pending tool call. Old handlers reject instead of continuing to poll; the worker resends the same call after reconnect, preserving the pending approval and running inference once. The restart test now asserts these shutdown outcomes explicitly. - LAN discovery shutdown drains outstanding certificate checks and route writes. A handshake that finishes after discovery is disabled or shutdown starts cannot add a route. The silence test drains old discovery before deleting routes and observes actual query cycles instead of sleeping. - CLI discovery discards results captured before an overlapping install completed. A successful install can no longer be published alongside the previous executable/version. A controlled overlap reproduces the original stale-version report deterministically using the real discovery and installer code. ### Reproduction and results Rates below are **failed executions / attempted executions**, not historical workflow frequency. Gateway suites ran one file at a time, pinned to one CPU (`taskset -c 10`); process tests used `--rerun-each 100`. Skill-source checks also ran with two bounded CPU burners on that CPU. Temp data stayed on disk outside the repository. All repetitions execute the assertions normally; no retry wrapper is committed. | Test / suite | Cause and fix | Before | After | | --- | --- | --- | --- | | Governor: timeout kills an owned descendant | `/proc` exists/read races with reaping (including `ESRCH`); parent completion also precedes descendant signal delivery. Read once, catch only process disappearance, wait until the owned process cannot execute, retain the no-delayed-write assertion. | 9/100 | 0/100 | | Bots harness: restart preserves pending approval | Product shutdown returned an interruption or kept polling a released lease. Reject the old handler and preserve the unanswered call for replay. | 4/30 | 0/30 | | Composer: timeout and Stop kill the process group | Stop competed with a global 1.5 s fixture timeout; a local PID marker can precede gateway `turnStarted`; file creation can precede PID contents; immediate PID existence counts zombies as running. Give only the timeout case its short deadline, await gateway running state for Stop, publish PID atomically and await process termination. | 1/1 full suite | 0/10 full suites | | Composer: Stop during shell steer | Same PID publication and termination races. Keep interrupted-result and failed-delivery assertions. | Empty PID reproduced during verification | 0/10 full suites | | Linked-home unreachable/read-only | Re-enabling sharing reconnects before worker-record bootstrap arrives. Await the expected replicated settings before disconnecting. | 1/10 | 0/10 | | Remote thread creation/live stream | UI creation response precedes worker command delivery. Await delivery and explicitly verify the echo; settle its turn before enabling the next test's held-turn fixture. | 0/10 locally; 2 historical runs | 0/10 | | Remote attached file | Earlier shared-turn state can cascade into attachment waits. Finish held turns and restore fixture state in `finally`; preserve byte/content checks. No independent message-loss bug reproduced. | 0/10 locally; 2 historical runs | 0/10 | | Remote inline file / older peer | Same shared-turn sequencing; explicitly assert the received input exists before inspecting it. Preserve placement and old-peer fallback assertions. | 0/10 locally; 2 historical runs | 0/10 | | Relay: reciprocal sharing | Route withdrawal precedes asynchronous mirror purge. Await purge and retain the late-subscription rejection assertion. | 0/5 locally; 2 historical runs | 0/10 | | LAN: discovery disabled | Pending handshakes/writes survived socket closure and could recreate deleted routes. Drain discovery and recheck enablement after TLS. | 1/5 | 0/10 | | CLI: native update / discovery overlap | Product report combined a pre-install version with a post-install success status. Discard discovery across an install revision. | Controlled overlap 1/1; original suite 0/1 | Controlled overlap 0/100; original suite 0/10 | | Grok process cleanup (disposal and ignored cancellation) | Immediate PID check assumes signal delivery/reaping is synchronous. Use the shared bounded process-state condition; a zombie cannot execute. The reported flake did not reproduce locally. | 0/600 tests (100 complete runs) | 0/600 tests (100 complete runs) | | Agent skill sources | No verified current cause found; left assertions and product code unchanged. | 0/5 full suites plus 0/1 with two CPU burners | Passed in the full gate | The new process wait retains a five-second failure bound and accepts only a missing or non-executable process. Unexpected OS errors still fail the test. Stop still has to terminate its child and persist a user interruption; the timeout case still has to fail without launching a harness. ### Historical inventory Audit snapshot: **189 `dev` Release runs**, 2026-11-03 08:39 UTC through 2026-11-06 08:52 UTC, and **9 failed CI runs**. Read failed job logs, including first-attempt logs for the successful rerun of Release `42072916585`. Counts are distinct failed workflow runs per test, deduplicating run IDs across both listings and Bun's repeated summary lines. They are not a failure percentage: cancelled jobs did not all execute every test. Superseded cancellations with no failed job are excluded from test counts. | Full test name | Failed runs | Disposition | | --- | ---: | --- | | bots, schedules and worker settings at their linked home > an unreachable home fails immediately, keeps records read-only and queues nothing | 7 | Bootstrap barrier in this PR | | bot platform tools through the UI core > discover a worker without roots, add any absolute workspace, validate paths, start a thread and search its title | 5 | Already fixed by #107: wait for the returned initial turn to finish | | bots through official worker harnesses > gateway restart preserves a pending approval and never reruns inference | 4 | Product fix in this PR | | process governor with owned subprocesses > a timeout kills an owned descendant that would otherwise survive its parent | 3 | Process-state condition in this PR | | Share onward: three real gateways and independent databases > explicit reciprocal sharing permits both directions without a routing loop | 2 | Mirror-purge barrier in this PR | | bundled stack: local enrollment, gRPC online, remote enrollment, restart durability and complete shutdown | 2 | Already fixed by #44 (missing desktop reflect polyfill/startup) and #103 (initial pairing racing secure-route migration; preserves identity/data and separately verifies unchanged saves) | | migration 0077: connector configuration bootstrap > (unnamed) | 2 | Deterministic historical schema/fixture failure, not classified as a flake | | moving things between linked computers > interrupted after the decision: the move rolls forward through restarts and link drops, idempotently | 2 | Already fixed by #44: stop source work and await target's own record | | remote threads across two linked gateways > a file attached on A travels with the message to B | 2 | Shared-turn sequencing in this PR; no independent message loss reproduced | | remote threads across two linked gateways > a file placed in the text on A keeps its place on B; an older B gets the text without the badge | 2 | Shared-turn sequencing in this PR; no independent message loss reproduced | | remote threads across two linked gateways > a thread created from A on B's worker lives on B and streams back live | 2 | Worker-delivery / turn-completion barriers in this PR | | Bun worker -> grpc-js (Node) gateway over TLS > handshake, command, 100 events, ack, worker half-close | 1 | Already fixed by #107: await the client-end output event | | a postmaster orphaned by a killed guardian is stopped on the next start, so only one runs | 1 | Already fixed by #44: await orphaned sidecars during recovery | | actionable errors across gateway APIs > Grok bot with native id and Proxy connection uses the gateway API without a reasoning-starving cap | 1 | Obsolete API expectation; Grok execution now uses worker harnesses | | attachments > access to bytes > a preview the worker uploaded is readable through its thread (and its tree), nothing else | 1 | Historical 5 s timeout; current reproduction not established; #44 fixed scripted provider-ID collisions that could close links, but attribution of this timeout is unproven | | automation worktrees over gRPC > settled scheduled threads can be cleaned up and linked worktree schedules are refused | 1 | Deterministic historical expectation/refusal mismatch | | durable read-only thread mirrors across two gateways > a stale cursor or a journal gap fully resynchronizes, removing deleted threads and preserving archivals | 1 | Historical 60 s timeout; current cause not established; no speculative change | | guardian closes its owned process groups when the Electron pipe disappears | 1 | Already fixed by #44: stop during startup / desktop sidecar initialization | | managing the queue (gateway + scripted worker) > races with the head starting: the scheduler starts the head as it stands, with its current text | 1 | Historical closed worker link; #44 fixed colliding scripted provider thread IDs, but the log does not prove this particular link's closure cause | | managing the queue (gateway + scripted worker) > the scheduler starts a head only as it read it (whileHead) | 1 | Same historical closed worker link; exact attribution unproven | | owner-scoped SSH enrollment trust boundary > (unnamed) | 1 | Deterministic malformed OpenSSH fixture failure in `beforeAll` | | provider CLIs (gateway + real worker + fake CLIs and registry) > native Claude updates with `claude install`; output is redacted and secrets never reach the installer | 1 | Product report-consistency fix in this PR; regression forces the overlap | | remote threads across two linked gateways > only thread actions cross the link; requests that point elsewhere are refused | 1 | Deterministic historical allowed-method expectation | | routes and local network discovery between two linked gateways > with discovery off a computer announces nothing, answers nothing and forgets LAN routes | 1 | Product discovery-lifecycle fix in this PR | | worker enrollment and credential lifecycle over gRPC > CLI spends a token once, writes a private config, connects; rotation and revoke invalidate the live link | 1 | Already fixed by #45: enrollment token beginning with a dash was parsed as a CLI option | An additional failed CI run (`41914149735`) failed migration-ID/lint checks without a test failure; it is not a per-test row. Composer, Grok cleanup and skill sources were also investigated because they were reported in the task, although those names did not appear in this audit's failed-job inventory. ### Validation and limits - `bun install`, `bun run gen:check`, `bun run typecheck`, `bun run lint`, `bun run format:check` and `bun scripts/build-web.ts` passed after rebasing onto current `origin/dev`. - Full `bun run check:tmp`: **1,448 passed, 159 existing skips, 0 failed**, 258 files / 1,607 tests, 462.49 s. No test temp directories left behind; tool-owned runtime caches were removed by the runner's private-directory cleanup. - Additional unchanged suites: thread mirrors, attachments and queue management each passed **5/5 complete runs** pinned to one CPU. - The exact historical attachment-preview, mirror-resync and queue-link failures have no proven current root cause. The reported skill-source and Grok flakes did not reproduce in the bounded local runs. Passing repetitions reduce uncertainty; they do not prove every historical failure has been eliminated. - No live-provider tests, packaged macOS runtime tests or browser/E2E tests were enabled. Existing opt-in skips remain unchanged. No UI copy changed; the new gateway shutdown rejection is an internal worker replay signal. Fixes: #97 Fixes: #35 Fixes: #26
nixuuu
added a commit
that referenced
this pull request
Nov 7, 2026
No beta or stable has ever been cut: `next` and `main` are still at 57b87e5 while `dev` is ~290 commits ahead. The dev → next plan shows why. Besides a temporary explicit hold (#262 `Fixes: #26`, released once #262 soaks), the fallback blame of web fix #115 attributes its two adjacent lines in `AGENTS.md` to b7845036 `docs: add AGENTS.md…`, the second commit after `next`. A hold on that commit holds the entire suffix, permanently, because #115 is re-checked every run. A docs/test/ci/chore/style commit changes no shipped behaviour, so it can't be the change a fix corrects. Blame now never attributes to those commit types, and root `AGENTS.md`, `CLAUDE.md`, `README.md` and `CONTRIBUTING.md` join the shared files blame ignores. Explicit `Fixes:`/`Refs:` links and reverts still hold as before. `docs/release.md` describes the rule. Verified: new policy test (types, root files, refactor still holdable, explicit link to a docs commit still holds); `promotion-policy`, `promotion-attribution` and `promote` tests pass (38); typecheck, lint, format clean. Copy audit: no UI text changed.
This was referenced Nov 13, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 19, 2026
## Problem Canopy could refuse a Claude Code update based on a saved running report, even if the worker had reconnected and had no such installation. During an actual overlap, a second click could also surface a start refusal as a failed update. The reported Nightly installer output confirms Claude Code 2.1.328 was ready on Windows. The screenshot and output do not share an attempt ID. The Windows detection change in #994 enabled the action for native installs. ## Change - Use the current worker connection for live installer status, and keep installer output with its attempt ID. - Let the worker arbitrate installs. Repeated individual requests for the same active target use the existing result. Update all reconciles an explicit busy refusal with later reports and follows the active attempt ID. An install gets its full completion window once the contention clears. - Wait for any active installer for that CLI to finish validation before treating its reported version as proof of success. The worker checks the installed version again before installing an Update all target, including when a linked snapshot is stale. The coordinator sends guarded installs only on a live link to a gateway that supports the guard. - Record the accepted attempt ID in the audit entry. ## Verification - Revision `06bb2f70` on Linux (`nix-pc`). All 86 tests passed across provider-cli, update-cli-attempts, mise-cli, update-center, update-all-computers, and cli-discovery. The test temp directory was clean. - Regression coverage includes an outdated running report, repeated requests, same-version correlation, different-version contention, a rollback-capable competing attempt a guarded stale target sent to the worker, and an older linked gateway that must receive only the ordinary unguarded request. - Generated contracts with `bun run gen`. Gateway, worker, and integration test typechecks passed. Targeted Oxlint, Oxfmt and `git diff --check` passed. - Tests exercise a real Linux worker and simulated installers. Windows execution of this revision remains unverified. ## Copy audit - Update all now tells the user to update an older worker before retrying a guarded install. If the worker cannot identify the installed CLI version, the message explains the missing version and gives the next action. An older linked gateway gets a short Canopy update instruction in the same place. - Checked both messages in the existing Updates popover against a local fixture in a desktop-width light view and a 390 px dark view with short and long worker names. The existing error control provides the full text when the compact row truncates it. Fixes: #26 Fixes: #947 Related: #994
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.
Workers report Claude Code, Codex and Grok (path, version, install method) over the link. The gateway checks the latest versions from their official sources (6 h cache) and the owner can install or update each CLI per worker, or use "Update all" per provider, with live redacted output. Workers run only fixed recipes per install method (native
claude install <v>, the same npm/bun prefix, official user-level installers when missing) and verify--version, rolling back if it fails. Homebrew, mise, asdf, unrecognized and Docker installs only show the command to run; the gateway enforces this too. Installs are refused while that provider has running turns; owner-scoped and audited.Additive proto (worker/v1 + ui/v1 block 800), capability
cli_install, noWORKER_LINK_PROTOCOLbump, no migration (report stored inworkers.capabilities). Docs:docs/provider-cli.md.Tests:
tests/integration/provider-cli.test.ts(9, real worker process with fake CLIs/installers/registry: discovery, update available, recipes, redaction, failed install keeps the old CLI, version injection rejected, Homebrew/Docker refused by the gateway, running turns, owner scoping + audit); opt-in live test reads real latest versions. check:tmp clean.Not verified: real installers, macOS/Windows recipes.