Skip to content

feat: a restart of the stack carries its lanes over to the next daemon (ADR-0052) - #211

Merged
7schmiede merged 4 commits into
mainfrom
feat/restart-carries-lanes
Oct 22, 2026
Merged

7schmiede merged 4 commits into
mainfrom
feat/restart-carries-lanes

Conversation

@7schmiede

Copy link
Copy Markdown
Member

Seen in the pool's telemetry (2026-10-22): a member's dashboard said " runs devstack 0.15.0, devstack 0.18.0 is installed"; "Restart stack" was pressed three times in 30 s, and each time the 0.15.0 daemon answered, because a lane ran on a node (18 h by then) and a restart with lanes running only restarted the main tree's services in the old daemon. The banner went only after the lane was stopped and the stack stopped and started.

ADR-0052 (new, Accepted at the owner's request in this session): a restart is a stop that leaves word for the next daemon.

  • POST /v1/shutdown?restart=true (hub: POST /hub/stacks/{id}/down?restart=true, the dashboard's "Restart stack"): the daemon notes what runs, stops as before, but keeps the leases of its lanes on nodes renewed until it is done, then writes .devstack/restart.json (lanes here with their profile, lanes on nodes with lease and ports, who serves the main ports).
  • The next daemon (file younger than two minutes, for this stack, read once): renews each lease and follows the lane again (sync, renewal, ports here; works with every node release, the node notices nothing), starts the lanes here again from the builds they ran (ADR-0016 point 4), and gives the main slot back to its lane once the main tree's up is done. A lane that cannot be taken up is said, with the lane (its moving error) and in the log.
  • A crash, down, down --all: unchanged (ADR-0016, ADR-0024 point 6, ADR-0025 point 7 for those; both points marked amended).
  • daemon.json / the hub's stack entry say carries_lanes; the dashboard's restart confirmation and the version banner say which lanes keep running on their node and which restart here, or that an older daemon stops them (then the confirmation is marked dangerous).
  • Telemetry: lane_carried, lane_not_carried, main_slot_carried / main_slot_not_carried, remote_lane_left, daemon_stopping with restart and the lanes by place, and from the hub daemon_outdated once per stack and daemon release (how long stacks stay on an old release).

Tests: daemon_lifecycle::a_worktree_runs_as_a_lane restarts with a local lane running and checks it comes back in a new daemon from its build (passed locally on Windows); remote_lane restarts with a lane on the node that holds the main slot and checks the lease is renewed, the node's containers ran on, the lane's port and the main port answer again. UI logic in ui/src/lib/lanes.ts with tests.

🤖 Generated with Claude Code

…n (ADR-0052)

"Restart stack" with a lane running restarted only the main tree's services
in the old daemon, so the banner "runs devstack X, Y is installed" stayed
until every lane was stopped (seen in the pool's telemetry: three restarts
in 30 s, each answered by the old daemon).

A daemon told `POST /v1/shutdown?restart=true` (the hub's
`down?restart=true`, the dashboard's restart) now notes what runs, keeps
the leases of its lanes on nodes renewed until it is done, and writes
`.devstack/restart.json`. The next daemon (within two minutes) renews those
leases and follows the lanes again (sync, renewal, ports here), starts the
lanes here again from the builds they ran, and gives the main slot back to
its lane once the main tree's `up` is done. A crash or a plain stop is
unchanged. `daemon.json` says `carries_lanes`; the dashboard's confirmation
and banner say what happens to which lane, or that an older daemon stops
them. Telemetry: lane_carried, lane_not_carried, main_slot_carried,
daemon_stopping with the lanes by place, daemon_outdated from the hub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede force-pushed the feat/restart-carries-lanes branch from 4088abd to b1df026 Compare October 22, 2026 09:51
7schmiede and others added 3 commits October 22, 2026 12:01
…anes

The lane's processes of the old daemon may hold its ports a moment after
it exited (Windows CI: 365 ms later), and a start that finds them taken
moves the lane to another range: the next daemon now waits up to 30 s for
the lane's own ports. The lifecycle tests' free_port() no longer takes a
port above 64000, which left no room for a lane (`port_step` 100).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lifecycle tests took a stack's fixed ports from `bind(0)`, inside the
range the OS hands out for instance ports too: after a restart, which
starts the main tree and the carried lane at once, an instance got the
lane's fixed web port first (Linux CI, "forward on port ...: in use").
Real stacks' fixed ports lie below; the tests now take theirs from
20000-29999.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`devstack up` in the main tree waited until every autostart service was
healthy; one that a lane serving the main ports took over stays stopped,
so the wait never ended. After a restart the carried lane gets the main
slot back right after the main tree's `up`, and the CLI could miss the
healthy state in between (the remote-lane test hung twice). A stopped
service counts as settled while a lane serves the main ports.

CI: the remote-lane job ends after 30 minutes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede merged commit a7e135b into main Oct 22, 2026
@7schmiede
7schmiede deleted the feat/restart-carries-lanes branch October 23, 2026 20:53
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