Skip to content

Fix what hedge devbox add hit on the first cloud-only run - #288

Draft
Silthus wants to merge 8 commits into
feat/cloud-onlyfrom
fix/devbox-add-run
Draft

Silthus wants to merge 8 commits into
feat/cloud-onlyfrom
fix/devbox-add-run

Conversation

@Silthus

@Silthus Silthus commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

What the first run hit

The first headless run of the cloud-only setup (#284) added a node with hedge devbox add from the hub. It hit these problems in that command. The numbers are the run's findings.

  • 33: The node runs in another region. It cannot reach the Coder address that the hub uses (dial tcp ...: i/o timeout), only its own agent address, CODER_AGENT_URL, such as http://coder.internal/. The Coder sign-in failed, and the token that coder tokens create made stayed behind, unused.
  • 35: Over Coder SSH the user is neither logged in nor lingering, so systemd's user manager does not answer, and the node's apply failed with T3 Code cannot run as a service.
  • 36: Run on the hub, devbox add ended with "The hub has not linked the node ... run hedge peers link". But T3 Code on the hub already listed the node through T3 Connect, and hedge peers link then failed with T3 RPC request failed.
  • 37: After devbox add, the node's doctor listed the Git allowlist, earlyoom and a team pack's review key as To do, steps the person already did on the hub. devbox add ran none of them.
  • 38: The node's apply failed on that run, so the profile step never counted as done. Each rerun ran get.sh again, which fetches the engine, installs its packages and applies the whole profile, for several minutes.

What this PR does

  • 33: The node needs a Coder user session: its hub forward and its credential pulls run ssh coder.<hub>, which coder config-ssh routes through the Coder CLI. The Git key needs none, since scripts/coder-git-key.sh uses the workspace agent. So devbox add still makes a token, but sends it only to the hub's own Coder address, the URL this machine's Coder CLI is signed in to, never to an address the workspace names. Before it makes a token, it checks that the node reaches that address over HTTPS: curl -q --proto =https on /api/v2/buildinfo must answer 200, with no redirect followed. When the address is plain HTTP, or the node does not reach it, devbox add makes no token, sends none, installs nothing, and stops with the sign-in the person does on the node: install the Coder CLI from their deployment, and coder login with an HTTPS address the node reaches. A rerun keeps the session the person made, whatever address it uses. When the node is already signed in to Coder another way, devbox add leaves that sign-in alone: when its url file names another address, when it has a session file and no url, when its url or session path is not a regular file (a directory, a link, or anything else), or when CODER_URL names another address or CODER_SESSION_TOKEN is set in its SSH environment. It makes no token and writes no sign-in file. When the hub's Coder address is HTTPS, it installs a missing Coder CLI the same way as below, and lists coder login <address> && coder config-ssh --yes among the steps for the person at the end. When CODER_URL or CODER_SESSION_TOKEN is set, that step first says to remove them from the node's environment, by name and with no value, because the Coder CLI reads them before its files. When the hub's Coder address is plain HTTP, the step says so and that the person signs the node in over HTTPS, and it prints no command. It writes only when the node has no Coder sign-in, or its url already names this exact address. When the node has no Coder CLI, devbox add installs it only from that address, with curl -q --proto =https --max-redirs 0, into a new mktemp file. It moves the file in place only when the answer was HTTP 200, the file is not empty, and the downloaded CLI's version runs. No coder login runs. The token goes over the SSH channel on standard input, and a shell on the node writes it with printf (a built-in, so it is in no argv) to session, and the address to url, in ${CODER_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/coderv2}. Each goes first into a staging file that mktemp creates there, new and owner-only, then mv puts it in place. The write runs the sign-in check again right before it, and fails when a destination is not a regular file after its mv. These are the files the Coder CLI reads on Linux: coder login --help in v2.37.4 says Linux keeps the session token in a plain text file, --global-config defaults to $CODER_CONFIG_DIR or <user config dir>/coderv2, which follows XDG_CONFIG_HOME, and coder login token prints the raw file. Hedge makes no authenticated request from the node during setup. This machine makes the token, so it is valid as made, and the HTTPS check already shows that the node reaches the same address. The node's next Coder use, coder config-ssh --yes, is the same use as after any coder login by the person. When Hedge cannot write the files, it removes the token, which never reached the node, or names it and the command that removes it. The agent address fallback, its deployment_id check, the plain HTTP download, the node-side coder whoami check of the new token, and coder login --use-token-as-session are gone. A cross-region node like the first run's, which reaches Coder only at http://coder.internal/, still needs that one manual sign-in.
  • 35: The setup-fixes PR (branch fix/cloud-setup-run) turns on lingering inside hedge apply when the user manager does not answer. devbox add runs that apply on the node, so this PR reuses it and adds no linger step of its own. It only sets XDG_RUNTIME_DIR to /run/user/<uid> for the node's apply when the SSH session has none, so systemctl --user finds the user manager once it runs.
  • 36: Before it runs hedge peers link, devbox add reads the node's T3 environment id and the hub's t3 environment list. When the hub lists the node with the status reachable, it prints ✓ The hub, <hub>, reaches <node> in T3 Code. and does not run hedge peers link. A link listed as expired or unreachable gets hedge peers link as before, and when that cannot run, the hint names the link's state and the command that links it. It no longer says the hub's daily renewal links it: that renewal skips an unreachable link with more than seven days left. Run on the hub, it reads T3 Code on this machine instead of over SSH. The hint names where to run hedge peers link: here on the hub, or ssh <hub> '<PATH>; hedge peers link <node>' elsewhere.
  • 37: After the node's apply, whatever its exit code, devbox add asks the node which steps are left: the new hedge doctor --to-do prints them as JSON on its last line, from the node's own profile and pack revisions. (hedge apply exits 0 while a human step with a command is open, so the exit code cannot tell.) Before that line it prints every other finding that fails the doctor, such as the guards pack's systemd version check, and then it exits 1; with only steps for the person, it exits 0. A step is for the person only when its finding's repair type is human: a pack step that Hedge repairs itself (repair: "apply") is another finding, never a step for the person. It runs none of those steps itself, with or without a password for sudo. When the apply passed and the node reports nothing but steps for the person, the profile step counts as done: it prints how many are left, and devbox add goes on with the Claude, ChatGPT, T3 Connect and link steps. At the very end it lists those steps once, each with its ssh -t <node> '<PATH>; <command>', then Do each one, then run hedge apply on <node>., so the jobs, steps and settings that wait on those steps get installed. It exits 0, as hedge apply does when it ends with To do: lines. When the apply failed, or the node reports anything else, devbox add stops at the profile step, with the other findings and the steps left in its error. A failed apply prints what the node's doctor found too, which the apply may not have printed. A node engine older than --to-do answers hedge: unknown option --to-do; then the step finishes when the apply passed, with one line that points to hedge doctor on the node. <PATH> is the same PATH="$HOME/.local/bin:$HOME/.bun/bin:$PATH" that Hedge's own SSH calls set, so the command works in a plain SSH session.
  • 38: The install step runs get.sh --install-only until it is done, as before. When the node's engine is at the commit this machine's engine runs and the node's ~/.local/bin/hedge help runs, the profile step runs the node's hedge apply --profile directly instead of get.sh. With another commit, or a launcher that does not run, such as after a failed bun install, it runs get.sh as before.

SETUP.md (item 3 of adding nodes) and CHANGELOG.md say what changed.

Tests

The tests are in src/setup/devbox-node.test.ts and src/setup/devbox-node-apply.test.ts, and run hedge devbox add through main. The fake machine in src/setup/testing.ts has a node whose shell runs for real in a temporary home. Its engine runs the real hedge apply and hedge doctor with the files adapter (src/setup/fixtures/node-engine.ts). With stepsFail, every pack command there fails, so the real apply fails on a pack step: the "another reason" case. With oldSystemd, the guards pack's systemd version check fails. Its system boundaries are stand-ins: sudo (with or without a password), gh (clones the local profile repo), curl, ssh, and the root state of the Git allowlist and earlyoom. The node's Coder CLI signs in with the session and url files in ~/.config/coderv2 only when they hold a token this machine made and has not removed, at an address the node reaches, or a session the person made, at any address. The node's curl refuses any protocol but HTTPS when told --proto =https. With coderRedirects, its build info or its CLI download answers with a redirect, which it follows when -L or a ~/.curlrc with location says so, unless -q comes first or --max-redirs is 0. With coderCli, the CLI download answers with another status than 200 and a CLI that runs, with an empty 200, or with a 200 CLI whose version fails. Every shell command on the node runs with boxEnv, and the node's Coder CLI reads CODER_URL and CODER_SESSION_TOKEN before its files. The Coder CLI it downloads runs coder login, and its coder config-ssh writes ~/.ssh/config for CODER_URL, or else for its url file. The tests check outcomes: the root state, the installed engine's commit, its packages and whether its launcher runs, the node's applied profile, the T3 links this machine made, the fake Coder's token list, the content and mode of the node's url and session files, the SSH config its Coder CLI writes, the Coder CLI on the node, a file that a staging path links to, and the raw t3 environment list --json of the hub. Each printed step runs whole through a fake ssh, so the local shell parses its quoting, with its own HOME and a sudo that refuses, apart from the node's.

Rule Test Fails without the fix?
33: the token goes to the hub's own Coder address, as the session file the node's Coder CLI reads, mode 600, in no argv at this machine's Coder address, with the session file its Coder CLI reads, which only its owner can read yes: with coder login back in place
33: the Coder CLI comes from that address over HTTPS installs the Coder CLI there from this machine's Coder address over HTTPS yes, on base
33: no token, no install, a step for the person when the node does not reach that address but makes no token, sends none and installs nothing when the workspace does not reach that address, and leaves the sign-in to the person yes
33: no token and no install over plain HTTP and makes no token and installs nothing when this machine's Coder address is plain HTTP, though the workspace reaches it yes
33: the token goes through new owner-only staging files, never through a file that already waits there and never writes the token through a file that already waits in its Coder folder yes, with the fixed session.hedge path
33: the node's url and session files, mode 600, and its SSH config hedge devbox add signs a Coder workspace in to Coder and writes its SSH config, so it reaches the hub and the other nodes by their coder. names (devbox-add.test.ts) yes, without the url move
33: a redirect from the build info gives no token and no CLI, though ~/.curlrc follows redirects and makes no token and installs nothing when the workspace's Coder build info answers with a redirect, though its curl follows redirects yes, without -q
33: a redirect from the CLI download installs nothing and makes no token and installs no Coder CLI and makes no token when the CLI download answers with a redirect, though its curl follows redirects yes, without the 200 and version checks
33: each CLI download check holds alone: a non-200 answer with a CLI that runs, an empty 200, a 200 whose version fails and installs no Coder CLI and makes no token when the CLI download %s (3 cases) yes: each case fails without its own check
33: another sign-in stays as it is: another url, a session without url, CODER_URL, CODER_SESSION_TOKEN; the CLI gets installed, the step names the variables to remove, and the printed repair, run through a fake ssh once the variables are gone, points the SSH config at the hub's Coder address but leaves the workspace's own Coder sign-in %s as it is, makes no token, installs the Coder CLI, and lists a sign-in that points its SSH config at this machine's Coder address (4 cases) yes, without the url and the CODER_URL checks, the CLI install, or the variable names
33: a session directory is another sign-in but leaves a session path that is a directory as it is, makes no token, and lists the sign-in for the person yes, without the regular-file check
33: the write fails, and the token is removed, when a session directory appears after the first check and fails the write, and removes the token it made, when a session directory appears after the first check yes, without the regular-file check
33: no plain HTTP sign-in command beside another sign-in and lists no plain HTTP sign-in, and installs nothing, when it leaves another sign-in alone and this machine's Coder address is plain HTTP yes
33: a token Hedge cannot write is removed and removes the token it made when it cannot write it on the workspace yes
33: a failed removal names the token and the command and names the token and the command that removes it when its removal fails too yes
37: a step that only Hedge repairs is a finding, so --to-do exits 1 --to-do exits nonzero and lists no step for the person when a step that only Hedge repairs fails (cli.test.ts) yes
37: a failed apply names what the node's doctor finds names what hedge doctor on the node finds when the apply fails, though the apply printed none of it yes
37: run no step for the person runs none of the steps left for the person, though sudo there asks no password yes
37: only steps for the person left: go on to the link, list each once at the end, as commands that run over plain SSH, then hedge apply goes on to the link step when only steps for the person are left, and lists each one once at the end, as a command that runs over plain SSH (runs each printed command through a fake ssh) yes
37: a later failure still prints the list still lists the steps left for the person when a later step fails yes
37: an apply that fails for another reason stops at the profile step, and a rerun after the fix links the node stops at the profile step, links nothing, when the apply fails for another reason, and a rerun after the fix applies the profile and links the node yes
37: a failing check beside a step for the person stops at the profile step stops at the profile step, and names what else the node finds, when a check that is no step for the person fails beside one that is yes
37: an older node engine without --to-do finishes the profile step, and points to hedge doctor on the node, when the node runs an older Hedge without --to-do yes
37: steps come from the node's own profile takes the steps left from the node's own profile, not from this machine's yes
38: keep a node engine at this commit, with its packages, and apply with it keeps the installed engine and its packages when the engine sits at this machine's commit, and applies the profile with it yes
38: an engine moved to another commit gets get.sh installs again with get.sh when the engine has moved to another commit since the install step yes
38: an install that stopped before its packages finishes finishes on the next run an install that stopped before the engine's packages yes, with the round-0 skip
38: a launcher that does not run gets get.sh installs again with get.sh when the engine sits at this machine's commit but its launcher does not run yes
36: the hub reaches the node, so its link stays as it is says the hub reaches the node, and keeps its link as it is, when T3 Code on the hub reaches it (compares the hub's raw list) yes
36: an expired link is linked again links the node again when T3 Code on the hub lists its link as expired, so the hub lists it as reachable (reads the hub's raw list) yes
36: the hint names the link's state and the command that links it names the link's state and a repair that runs over plain SSH when the hub cannot link an unreachable node yes
36: run on the hub, read T3 Code here run on the hub, reads T3 Code here, and says the hub reaches the node when the hub's own update fails yes, on base

I broke each fix once in round 3, and the named test failed each time: the HTTPS reach check (the no-reach test), the https:// and --proto =https checks (the plain HTTP test), the session file write put back as coder login (the session file test), --to-do exiting 0 with other findings (the systemd test), the hedge apply line (the link-step test), the list moved out of finally (the later-failure test), the outer quoting of a printed step (the link-step test, through the fake ssh), the hub's reachable and expired branches (the two hub tests, on the raw list), and the link from this machine (the failed-apply rerun, the link-step and the older-engine tests). Earlier rounds broke the engine and hub fixes the same way. Round 4: I broke each fix once again, and the named test failed each time: the url check of another sign-in, the CODER_URL check, the mktemp staging files (put back as session.hedge), the 200, non-empty and version checks of the CLI download, -q on the build info check, the url move, the repair-type check in --to-do, and the doctor findings of a failed apply. Round 5: I broke each fix once again, and the named test failed each time: the regular-file check (the session directory and the late directory tests), the plain HTTP step (the plain HTTP test), the CLI install beside another sign-in (the 4 sign-in cases), the variable names (the CODER_URL and CODER_SESSION_TOKEN cases), and the 200, non-empty and version checks one at a time (one CLI download case each). The check after each mv has no test of its own: only a race inside the write's one shell line reaches it, since the write's own check catches a directory first. The --to-do predicate is a refactor, and its cli.test.ts tests pass before and after. bun run typecheck passes. bun run test fails the 16 tests that fail on this devbox on the base too: 12 privacy scan (no gitleaks), 3 tracker and frontier origin, and 1 page code parser.

Overlap with the setup-fixes PR

Both PRs start from feat/cloud-only. This PR changes no file that the setup-fixes branch changes (src/adapters/t3/service.ts, packs/guards/system/earlyoom.sh, src/setup/setup.ts, src/setup/human.ts). It depends on that PR for two things on the node. Its hedge apply turns on lingering (35). Its earlyoom.sh sets NEEDRESTART_MODE=a and DEBIAN_FRONTEND=noninteractive itself, so the earlyoom command the person runs on the node does not wait on a hidden prompt (finding 25). Until that PR merges, a node still needs sudo loginctl enable-linger <user> once.

Not in this PR

  • hedge setup --devbox <host> runs the same node steps, so it now also checks the node's left steps after apply (37). It still stops at the node's profile step while steps for the person are left: its final check runs hedge doctor on the node, which fails while a To do is open, so going on there needs a change to that check too. It does not pass the engine root, so it keeps running get.sh (38). Passing it means changing src/setup/setup.ts, which the setup-fixes PR changes too. It is a one-line follow-up once that PR merges.
  • The hub already holds the team pack's review key, but the node still asks the person to paste it. Handing a pack's key from the hub to a node needs a new delivery path for pack secrets, a new concept.
  • Once the profile step is done with steps left, a rerun of devbox add does not list them again; hedge doctor on the node does. When a later step fails in the same run, the list still prints, above that error.
  • hedge doctor --to-do does not run the doctor's live drift probes of hub services, since the node's forward to the hub may not be up yet right after its first apply. hedge doctor in step 8 still runs them.
  • Step 7 of SETUP.md signs the hub itself in to Coder with coder login, run by the person and their agent. This PR does not change it.
  • A live run on a real node is owed for this head: the session file sign-in at the hub's Coder address, the manual sign-in on a node that does not reach it, then the node's hedge doctor --to-do list.

Merge risk

Warning

🟡 Merge risk: medium · two-way door

  • Who changes: a person who runs hedge devbox add on the hub, in the unreleased feat/cloud-only branch. It mints a Coder session token with the owner's permissions and writes it into the node's Coder CLI session file over SSH, on standard input. It does so only for the hub's own Coder address, over HTTPS, when the node reaches it there without a redirect. No other address gets a token, and no coder login runs. A node that does not reach that address over HTTPS gets no token, no Coder CLI, and a manual sign-in step. The Coder CLI comes only from that address over HTTPS. A node signed in to Coder another way, or with a url or session path that is not a regular file, keeps that sign-in and gets no token. Its step for the person names the environment variables to remove, and prints no command over plain HTTP. Hedge checks the token on the node with no request: this machine made it. A token that Hedge cannot write is removed, or named for removal.
  • Who changes: on the node, after every apply, devbox add reads the steps left from the node's own plan. It runs none of them. When the apply passed and the node's doctor finds nothing but those steps, it goes on to the sign-ins and the link, and lists each step with its command at the end, then tells the person to run hedge apply on the node. Any other failure stops at the profile step. A node engine without --to-do finishes the step and points to hedge doctor.
  • Who is unchanged: a node already signed in as the same Coder user, and a node at another engine commit take the same path as before. The tests through main cover each path, with the node's real hedge apply and hedge doctor.
  • Uncovered row: no live run on a real node at this head. A Coder CLI that reads its session from another place than coderv2/session would not sign in; coder config-ssh on the node then fails and devbox add stops. The token stays in that file on the node, which only its owner reads.
  • Uncovered row: a cross-region node that reaches Coder only at a plain HTTP agent address now always needs the manual sign-in.
  • Switch-off: none: live on merge, fix forward.
  • Tier: critical (e: it changes where a Coder session token goes)

Decisions

  • 👤 When do the fixes from the first run land, and does Make Hedge cloud only: the Mac and phone only coordinate #284 wait for them? Make Hedge cloud only: the Mac and phone only coordinate #284 goes to its gate as it is; a setup-fixes PR and this devbox-add PR start now on feat/cloud-only and merge before Make Hedge cloud only: the Mac and phone only coordinate #284 goes to main. (the PR owner, merge, the setup run's conductor thread)
  • 🤖 Which Coder address may carry a token? Only the hub's own Coder address, the URL this machine's Coder CLI is signed in to, over HTTPS. Never an address the workspace names: a self-reported deployment_id proves nothing, so the agent address fallback is gone. (agent, review round 3)
  • 🤖 How does the token reach the node? In no HTTP request during setup: Hedge writes the node's Coder CLI session and url files over SSH, from standard input, through new owner-only mktemp staging files. No coder login runs. (agent, review rounds 3 and 4)
  • 🤖 Does Hedge check the new token on the node? No: this machine made it, so it is valid as made, and the HTTPS check shows that the node reaches the same address. A check from the node would be its first authenticated request, which CODER_URL or a redirect could send elsewhere. The node's later coder config-ssh is the same use as after the person's own coder login. (agent, review round 4)
  • 🤖 May Hedge replace another Coder sign-in on the node? No: a node signed in at another address, with a session and no url, or through CODER_URL or CODER_SESSION_TOKEN, keeps that sign-in. Hedge makes no token and lists the sign-in for the person. It writes only when the node has no sign-in, or its url names this exact address. (agent, review round 4)
  • 🤖 Is a url or session path that is not a regular file another sign-in? Yes: Hedge leaves it alone, makes no token, and lists the sign-in. The write checks again right before its mv, and fails when a destination is not a regular file after it. (agent, review round 5)
  • 🤖 Must the write survive a coder login that runs on the node at the same moment? No: devbox add runs on a node that the same person is setting up, and nothing else on a fresh node runs coder login. Only that person could race the two mv calls, and the result is their own token beside their own login. No write order closes the window: writing session first leaves another interleaving that pairs the hub's token with another URL. (agent, review round 5)
  • 🤖 What does the step for the person say when Hedge leaves another sign-in alone? It must run as printed: Hedge still installs a missing Coder CLI from the hub's HTTPS address, and the step names CODER_URL and CODER_SESSION_TOKEN, with no values, to remove from the node's environment first. Over plain HTTP it says to sign in over HTTPS and prints no command. (agent, review round 5)
  • 🤖 Does the node need a Coder user token at all? Yes: its hub forward and credential pulls run ssh coder.<hub> through coder config-ssh, which needs a user session. The Git key does not, so it stays on the workspace agent. (agent, review round 3)
  • 🤖 Where does the Coder CLI come from? Only from the hub's Coder address over HTTPS, from an HTTP 200 answer with no redirect, and only once the downloaded CLI runs; or the person installs it. Never over HTTP. (agent, review rounds 3 and 4)
  • 🤖 May devbox add run a pack's human step on the node? No: it lists every step with its command for the person, also when sudo asks no password. (agent, review round 2)
  • 🤖 Do steps left for the person stop devbox add? No: when the apply passed and hedge doctor --to-do exits 0, with nothing but those steps, setup goes on to the link and lists them once at the end, then says to run hedge apply on the node, exit 0. Any other failure, such as a failing pack check, still stops it at the profile step. (conductor after review round 2; agent, review round 3)

🤖 Generated with Claude Code

Silthus and others added 8 commits November 19, 2026 13:20
- Sign a node in to Coder at its own agent address when it cannot reach
  this machine's Coder address, and remove the token of a failed sign-in.
- On the node, run the setup steps that need only sudo when sudo there
  asks no password, and list the steps left for the person once, at the
  end, each with its command.
- Keep the node's engine when it runs this machine's engine commit, and
  apply the profile with it instead of running get.sh again.
- Say the hub reaches the node when T3 Code on the hub lists it, read T3
  Code here when the command runs on the hub, and skip hedge peers link
  then.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Send no Coder token over plain HTTP. The node's agent address is used
  only over HTTPS. When the node answers only at an HTTP agent address,
  devbox add makes no token and prints the one sign-in the person runs.
- Take an address only when /api/v2/buildinfo answers 200 with Coder's
  JSON, without following redirects.
- When the token removal fails too, name the token and the command that
  removes it.
- After the node applies the profile, ask the node's own hedge doctor
  --to-do which steps are left, even when apply exits 0. Run the sudo
  steps, apply and ask again, and keep the profile step open while steps
  are left. hedge doctor --to-do is new and prints them as JSON.
- Keep the node's engine only when its hedge command runs and it sits at
  this machine's commit. The install step always runs get.sh until done.
- Use the status from T3's list: an expired or unreachable link gets
  hedge peers link again, or a hint that names its state.
- Printed commands set the PATH that Hedge's own SSH calls set.
- Share one environment id check and one T3 link type, and drop the new
  doc comments.
- The node in the tests runs the real hedge apply and doctor with the
  files adapter, and the tests check node state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Send a Coder token to the node's agent address only when that address
reports the same deployment_id as this machine's Coder, and over HTTPS.
Parse the agent address as a bare http or https origin, quote it in the
printed sign-in, and install the Coder CLI on the node before that hint.
Read build info with curl -q, so no curl config follows a redirect.

Run no step left for the person on the node. List each one with its
command. A node engine without --to-do finishes the profile step and
points to hedge doctor there. The unreachable-link hint names only the
command that links it.

The fake keeps the hub's T3 links, and the tests check node state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the guards pack on, devbox add stopped at the profile step until the
person ran the Git allowlist and earlyoom commands, before the Claude,
ChatGPT, T3 Connect and link steps. When the node's apply passed and
hedge doctor --to-do lists only steps for the person, the profile step
now finishes, setup goes on, and devbox add ends with the list of those
steps, each with its command, and exits 0 as hedge apply does with To do
lines. An apply that fails for any other reason still stops setup. Hedge
runs none of the steps.

The test for another engine commit now moves the node's engine after the
install step, so it fails when the profile step skips get.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign the node in to Coder only at the hub's own Coder address, over HTTPS.
Write the token into the node's Coder CLI session and url files over SSH,
so it travels in no HTTP request during setup, and install a missing Coder
CLI only from that address over HTTPS. Drop the agent address fallback, its
deployment ID check, the HTTP download and coder login.

hedge doctor --to-do now exits 1 and prints the other findings when the node
finds more than steps for the person, so hedge devbox add stops at the
profile step then. The final list tells the person to run hedge apply on
the node after the steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…om this machine

The local shell now has its own HOME and a sudo that refuses, so a step whose
outer quoting breaks runs here and fails, instead of passing on the node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hedge no longer checks the new Coder token from the node. This machine
makes the token, so it is valid as made. The node keeps any Coder
sign-in it already has another way, and its sign-in becomes a step for
the person. The token goes through new owner-only staging files. The
Coder CLI installs only from an HTTP 200 answer with no redirect, after
it runs. hedge doctor --to-do counts a step that Hedge repairs as a
finding, and a failed apply on the node names what hedge doctor there
finds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Coder url or session path that is not a regular file counts as
another sign-in, and the write fails when a destination is not a regular
file after its move. When Hedge leaves another sign-in alone, it still
installs a missing Coder CLI from the hub's HTTPS address, names
CODER_URL and CODER_SESSION_TOKEN when the node sets them, and prints no
sign-in command when the hub's Coder address is plain HTTP. hedge doctor
--to-do matches one finding to one step with one predicate. The tests
cover each CLI download check alone, give the whole fake SSH session the
node's environment, and run the printed repair through a fake ssh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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