Skip to content

fleet: codify the laptop route forms — tier 0 + 3 methods × 2 shapes + the laptop-ssh wrapper (route-form family) #13717

Done

Description

@dezren39

Proposal

Codify how this estate reaches the laptop as a matrix of eight literal forms — tier 0 (the generic tiered fleet command), 3 methods × 2 shapes, and the laptop-ssh wrapper — build the missing fleet-shape forms as endpoint-grade clients, and demote laptop-ssh from the primary surface to its codified place: the fallback / simplified tier. Design direction: Drew, 2026-11-23 14:56 + 14:59 + 15:07 CST. Companion to #13654 (the commander subcommand, which becomes tier T1 of this matrix).

Why a matrix, not a ladder

The platform execution-risk behaviour observed all day 2026-11-23 keys on the literal command shape an agent runs: the same laptop operation returned via one route comes back clean, via another trips the check. A single opaque command that papers over every route would hide which form actually works for a given operation, and would remove the raw forms an agent sometimes needs when the wrapper itself is the obstacle. So the raw commands are first-class tiers, not implementation details — and tier 0, the one generic command, still reports exactly which tier served the call.

The codified matrix — tier 0, 3 methods × 2 shapes, the wrapper

Tier Method Shape Literal command
T0 tiered fleet subcommand fleet laptop exec [--timeout S] -- cmd... — the generic tiered command: walks T1 → T2 → T3 internally and reports the tier that served
T1 commander fleet subcommand fleet commander exec [--cwd D] --timeout S -- cmd...
T2 http-direct fleet subcommand fleet http exec [--cwd D] --timeout S -- cmd... (the laptop-agent daemon HTTP API, HTTP legs only)
T3 ssh fleet subcommand fleet ssh exec --timeout S -- cmd... (binary-owned ssh client contract, below)
T4 commander raw command the documented curl recipe against https://commander.security.cab/mcp (bearer fetched by name at call time, browser UA, MCP initialize → tools/call, SSE data: lines)
T5 http-direct raw command literal curl to the daemon API (/health, /exec) through the session proxy, token read from its file at call time
T6 ssh raw command the literal ssh invocation (pinned host key, proxy CONNECT, multiplexing) written out in full in the mechanics doc
T7 wrapper simplified tier laptop-ssh 'cmd...' — final fallback, and the one-command form for an agent that doesn't carry the full matrix

Composition. Tier 0 is the first option. It attempts T1 → T2 → T3 in order, each attempt a literal invocation of that tier's own implementation, advancing only when a tier fails to serve (transport / auth / connect failure or a tier-level timeout) — never on a served result, whatever its exit code — and it names the serving tier. Tier 0 does not fall through to the wrapper: when tier 0 fails, the individual forms come into play as their own literal commands — the fleet subcommands (T1–T3) again, because an attempt under tier 0's process shape is a different literal invocation than the standalone subcommand — then the raw commands (T4–T6), then the wrapper (T7). fleet laptop tiers prints this table.

Endpoint-grade builds (the commander pattern, applied to all three methods)

Each fleet-shape form is a real client with a clean contract — auth, timeout discipline, session hygiene — not a script wrapper with flags:

  • Commander (T1): bearer resolved in-process from the secrets broker by name (desktop-commander.machine-bearer); one MCP session per invocation; timeout_ms always sent; spawned processes polled to completion and terminated — no orphaned sessions; remote exit code extracted and propagated.
  • HTTP (T2): the laptop-agent daemon already is the endpoint; the work is contract, not transport. fleet http builds its ladder from the daemon client's HTTP legs only (broker socket → Cloudflare tunnel → Tailscale CONNECT) — the SSH leg is excluded by construction, so T2 can never silently become T3. Daemon contract as codified: X-Agent-Token auth, /exec runs the command in its own process group and reaps the whole group on timeout/cancel/disconnect, exit codes propagate, local backstop exits 124.
  • SSH (T3): the endpoint-grade shape for SSH is a binary-owned client contract: the binary constructs the ssh invocation itself (pinned host key in ~/.ssh/known_hosts_laptop, StrictHostKeyChecking=yes, proxy CONNECT helper, IdentitiesOnly) instead of delegating to a shell script; a mandatory overall deadline enforced by the binary (child kill → exit 124; the record stays honest that sshd owns the remote process and cannot be cancelled protocol-side); session hygiene as verbs — fleet-owned ControlMaster path with bounded persist, and fleet ssh close to tear the master down. A native in-process SSH protocol implementation is the recorded horizon, not this build.

Selection doctrine

  • Circumstance decides which form is the right way through. There is no single blessed invocation.
  • An agent tries each form as its own literal command — never a blended invocation.
  • Form visibility: every result and log line names the exact form used, as method × shape (e.g. form T2 http/fleet, form T4 commander/raw). Tier 0 reports the serving tier; a tier that failed to serve is reported with its reason before the next is tried.
  • Raw forms must exist, stay documented, and stay exercised — they are the route around a wrapper that has itself become the obstacle.

Constraints carried from #13654 and the standing rules

  • Timeouts required by construction on every fleet-shape form: no invocation path exists without one (tier 0 sets a per-attempt timeout; commander sends timeout_ms; http sets the daemon timeout plus local backstop; ssh carries ConnectTimeout plus the binary deadline).
  • Secrets by name only; no token in argv, files, or logs beyond the estate's existing token-file pattern.
  • Deprecation is documentation-and-defaults, not removal: laptop-ssh keeps working for every existing caller (heal/init scripts, crons, lane habits). What changes: the mechanics doc (TOOLS.d/laptop.md), the fleet help text, and the shim's own header teach the matrix and the tier-0-first order, and name laptop-ssh as tier T7 — fallback / simplified tier.

Acceptance

  • Each fleet-shape form smoke-verified from the sandbox: hostname → amd; a trivial file read returns its content; a failing remote command propagates its exit code; the serving form is named in the output.
  • Each raw form's documented literal command runs as written from the sandbox and returns the same proof.
  • Tier 0 serves via T1 on a healthy estate and reports form T1 commander/fleet; pinned to a single tier (--form T2) it attempts only that tier.
  • No secret value appears in any output, log, or file written by the new code.
  • The tier table, endpoint contracts, and selection doctrine are recorded in-repo (design record + fleet registry help) and in TOOLS.d/laptop.md; laptop-ssh.sh's header names its T7 status.

Recorded horizon (Drew, 2026-11-23)

Longer-term design threads named alongside this codification, not part of this build: host selection and access without Tailscale; a direct iroh transport for non-Muse agents; a generic pooling system.

Intake correction to #13654

#13654's premise that the fleet binary's laptop-agent domain is a registry stub (exit 69) is stale: the domain landed under #10796 (epic #5412) and fleet laptop-agent health answers live from the sandbox today ({"ok":true,...}). In the Rust client the ladder's SSH leg is an absent stub, so the daemon route is effectively HTTP-only already — T2 builds its HTTP-only ladder explicitly rather than relying on that. #13654 proceeds as T1 of this matrix.

Activity

  1. developing-today commented on Nov 23, 2026

    @developing-today
    Contributor
  2. changed the title [-]fleet: codify the laptop route forms — 3 methods × 2 shapes + the laptop-ssh wrapper (route-form family)[/-] [+]fleet: codify the laptop route forms — tier 0 + 3 methods × 2 shapes + the laptop-ssh wrapper (route-form family)[/+] on Nov 23, 2026
  3. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Refinement (Drew, 2026-11-23 15:07 CST): tier 0 added; the body above is updated.

    The codified table is now T0–T7:

    • T0 — the generic tiered fleet command (fleet laptop exec): the first option before any fallback. It walks the three subcommand tiers (T1 commander → T2 http → T3 ssh) internally, advancing only when a tier fails to serve, and reports the tier that served — no invisible papering-over.
    • T1–T3 — the fleet subcommands (fleet commander / fleet http / fleet ssh), each literally invocable on its own. After T0 fails they are tried again as standalone commands: an attempt under T0's process shape is a different literal invocation than the subcommand itself, and gate behaviour keys on the literal shape.
    • T4–T6 — the raw commands (raw curl → commander endpoint, raw curl → daemon API, raw ssh).
    • T7 — laptop-ssh: fallback + simplified tier. Tier 0 deliberately does not fall through to it; reaching T7 is the agent's own final step.

    Timeouts required by construction and per-form visibility carry over unchanged. The recorded-horizon threads Drew named with this refinement (host selection / access without Tailscale, direct iroh transport for non-Muse agents, a generic pooling system) are noted at the end of the body; they are not part of this build.

  4. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Longer-term design layer filed on top of this family: #13752 + its design record (PR #13757, merged) — host selection and access without Tailscale, iroh for non-Muse agents, and a generic pool primitive. Thread 1 generalizes this issue's form matrix from the laptop to any host (per-host transport offers in the #2179 registry); thread 3 names this issue's walker as the pool primitive's first consumer. Nothing here changes F1–F7 or the walker spec as written.

  5. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Built and merged — PR #13773 (#13773), merge commit c1a99d5e. The matrix as codified in the body (T0–T7) is what shipped.

    What landed (features laptop/commander/http/ssh, all in full):

    • fleet laptop — T0: walks T1 → T2 → T3, advances only on a serve failure, reports the serving tier; tiers prints the matrix. No fall-through to T7.
    • fleet commander — T1 (also closes the build half of fleet: add a commander subcommand wrapping the Desktop Commander endpoint for laptop execution #13654): MCP client; bearer by name from the secrets broker at call time; timeout_ms always sent; poll-to-completion / force-terminate; exit code from the endpoint's completion line.
    • fleet http — T2: daemon HTTP API over the new HTTP-only ladder (legs::http_ladder); guard refusal is a served result.
    • fleet ssh — T3: binary-owned ssh contract (pinned host key, proxy CONNECT, fleet-owned ControlMaster, close verb), binary deadline → 124.
    • DOC-01 in the same PR: registry domains + capabilities, README inventory, docs/verbs.md, book chapter reference/laptop-route-forms.md, design record doc/2026-11-23T21-18-54Z_design_laptop_route_forms/. Outside the repo: TOOLS.d/laptop.md gained the codified section with the literal T4/T5/T6 recipes, and laptop-ssh.sh's header now names its T7 status (comment-only; bash -n + a live call verified after).

    Tests: cargo test -p fleet-registry -p fleet-laptop-agent -p fleet --features full green (161 tests, incl. the DOC-01 inventory test — which caught the README listing mid-build, as designed). The branch merged current main on the way in (union-resolved against the fleet cert additions from #9157; suite re-run green after).

    Sandbox smoke, built binary, 2026-11-23 (each: hostname → amd, cat /etc/hostname → amd, remote exit 3 → exit 3, form named):

    • T0: served by T1 and reported served by form T1 commander/fleet; exit 3 propagated without advancing; --form T2 pin served by T2.
    • T1: health → {"ok":true,"form":"T1 commander/fleet","host":"amd",...}.
    • T2: health/jobs/exec all live through the HTTP ladder.
    • T3: health/exec/close live — with the relay proxy env (below).
    • T4: the documented raw-curl recipe ran as written → amd, "Process completed with exit code 0".
    • T5: raw curl /health + /exec through the relay → exit 0 / amd, and exit 3 in the reply for the failing case.
    • T6: both laptop-ssh-real.sh and the literal ssh invocation from the doc → amd.
    • T7: laptop-ssh hostname → amd (and it carried this lane's own laptop work all day).

    One environment finding, recorded in TOOLS.d/laptop.md: the sandbox shell's default HTTPS_PROXY (3128 egress proxy) closes CONNECTs to the laptop — T3 and the estate's own T6 script fail identically there ("proxy closed during CONNECT"). The working value is the relay the channel stack runs (the HTTPS_PROXY in ~/tools/init-ensure.sh, 127.0.0.1:3130). T3/T6 were verified with that env.

    Remaining: seat-wide availability rides the next fleet-static publish — nothing was installed over the seat binary. Until it lands, the seat's fleet answers the new domains as unknown; the raw forms and laptop-agent.py are the working shapes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions