Skip to content

fix(cli): fall back to a published release when adding hosts - #9809

Open
ViktorBystrov72 wants to merge 1 commit into
ParadevAI:mainfrom
ViktorBystrov72:fix/hosts-add-unpublished-cli
Open

ViktorBystrov72 wants to merge 1 commit into
ParadevAI:mainfrom
ViktorBystrov72:fix/hosts-add-unpublished-cli

Conversation

@ViktorBystrov72

@ViktorBystrov72 ViktorBystrov72 commented Nov 16, 2026 •

Copy link
Copy Markdown

What & why

Addresses the hosts add failure in #9559. When desktop ships before its matching standalone CLI archive, onboarding a remote host fails with 404.

hosts add now opts into the installer's --fallback-latest behavior: a missing pinned archive produces a warning and one attempt at cli-latest. Published pins keep their original download; other HTTP failures remain errors. Manual installer pins and update --version keep their strict behavior. Missing versioned releases still need publication by the maintainers.

The install command is extracted into the existing SSH setup helpers and the CLI reference describes the fallback.

How I tested it

  • The regression fails with the original installer (exit 1 after a pinned 404) and succeeds after the fix (requests pinned archive, then latest; installs the fixture binary reporting 2.0.5).
  • Real sh, curl, and tar run the generated remote-install command against a loopback HTTP server. Six installer cases cover missing/published pins, an explicit manual pin, HTTP 500, missing latest, and avoiding a repeated latest request. No live SSH machine or cloud registration was used. Before/after output and reproducible probe.
  • SSH setup tests: 15 pass, 0 fail. Full CLI suite: 525 pass, 0 fail; marketing: 213 pass, 0 fail; desktop: 9,680 pass, 0 fail.
  • bun run lint:fix, clean bun run lint, all 42 typecheck tasks, docs typecheck, bun run check:i18n, and sh -n pass. No translation catalog changes.
  • Full bun run test --continue=always with TERM=xterm-256color: 27/30 tasks pass. Shared's macOS date-format assertion (test(shared): compare overnight recurrence slots by timestamp #9658), two unchanged agent-setup shell-wrapper tests, and three untouched host-service tests fail. The three host-service cases pass in a scoped recheck. No CI or unrelated test changes are included.

Implementation, diff inspection, and automated checks were performed with Codex. No human review or manual testing is claimed.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (CI fails on lint warnings too)
  • "Allow edits from maintainers" is checked on fork PRs
  • I have signed the CLA (confirmed on previous PRs)

Summary by cubic

Fixes hosts add failing with a 404 when the desktop build ships before its matching standalone CLI archive.

hosts add now falls back to the published cli-latest release when the pinned release's archive returns 404, with a warning. Published pins keep their original download; other HTTP failures and manual installer pins remain strict.

  • Extracts the remote install command into a shared helper.
  • Adds the --fallback-latest flag to the installer and documents the fallback in the CLI reference.
  • Covers the fallback paths with installer tests.

Written for commit 736b1a1. Summary will update on new commits.

View guided diff

Summary by CodeRabbit

  • New Features
    • hosts add now installs the latest published CLI if the requested release is unavailable.
  • Documentation
    • Updated the CLI reference to describe the fallback behavior.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The installer can retry a missing pinned CLI release from cli-latest when fallback is enabled. The hosts add command now uses a shared helper to run the installer remotely, and the CLI reference documents the fallback behavior.

Changes: Remote CLI installation

Layer / File(s) Summary
Installer fallback and validation
apps/marketing/public/cli/install.sh, packages/cli/src/lib/ssh-host-setup/install.test.ts, apps/docs/content/docs/cli/cli-reference.mdx
The installer retries from cli-latest when an eligible pinned release returns HTTP 404 and fallback is enabled. It parses --fallback-latest and --no-next-steps across its arguments. Tests cover fallback and failure cases, and the CLI reference describes the fallback.
Remote installer wiring
packages/cli/src/lib/ssh-host-setup/install.ts, packages/cli/src/commands/hosts/add/command.ts
installCliScript generates a remote installer script with the install directory and requested version. hosts add uses the helper to install or update the remote CLI.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant HostsAdd as hosts add command
  participant InstallScript as installCliScript
  participant RemoteInstaller as install.sh
  participant PinnedArchive as Pinned release archive
  participant LatestArchive as cli-latest archive
  HostsAdd->>InstallScript: Generate remote installer script
  InstallScript-->>HostsAdd: Return script with version and fallback options
  HostsAdd->>RemoteInstaller: Run generated script remotely
  RemoteInstaller->>PinnedArchive: Request pinned release archive
  PinnedArchive-->>RemoteInstaller: Return HTTP 404
  RemoteInstaller->>LatestArchive: Retry archive from cli-latest
  LatestArchive-->>RemoteInstaller: Return installer archive
Loading

Suggested reviewers: kitenite

Merge Risk: Minimal · up to 736b1

hosts add now falls back to the latest published CLI when the matching release archive is missing. The change is narrow and tested, and no actionable merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: hosts add now falls back to a published CLI release when the requested archive is missing. It uses conventional commit format, and the changeset matches it (install.sh…
Description check Passed The description follows the template sections (What & why, How I tested it, Checklist). It explains the fallback behavior, what stays strict, and the reason for the change, and it lists detailed test …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: hosts add now falls back to a published CLI release when the requested archive is missing. It uses conventional commit format, and the changeset matches it (install.sh --fallback-latest, installCliScript used by hosts add, and tests for the fallback).

Full details: Description check

Explanation

The description follows the template sections (What & why, How I tested it, Checklist). It explains the fallback behavior, what stays strict, and the reason for the change, and it lists detailed test results. It does not link the issue as a closing reference, but it cites #9559, which is a reference to the failure. The checklist is filled in. The How I tested it section gives commands and results but no screenshots, which the template prefers only for user-visible changes; this change is CLI-internal, so that is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4aa9591e-6624-48a7-8102-800ef2b07fbe
Commits

Reviewing files that changed from the base of the PR and between d31b92a and 736b1a1.

Files selected for processing: 5

  • apps/docs/content/docs/cli/cli-reference.mdx
  • apps/marketing/public/cli/install.sh
  • packages/cli/src/commands/hosts/add/command.ts
  • packages/cli/src/lib/ssh-host-setup/install.test.ts
  • packages/cli/src/lib/ssh-host-setup/install.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

This branch has not been deployed

No deployments
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