Repository navigation
Set up, watch and remove a Linux desktop from the Mac app (851-4497) - #1503
Merged
pondorasti merged 3 commits intoNov 27, 2026
Merged
Conversation
pondorasti
marked this pull request as draft
November 27, 2026 03:12
pondorasti
force-pushed
the
alexandru/851-4497-linux-desktop-step-4-set-up-watch
branch
from
November 27, 2026 03:43
f83a8eb to
9e3192a
Compare
The Desktop card and the Desktop tab show on every Linux machine and drive the same server routes as codevisor desktop setup. Root steps run on the server with passwordless sudo, otherwise in a terminal tab on the machine. Adding a machine over SSH can ask for a desktop. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The card and the Desktop tab now look again when the live picture fails, so a desktop that stops while on screen gets Try Again instead of the viewer's plain retry, and the tab reconnects once the desktop is ready again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pondorasti
force-pushed
the
alexandru/851-4497-linux-desktop-step-4-set-up-watch
branch
from
November 27, 2026 22:52
9e3192a to
01ec346
Compare
pondorasti
marked this pull request as ready for review
November 27, 2026 22:52
…51-4497) The card and the Desktop tab say what went wrong in one plain sentence per attempt, such as "The desktop on <machine> isn't running.", without paths, socket names or raw server output. The detail goes to the app log under MachineDesktop and stays in codevisor desktop status. Open Terminal opens a tab named "Desktop setup" instead of one titled with the command line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pondorasti
deleted the
alexandru/851-4497-linux-desktop-step-4-set-up-watch
branch
November 27, 2026 23:37
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.
Fixes 851-4497. Part of 851-4479 (Linux desktops), step 4 of the design ("In the Mac app", "Failure messages").
What changes
Mac app
The Desktop card shows for every Linux machine (inspector, Machine tab), in the design's states:
Remove Desktop… in the card's menu, with "Remove the desktop on ? This closes everything open in it." A desktop Codevisor didn't set up only offers Stop Sharing Desktop…, with its own wording (it keeps running). Same rule as the CLI.
The Desktop tab offers itself on every Linux machine and shows the same states at pane size until there is a desktop to show.
Confirmations follow the CLI: replacing an older root desktop and replacing a desktop config Codevisor didn't write are each asked once before anything happens.
Open Terminal opens a terminal tab on that machine and types the server's own setup command, where the person types the sudo password. The app never holds a password and never builds or runs a root command. Where no terminal tab can open (a bot's workspace), the card shows the command to run instead of a button.
How the app drives it (
MachineDesktopSetupreducer inCodevisorCoreMac): the same routes ascodevisor desktop setup, in the same order:GET /v1/desktop, then after a yesPOST /replace-old,POST /packages(polled throughbusy),POST /start;DELETE /v1/desktop[?unshare=1]for removal. With passwordless sudo the server does the root steps; otherwise the card stops at "needs an administrator". No progress route was needed: the card names its own phase, as step 2 planned.Server (the CLI uses it too)
setupCommand: the server's own program followed bydesktop setup(withCODEVISOR_DATA_DIRwhen the data folder isn't the account's default), because a terminal the server starts doesn't always havecodevisoron its PATH.codevisor machines add <host> --desktop,desktop: trueonPOST /v1/machines/add, and the agents'machines.add. The remote script setsCODEVISOR_DESKTOP=1, and the installer runscodevisor desktop setup --yesat its end instead of printing the hint. The answer says whether the desktop came up (desktop: "ready" | "not-set-up"), and the command says it plainly. A failed or timed-out desktop setup doesn't fail the add once the machine has joined. There is no add-machine screen in the Mac app to put a checkbox on; that is a separate piece of work./v1/desktop(a non-Linux server answers 501).iPhone (decision 5, no setup from the phone): unchanged. A Linux machine without a desktop simply has no "Open Desktop" entry there.
Choices I made
codevisor desktop setupin that terminal prints the commands for an administrator. The app never receives root commands, so it can't show them itself.Tests
MachineDesktopSetupTests(21, TestStore with a fake client and clock): each resting state, the passwordless path line by line, needs-an-administrator for password and no sudo, the failure sentences, Try Again per failure, older root desktop with yes and no, remove and stop sharing, an install someone else started, a removal cancelling a look in flight, the picture kept for a working desktop, a desktop that never appears, one confirmation owner, a question whose view went away, renames, a running unmanaged desktop while asking, a desktop that stops while shown.DesktopRequestTests: each call is one request to the CLI's route; decoding.MachineStatusFeaturesTests: every other Linux machine gets a Desktop card.TerminalControllerTests: a new terminal's first command is typed once after the shell speaks.setupCommandwith and without a custom data folder; 501 on a non-Linux server; enrollment with and without a desktop, the outcome read from the installer's output, a join before a desktop timeout counted as added;machines add --desktopand its two answers.Proof so far
install.shwith this branch's server:CODEVISOR_DESKTOP=1root install installs and starts the desktop (70 s, exit 0); thesetupCommandfrom the status ran from a terminal with nocodevisoron its PATH; without the option, only the hint.bun run build:macos); Swift format and lint pass.After your review at f83a8eb
machines add --desktopon a machine whose desktop already runs: withCODEVISOR_DESKTOP=1the installer now always runscodevisor desktop setup --yes, which prints "The desktop is already running" (or restarts a stopped one), so the add reports it as ready. Installer test added.asking("Waiting for your answer about the desktop on ."), not a busy one. Cancelling, or the asking view going away, returns the card to its resting state, and a status look that lands meanwhile doesn't overwrite it. Test: ask from one view, drop it, the other view can act and ask again.The review pass on this round also found and I fixed: the "Setting up a desktop" match failing on the installer's coloured output, the tab pushing a stale name back, and a running desktop Codevisor didn't set up showing as ready behind the "Replace it?" question. Left, with the reason: the tab's Open Terminal decision comes from its pane context, not from the handler's own check for tabless (bot) workspaces, which have no tabs to hold a Desktop tab.
Hand checks in the dev app (light and dark)
CODEVISOR_NET_CA_FILE). That's a dev-environment gap, not something in this PR.Swift tests run locally
PRs don't run the Swift lane, so I ran the touched targets:
CodevisorClientTests,CodevisorCoreTestsandCodevisorCoreMacTestsin full, andMachineDesktopSetupTestsagain after the last change (21 pass). The Mac app's only test target,Transcript, isn't touched.After the look review
MachineDesktop) and stays incodevisor desktop status. "Server too old" and the unknown-system sentence, which names what to install, are unchanged.Tests:
MachineDesktopSetupTestsasserts each plain sentence (the fake server's detail includes a socket path), the "still missing" case and the terminal's name.TerminalLiveTitleTestschecks that a named terminal keeps its name over the shell's title. Ran the whole Swift package locally. The only failure wasCloudMachineKeyLookupTestswhile the machine's load was over 100; it passed when run alone, and this PR doesn't touch it. Rebuilt the Mac app and checked by hand: the container's stopped desktop shows "The desktop on Dev Cloud (kugel) isn't running.", with the socket path in the app log only. On an OrbStack VM with password sudo, Open Terminal opens a tab named "Desktop setup".Not in this PR
🤖 Generated with Claude Code