Skip to main content
The exact rules for dev runs and dependencies, for looking things up. What a single command does is in the CLI reference, and timers and box sizes are in Configuration. The Services and Connect a frontend to a backend pages explain the ideas.

Dev runs

When tesser dev restarts the server

tesser dev reuses the box for this worktree and service. On a box whose server is already running, it only syncs, and prints when the server started and that its inputs are unchanged. It starts the server again when:
  • the server is not running, or its app crashed under a file watcher
  • the manifest or the env changed
  • a file setup or dev depends on changed:
    • the env files the manifest lists
    • any package.json, lockfile, or toolchain pin such as .nvmrc
    • a Dockerfile or compose file
    • any file the setup command names
    • any shell script the dev command names (a .sh, .bash or .zsh file, or one with no extension)
    • every file in the manifest’s directory except .md files and the other services’ manifests
A file a command names counts only when it is not gitignored, so a build output such as node_modules/.bin/... never forces a restart. A source file the dev command names, such as src/server.ts in bun --hot src/server.ts, does not count either, because the server reloads it.

While tesser dev waits

  • It prints the last line of the server’s log every 30 seconds. When the health check keeps returning the same 5xx status, the line says for how long. Each of these lines counts from when the dev run started, not from when this wait started.
  • Each of those lines, and the timeout error, also shows how much CPU the dev run’s processes use, measured every 5 seconds until the server serves. At 10% of a core or more, the line gives the number of cores and the program and script of the busiest process. Below 10%, it says the processes are idle and the run is waiting on something outside them, such as the network, the disk, a docker container, a database, a lock, or a prompt. Work in a docker container does not count toward the run’s CPU. When dev has printed the same log line 3 or more times in a row and nothing listens on the first port, the line says how many times instead of showing CPU, because the run keeps retrying the same step. Raise [health] timeout when the busiest process is work that finishes, such as a build, a migration, or an install, and not the dev server.
  • The box records when the run’s log last grew. The clock starts when the run starts and resets when the box wakes from sleep. When the log has printed nothing for 3 minutes, the run’s processes use less than 10% of a core, and nothing listens on the first port, the line says the log is quiet instead of showing CPU. What the run waits on, most often a download, is then stuck or crawling. This applies in setup and dev, but not while dev waits for a dependency to serve, and a repeated log line still takes precedence. If the wait times out this way, waiting longer will most likely not help. Restart the run instead (for example with tesser sync <box> --restart), which usually gets a stalled download through.

A service name instead of a box id

tesser status, tesser logs, tesser sync, and tesser wait take a service name for this worktree’s box of that service.
  • When the worktree has no box for it, status, logs, and wait use the service’s shared instance, and status and logs say so on stderr.
  • When the service has no shared instance yet, wait uses its staged instance if exactly one is awake, launching, or waking, and says so on stderr. When none or more than one is, or the box is awake with no dev run and no sync from this laptop in flight, wait fails and names the make --ensure-running that finishes it. A run started from another machine that is still syncing looks the same, so wait can fail while that run is still going.
  • sync never falls back to the shared instance. It fails and suggests tesser dev <service>.
  • For a script, tesser status <service> --json | jq -r .boxId prints the box id.

Dependencies and shared instances

A dependency with nothing behind it

  • dev, make <service>, and make --ensure-running still start the box, and print one line per such port on stderr:
  • When this worktree has a manifest for api, the line first names tesser dev api in this worktree, which backs the dependency even when it starts after this box (see Your own box from the same worktree).
  • When a make api --ensure-running has started a new shared instance but not switched over yet, that instance is staged, and the line names it:
    The dependency reaches the new instance as soon as that command finishes, with no wire. If the command is no longer running, running it again with the same commit finishes the switch.
  • When the port is wired to a box that is gone or has no address yet, the line names that box instead:
  • dev prints these lines when it returns: after the service is serving, or just before the error when the run fails, so they come at the end of its output. With --detach, it prints them when the box starts. tesser wait, and tesser sync --restart without --detach, print them when they return. Each check reads the box’s current wiring, so a port wired in the meantime is not reported.
  • On the box, every connection to that port is reset. While the service runs, the box notes the reset in the dev log (tesser logs), at most once a minute per port. On the laptop, the request gets a 503 naming the tesser wire command that fixes it.

Your own box from the same worktree

  • A dependency with no wire and no shared instance reaches your own dev box of that service from the same worktree, if one exists. The worktree is the folder that tesser dev ran in.
  • Only boxes you started with tesser dev from your own login count. A teammate’s box, a box from another worktree, and a box started with a service-account or CI token never do.
  • Your other boxes from the same worktree use this fallback too: a box made with tesser make, and the worktree’s workbench while tesser exec --deps-of <service> gives it that service’s dependency ports. They reach your dev box but never back a dependency themselves, so an idle box from tesser make api never takes the route from the box that tesser dev api started.
  • With several such boxes, the newest one wins. Removing it moves the dependency to the next one, or to nothing.
  • A wire or a shared instance always takes precedence over this fallback. tesser wire <box_id> api --shared with no shared instance running says the dependency routes to the same-worktree box instead.
  • When a shared instance takes precedence over your own box of that service from this worktree, dev says so and prints the wire that routes the dependency to your box:
    If the box that depends on it started first, dev api prints the same advice when it returns:
    Both lines appear only when both boxes are yours.
  • dev prints the fallback on stderr when it returns:
  • tesser wire <box_id> lists such a dependency as api -> <box_id> (same worktree).
  • If another box from the worktree was already running when this one began backing its dependency, dev prints:
  • Handing a box to another member clears its worktree, so it stops backing your other boxes.

Waking dependencies

  • dev starts only the requested services. It wakes the dependencies you own and the shared instances it depends on, and once its own server is ready it waits for them to serve, printing which ones it is waiting on.
  • If a dependency is removed, its server exits, its app crashed under a file watcher, another process holds its port, it is still asleep after 15 seconds, or it does not come up in time, dev reports that it is not serving and finishes anyway. tesser status <box_id> shows where that box is.
  • dev never creates missing dependencies. make --ensure-running creates shared instances.

A held dev

In tesser dev api web, web’s dev is held until api is healthy. The CLI reference describes the command. These rules are the box’s:
  • web’s box holds the wait, not the command. If tesser dev stops or is killed, web’s dev still starts on its own once api is healthy and listening on its first port.
  • A held run that sleeps and wakes is held again until then.
  • If api’s box is removed, the wait ends and web’s dev starts.
  • tesser wait <box_id> on a held box names the box and port it waits on.

make --ensure-running

  • It creates a box, checks out the commit, runs setup and dev, waits for the health check, and makes the box the org’s shared instance.
  • With the same commit again, it does nothing and prints the same box id, unless the shared instance is unhealthy, in which case it runs setup and dev again on the same box. With a new commit, it starts a new box, waits until it is healthy, switches over, and removes the old box.
  • After a switch, every other instance of the service, current or staged, shows as draining in tesser service ls. Tesser removes each draining box and its disk shortly after (see Timers), so files the app wrote only on that box, such as uploads or a SQLite file, are lost. You do not need to tesser rm it. Running make --ensure-running with that box’s commit before it is removed switches back to it.
  • The current shared instance goes to sleep when idle like any instance box, but Tesser does not remove it for being asleep, however long it sleeps (see Timers). Once a switch moves the org to another box, it drains and is removed like any other superseded instance.
  • From a worktree that already has its own box of the service, when no shared instance runs that commit yet, that box becomes the shared instance and keeps its warm build. This applies only when the box is the size the manifest sets, is not kept, and has no --sleep-after of its own; otherwise a new box is created. The CLI resets the box to the commit, deletes files git neither tracks nor ignores (installs and build output stay), runs setup and dev again with the org’s env values, waits for the health check, and switches over. The box then belongs to the org, and the worktree’s next tesser dev of the service starts a new box.
  • --restart runs setup and dev again on the same box even while the health check passes, for a server that is stuck but still answers it. On a staged or draining instance it fails and changes nothing, and on the current one it does not switch the org over again.
  • A shared instance belongs to the org, so it cannot be synced to. Its env comes from tesser env set and the committed files in the manifest’s env.load.

During a switch

  • Both boxes run dev: the new one from when make starts it, the old one, if awake, until Tesser removes it after the switch.
  • Both see TESSER_SLOT=pinned, so a queue keyed on TESSER_SLOT has workers on both commits, and the old commit can take jobs meant for the new one. Removal kills any job still running on the old box. Make jobs safe to retry and to run on either commit.
  • If a job’s producer and workers run on the same box, key the queue on TESSER_BOX_ID instead. Jobs still in the old box’s queue when it is removed never run.

tesser service show

Prints one service’s repo and, for each shared instance, the full commit sha, the box id, and a tesser ssh command that prints the manifest it runs. That reads the file on the box, which can differ from the copy committed at that sha. --json prints the same as JSON.

tesser wire

  • It refuses a target that is not a box in your org, has been removed, or runs a different service than the dependency names.
  • After saving, it waits until this laptop’s daemon routes the change. If the daemon has not loaded the wire after 70 seconds, the command fails, but the wire stays saved. tesser daemon stop then tesser use restarts the daemon.
  • A wire changes where new connections go but restarts nothing. If the box’s server ran while the dependency had nothing behind it, its client may have given up, and requests can hang even after the wire. Then wire prints:
  • A wire names a box. When that box is removed, Tesser clears every wire that pointed at it, so the dependency falls back to the shared instance, or else to your own box of that service from the same worktree. New connections route there right away. If neither exists, nothing backs the dependency until you wire it again. tesser rm names each of your boxes that lost a wire, from any worktree, and where its dependency goes now, in the same terms as tesser wire <box_id>. It does not name teammates’ boxes, though their wires are cleared too. If a server’s client gave up while the dependency was down, tesser sync <box_id> --restart reconnects it.
  • A wire connects boxes, whichever worktree or repository they came from.
  • The panel marks a branch custom wiring when a laptop port reaches a different box than the box’s own dependency on that port, and names any route that is failing. Laptop focus can override subtrees without changing wires.
  • tesser dev reuses the box for a worktree and service, so each simultaneous frontend-plus-backend test needs its own frontend worktree. In a monorepo, run the frontend from the backend change’s worktree.
  • When both a dashboard and its backend depend on a third service, wire both to the copy meant for the test. Focusing the dashboard brings every reachable service to localhost, but does not fix inconsistent wiring on the boxes.

tesser exec --deps-of

The workbench gets that service’s dependency ports for as long as the command runs. They resolve exactly as for that service’s box in this worktree, wires included. --in <service> on its own only changes the working directory to the service’s root.