Skip to content

Offer a Linux desktop at install: the installer says how, and codevisor setup asks (851-4495) - #1499

Merged
pondorasti merged 1 commit into
mainfrom
alexandru/851-4495-linux-desktop-step-6-offer-the-desktop-at
Nov 27, 2026
Merged

pondorasti merged 1 commit into
mainfrom
alexandru/851-4495-linux-desktop-step-6-offer-the-desktop-at

Conversation

@pondorasti

@pondorasti pondorasti commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Fixes 851-4495. Part of 851-4479 (Linux desktops), step 6 of the design, command-line parts. No app UI.

What changes

  • The installer ends on Linux with one line: ==> Add a desktop: codevisor desktop setup, worded the way the server's account has to run it (su - codevisor -c '…' after a root install). Not on macOS. Not when a desktop that setup made is there (screen-sharing.json with "service": "systemd-user" or "process" in the data folder).
  • codevisor setup asks "Set up a desktop?" on Linux once the machine is signed in, default No, and on yes calls the same function as codevisor desktop setup (cli/desktop-offer.ts calls desktopSetupCommand; there is no second implementation).
  • It says nothing on a Mac, when a Codevisor desktop is already set up (running or not), when the server doesn't answer about desktops, where setup would stop with "install these yourself", and where a root step is needed that the account can't run (no sudo). Without a terminal codevisor setup stops as before, so the question is never reached.
  • A No or a setup that fails ends in one line that names codevisor desktop setup, and onboarding carries on and exits 0. Ctrl-C at the question prints nothing more. Anything that throws inside the offer is caught the same way.

Things I added to the scope as written

  • The installer line only shows when the installed server has the command. The installer installs the stable release, and merging this deploys the installer with the website, before a server release with codevisor desktop is stable. So the installer asks the installed codevisor for desktop setup --help and stays quiet when that isn't there. This is one more CLI call at the end of every Linux install.
  • A No is remembered (desktop-declined in the data folder). Without it, every later codevisor setup, including a reinstall at a terminal, would ask again. A yes whose setup failed is asked again next time, and so is a question that was cancelled.

After your review at 8937559

  1. Ctrl-C or a failed read at the question is no longer a No. The question has three outcomes now (yes, no, nothing); only an answered No writes desktop-declined. A cancel writes nothing, prints nothing more, and the question comes back on the next run.
  2. The installer leaves its line out when onboarding dealt with the desktop: when desktop-declined is in the data folder (a No, now or earlier), and when the codevisor setup this install ran at a terminal asked, got a yes, and the setup failed. For the second, setup writes desktop-setup-failed and the installer clears that file before it runs onboarding, so only a failure from this run counts. The line stays for installs without a terminal and wherever onboarding didn't ask.
  3. No usable sudo: not asked. When a root step is pending, the account has no sudo and the command isn't run by root, onboarding stays quiet, like on "install these yourself" systems. codevisor desktop setup still prints the commands for an administrator.
  4. The probe against the real stable release (0.1.117), in a Debian container, with this branch's install.sh:
Account installs for itself Root install (as_service_user)
Installer exit 0, no line that mentions a desktop exit 0, no line that mentions a desktop
codevisor desktop setup --help </dev/null on that CLI prints the top-level help (26 lines, nothing on stderr), exit 0 the same
Time, including starting the account's shell 1.8 s and 3.1 s in two runs 1.8 s and 1.4 s
Contains "codevisor desktop setup" no no
Files or folders changed under the account's home by the probe 0 0
Codevisor processes afterwards 0 0
Data and logs folders after the install empty empty

The old CLI does nothing but print and exit, so the probe is unchanged.

Tests

  • cli/desktop-offer.test.ts: asked and declined, yes runs the same setup, failure and a throwing setup, a cancelled question, every quiet case (no sudo among them), the remembered No, a config Codevisor didn't write.
  • cli/setup.test.ts: offered after sign-in and before "Setup complete", on an already signed-in machine, not after a failed sign-in, and a breaking offer doesn't fail setup.
  • scripts/release/install-desktop.test.mjs: the line on a fresh install, the root wording, no line with a Codevisor desktop, after a No, with an older release, or on a Mac; still a line with a config setup didn't write, and after an earlier failed setup when this install has no terminal. The existing installer test file was at the 500-line limit, so its harness moved to install-test-support.mjs unchanged, and five of its expectations gained the new CLI call. deploy-www.yml runs the new test file too.

Proof in a container (Debian 12, the real install.sh)

The installer ran for real against a stand-in server archive whose codevisor is this branch's build. No cloud account was used: a small local pass-through answered the "is this machine signed in" question with yes and passed everything else to the real server.

Case Result
Fresh install (root, no terminal) last line: ==> Add a desktop: su - codevisor -c 'codevisor desktop setup'
codevisor setup without a terminal "needs an interactive terminal", exit 1, no question (as before)
codevisor setup, answered No "No desktop set up. Add one any time with: codevisor desktop setup", exit 0, no desktop
codevisor setup again not asked again, exit 0
codevisor setup, answered Yes the usual setup output, "The desktop is ready", exit 0, Xvnc and Xfce running as codevisor
codevisor setup with the desktop there no question, exit 0
Second install, desktop present no line that mentions a desktop
codevisor setup, Ctrl-C at the question exit 0, nothing more printed, no mark written; asked again on the next run
Install at a terminal, answered No onboarding's line, installer exit 0, no installer line; desktop-declined written
Install without a terminal after that No no line that mentions a desktop
Install at a terminal, Yes, but setup can't install (sudo asks, no rights) setup's own output, "The desktop wasn't set up. Try again with: codevisor desktop setup", installer exit 0, no installer line
Install without a terminal after that failure last line: ==> Add a desktop: su - codevisor -c 'codevisor desktop setup'
No sudo on the machine codevisor setup doesn't ask, exit 0; codevisor desktop setup prints the commands for an administrator, exit 1

Code review

Two passes (medium) on the branch before the first push. No pass of mine after your review, as asked.

Fixed: the installer hid its line whenever onboarding had run, also when onboarding never asked; a throw in the offer could fail a finished sign-in; codevisor setup built the desktop's system object up front on every platform; my installer tests were a second harness outside the check that gates the website deploy; the "asked" mark was written before setup ran, so a failed yes was never asked again; a mark that can't be written could swallow a yes; the installer matched the word service anywhere in the config.

Left, with the reason:

  • The question is asked on a second Codevisor server of an account whose desktop unit another server owns; a yes ends in that server's own explanation. The status can't tell this case in advance.
  • The quiet status check can take up to 30 s on a server that is slow to answer; it normally answers in under a second.

Not in this PR

  • The "with a desktop" option when adding a machine over SSH from the Mac app (step 4).
  • The website's installation page doesn't mention desktops yet.

🤖 Generated with Claude Code

…or setup asks (851-4495)

The installer ends on Linux with the command that adds a desktop, unless
one is already set up or onboarding just asked. codevisor setup asks once
the machine is signed in, default No, and runs the same desktop setup on
yes; a no or a failure is one line and never fails onboarding.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@pondorasti
pondorasti force-pushed the alexandru/851-4495-linux-desktop-step-6-offer-the-desktop-at branch from 8937559 to d7c9d76 Compare November 27, 2026 01:54
@pondorasti
pondorasti merged commit 556ec6c into main Nov 27, 2026
@pondorasti
pondorasti deleted the alexandru/851-4495-linux-desktop-step-6-offer-the-desktop-at branch November 27, 2026 01:56
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