From 70e194257fefd886f5c695a2584a855924db7693 Mon Sep 17 00:00:00 2001 From: Sebastian Gieseler Date: Tue, 27 Oct 2026 17:56:48 +0100 Subject: [PATCH 1/2] fix(lanes): `up --workers` runs the workers of a lane on a node too (#314) The flag never left this machine: the lane's daemon on the node ran without `lane_workers`, so `{is_main}` stayed false and jobs stayed queued with nothing saying so. - `--workers` goes with the start: `Lanes::workers`, `RemoteSpec::workers`, the node's `Start.workers`, `DEVSTACK_LANE_WORKERS=1` in the lane container; the daemon there sets it (or its profile's `workers`). - It stays with the lane on a move (both ways) and across a restart (`CarriedLane.workers`, local lanes too). - `LaneView.workers`; `lane list` names lanes that run their workers. - A node before 0.25.1 does not take it: the start warns. - `up --workers` on a lane that runs already says it applies at its next start, on a node as here. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 10 ++++ crates/devstack-daemon/src/api.rs | 8 ++- crates/devstack-daemon/src/lanes.rs | 52 ++++++++++++++++++- crates/devstack-daemon/src/lib.rs | 8 +++ crates/devstack-daemon/src/remote.rs | 27 +++++++++- .../src/supervisor/handover.rs | 5 ++ crates/devstack-node/src/lanerun.rs | 6 +++ crates/devstack-node/src/node.rs | 11 +++- crates/devstack-node/src/nodeclient.rs | 2 + crates/devstack/src/client.rs | 6 ++- crates/devstack/src/poolcmd.rs | 1 + crates/devstack/tests/remote_lane.rs | 10 +++- docs/dashboard-api.md | 2 +- docs/pool.md | 4 +- ui/src/api/types.ts | 2 + 15 files changed, 144 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fc0bd66..42e9fad5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,16 @@ and listed with their assets on the ### Fixed +- **`devstack up --workers` runs the workers of a lane on a node too** + (#314): the flag never reached the node, so a worker gated by + `{is_main}` stayed off there and its jobs stayed queued, with nothing + saying so. It goes with the lane's start to the node's agent and its + daemon (a profile's `workers` too), stays with the lane when it moves or + the stack restarts, and `devstack lane list` says which lanes run their + workers. A node before this release does not take it: `up` warns. + `up --workers` on a lane that runs already says it applies at its next + start, on a node as here. + - **A lane's memory check looks at Docker Desktop's VM** (#309): on Windows and macOS the check compared the whole need with the host's free memory, while the containers run in Docker Desktop's VM with a limit of its own; diff --git a/crates/devstack-daemon/src/api.rs b/crates/devstack-daemon/src/api.rs index 86bab276..2d43921e 100644 --- a/crates/devstack-daemon/src/api.rs +++ b/crates/devstack-daemon/src/api.rs @@ -521,7 +521,13 @@ async fn lanes_start(State(s): State, Json(body): Json) -> if let Some(on) = body.on.as_deref().filter(|o| !o.trim().is_empty()) { // What a local lane would need here is what it needs there. let need = lane_estimate(&main, &usage); - return match lanes.activate_remote(&body.path, on.trim(), need, profile)? { + return match lanes.activate_remote( + &body.path, + on.trim(), + need, + profile, + body.workers, + )? { crate::lanes::RemoteStart::Running(name) => { view(&name).map(|v| (StatusCode::CREATED, v)) } diff --git a/crates/devstack-daemon/src/lanes.rs b/crates/devstack-daemon/src/lanes.rs index 45a412be..0f4dbd1b 100644 --- a/crates/devstack-daemon/src/lanes.rs +++ b/crates/devstack-daemon/src/lanes.rs @@ -80,6 +80,10 @@ pub struct LaneView { /// `*` for every member; empty: nobody. #[serde(skip_serializing_if = "Vec::is_empty")] pub shared_with: Vec, + /// Its background workers run (`--workers` or its profile, #314), while + /// it runs. + #[serde(skip_serializing_if = "std::ops::Not::not")] + pub workers: bool, /// The profile it runs with (ADR-0041), while it runs. #[serde(skip_serializing_if = "Option::is_none")] pub profile: Option, @@ -355,6 +359,9 @@ pub struct Lanes { shares: Mutex>>, /// The profile each started lane runs with (ADR-0041), while it runs. profiles: Mutex>, + /// The lanes on nodes that run their background workers (`--workers`, + /// #314): a lane here keeps it in its supervisor. + workers: Mutex>, /// One main-slot hand-over at a time, and what it took from the main tree. handover: Mutex, /// One [`Lanes::sync`] at a time: asking git and applying the answer go @@ -397,6 +404,9 @@ struct CarriedLane { name: String, #[serde(default, skip_serializing_if = "Option::is_none")] profile: Option, + /// Its background workers run (#314). + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + workers: bool, /// On a node: its lease and ports; absent: it ran on this machine. #[serde(default, skip_serializing_if = "Option::is_none")] node: Option, @@ -847,6 +857,7 @@ impl Lanes { forgetting: Mutex::new(BTreeSet::new()), shares: Mutex::new(shares), profiles: Mutex::new(BTreeMap::new()), + workers: Mutex::new(BTreeSet::new()), handover: Mutex::new(Handover::default()), syncing: Mutex::new(()), missing: Mutex::new(BTreeMap::new()), @@ -1231,6 +1242,7 @@ impl Lanes { forward: false, step: &|_, _| {}, profile: None, + workers: false, warm: true, files: Some(&checkout.1), }; @@ -1503,6 +1515,7 @@ impl Lanes { self.unlink_node(name); self.missing.lock().unwrap().remove(name); self.profiles.lock().unwrap().remove(name); + self.workers.lock().unwrap().remove(name); // Logged there; a lane that is forgotten has nobody to tell. let _ = self.remove_infra(name); // Its kept data on the nodes it ran on goes too (ADR-0038 point 4); @@ -1979,6 +1992,13 @@ impl Lanes { pool: on_node.map(|r| r.pool.clone()), shared_with: self.share_of(&k.entry.name), profile: self.profiles.lock().unwrap().get(&k.entry.name).cloned(), + workers: lane.map_or_else( + || { + on_node.is_some() + && self.workers.lock().unwrap().contains(&k.entry.name) + }, + |l| l.sup.lane_workers(), + ), node_error: node_state.as_ref().and_then(|st| st.error()), not_forwarded: node_state .as_ref() @@ -2129,6 +2149,7 @@ impl Lanes { let t0 = std::time::Instant::now(); // A profile holds while the lane runs (ADR-0041). self.profiles.lock().unwrap().remove(name); + self.workers.lock().unwrap().remove(name); // Stopped: a start or move that failed before is no longer news. self.forget_failed(Some(name)); let remote = self.remote.lock().unwrap().remove(name); @@ -2587,14 +2608,16 @@ impl Lanes { /// the main ports. A start or move under way is not carried. fn carry_now(&self) -> Carry { let profiles = self.profiles.lock().unwrap().clone(); + let workers = self.workers.lock().unwrap().clone(); let mut lanes: Vec = self .map .lock() .unwrap() - .keys() - .map(|n| CarriedLane { + .iter() + .map(|(n, l)| CarriedLane { name: n.clone(), profile: profiles.get(n).cloned(), + workers: l.sup.lane_workers(), node: None, }) .collect(); @@ -2607,6 +2630,7 @@ impl Lanes { .map(|(n, r)| CarriedLane { name: n.clone(), profile: profiles.get(n).cloned(), + workers: workers.contains(n), node: Some(r.carried()), }), ); @@ -2796,6 +2820,9 @@ impl Lanes { .unwrap() .insert(l.name.clone(), p.clone()); } + if l.workers { + self.workers.lock().unwrap().insert(l.name.clone()); + } let lease = c.lease.clone(); let adopted = crate::remote::RemoteLane::adopt( &self.rt, @@ -2819,6 +2846,7 @@ impl Lanes { } Err(e) => { self.profiles.lock().unwrap().remove(&l.name); + self.workers.lock().unwrap().remove(&l.name); // Said here: not again as a lane nobody followed. crate::remote::forget_followed(&self.state_dir(&l.name), &lease); self.not_carried(&l.name, "remote", &node, &e); @@ -2860,6 +2888,7 @@ impl Lanes { // `up`, and the lane runs the rest. match self.activate(&path, l.profile.as_deref()) { Ok(lane) => { + lane.sup.set_lane_workers(l.workers); let failed = lane.sup.up().err(); crate::diag::info( "lane_carried", @@ -2995,6 +3024,7 @@ impl Lanes { on: &str, need: crate::remote::Expected, profile: Option<&str>, + workers: bool, ) -> Result { let path = std::path::absolute(path).map_err(|e| e.to_string())?; if same_tree(&path, &self.main.repo) { @@ -3056,6 +3086,11 @@ impl Lanes { .insert(name.clone(), p.to_string()), None => self.profiles.lock().unwrap().remove(&name), }; + if workers { + self.workers.lock().unwrap().insert(name.clone()); + } else { + self.workers.lock().unwrap().remove(&name); + } self.begin_move(&name, "start", on, 3); let leased = { let step = self.step_fn(&name); @@ -3227,6 +3262,7 @@ impl Lanes { let synced = self.synced(); let scratch = self.state_dir(&entry.name).join("remote"); let profile = self.profiles.lock().unwrap().get(&entry.name).cloned(); + let workers = self.workers.lock().unwrap().contains(&entry.name); // What the lane's own stack file declares it needs at least, with // its profile (ADR-0049 point 5); the main tree's where it does not // load. @@ -3259,6 +3295,7 @@ impl Lanes { forward, step, profile: profile.as_deref(), + workers, warm: false, files: None, }) @@ -3320,6 +3357,15 @@ impl Lanes { if here && local.is_some() { return Ok(()); } + // Its workers go with it to a node (#314). + if let Some(l) = &local { + let mut w = self.workers.lock().unwrap(); + if l.sup.lane_workers() { + w.insert(name.to_string()); + } else { + w.remove(name); + } + } if let Some(r) = &remote && !here && r.is_at(to) @@ -3411,9 +3457,11 @@ impl Lanes { self.pending.lock().unwrap().remove(name); step(2, "starting it here (build, infrastructure, services)"); let profile = self.profiles.lock().unwrap().get(name).cloned(); + let workers = self.workers.lock().unwrap().contains(name); let started = self .activate(&entry.path, profile.as_deref()) .and_then(|lane| { + lane.sup.set_lane_workers(workers); lane.sup.up().inspect_err(|_| { lane.sup.down(true); let removed = self.map.lock().unwrap().remove(name); diff --git a/crates/devstack-daemon/src/lib.rs b/crates/devstack-daemon/src/lib.rs index a7360bcd..9b8315d6 100644 --- a/crates/devstack-daemon/src/lib.rs +++ b/crates/devstack-daemon/src/lib.rs @@ -292,6 +292,14 @@ pub fn serve(stack_file: &Path) -> Result<(), String> { rt.handle().clone(), )?; sup.refresh_infra(); + // A lane on a node runs its background workers as its requester asked + // (`--workers`, `DEVSTACK_LANE_WORKERS`), or as its profile says, as a + // lane here does (#314). + if remote_lane() { + let asked = std::env::var_os("DEVSTACK_LANE_WORKERS").is_some_and(|v| v == "1"); + let profile = sup.stack.profile.as_ref().and_then(|p| p.workers); + sup.set_lane_workers(profile.unwrap_or(asked)); + } let usage = usage::Sampler::start(sup.clone()); // Kept for the daemon's lifetime; changes become candidates (ADR-0003). let _watcher = watch::start(sup.clone()); diff --git a/crates/devstack-daemon/src/remote.rs b/crates/devstack-daemon/src/remote.rs index 37d7cb29..9257275c 100644 --- a/crates/devstack-daemon/src/remote.rs +++ b/crates/devstack-daemon/src/remote.rs @@ -410,6 +410,8 @@ pub struct RemoteSpec<'a> { pub step: &'a (dyn Fn(u8, &str) + Send + Sync), /// The profile it runs with (ADR-0041). pub profile: Option<&'a str>, + /// Its background workers run (`devstack up --workers`, #314). + pub workers: bool, /// A warm lease (ADR-0065 point 5): only `prepare`, no infrastructure. pub warm: bool, /// The files of `worktree` to sync, when git cannot tell them: a ref's @@ -603,7 +605,20 @@ impl RemoteLane { // refused it already): refused here, before anything is admitted. // Another release, or one that does not say, is a warning // (ADR-0031 point 8). - let warning = release_warning(&offer).map_err(|e| format!("lane `{}`: {e}", spec.name))?; + let mut warning = + release_warning(&offer).map_err(|e| format!("lane `{}`: {e}", spec.name))?; + // An agent before 0.25.1 does not pass `--workers` on (#314). + if spec.workers && !takes_workers(offer.node.devstack.as_ref()) { + let w = format!( + "the node {} runs {}, which starts the lane without its background workers whatever `--workers` says; `devstack up --workers --on local` runs them here", + offer.node.name, + version::describe(offer.node.devstack.as_ref()) + ); + warning = Some(match warning { + Some(o) => format!("{o}; {w}"), + None => w, + }); + } // What the lease holds, and from what (ADR-0049 point 10). if let Some(n) = &offer.need { let from = offer.need_from.as_deref().unwrap_or(""); @@ -752,6 +767,7 @@ impl RemoteLane { 0, None, false, + false, Duration::from_secs(1800), &|_| {}, &|_, _| {}, @@ -808,6 +824,7 @@ impl RemoteLane { forward, step, profile, + workers, .. } = spec; let Leased { @@ -897,6 +914,7 @@ impl RemoteLane { // This machine relays UDP (ADR-0056); an older node // does not read it, and its lane names none. true, + workers, Duration::from_secs(1800), &|p| { step(3, &format!("on {node}: {p}")); @@ -1957,6 +1975,13 @@ fn release_warning( Ok((!notes.is_empty()).then(|| notes.join("; "))) } +/// A node's agent passes `--workers` on to its lane (#314): 0.25.1 and +/// later. One that does not say counts as older. +fn takes_workers(node: Option<&devstack_node::version::Release>) -> bool { + node.and_then(|r| devstack_config::version_triple(&r.version)) + .is_some_and(|v| v >= (0, 25, 1)) +} + /// The warning of a lane a daemon before this one followed (ADR-0052), made /// against this machine's release: the daemon that leased it compared with /// its own (`this machine devstack 0.19.0` after an update to 0.20.0). The diff --git a/crates/devstack-daemon/src/supervisor/handover.rs b/crates/devstack-daemon/src/supervisor/handover.rs index 6a61c464..7a185125 100644 --- a/crates/devstack-daemon/src/supervisor/handover.rs +++ b/crates/devstack-daemon/src/supervisor/handover.rs @@ -59,6 +59,11 @@ impl Supervisor { self.lane_workers.store(on, Ordering::SeqCst); } + /// What [`Self::set_lane_workers`] said last. + pub fn lane_workers(&self) -> bool { + self.lane_workers.load(Ordering::SeqCst) + } + /// Main lane: the lane serving its fixed ports, if one does (`None` in a /// lane: its own ports are its own). pub fn served_by(&self) -> Option { diff --git a/crates/devstack-node/src/lanerun.rs b/crates/devstack-node/src/lanerun.rs index d65dcefa..85d64d54 100644 --- a/crates/devstack-node/src/lanerun.rs +++ b/crates/devstack-node/src/lanerun.rs @@ -71,6 +71,8 @@ pub struct LaneRun { /// Its requester relays UDP ports (ADR-0056): the lane's daemon is told, /// and the start answers with them. pub relay_udp: bool, + /// Its background workers run (`DEVSTACK_LANE_WORKERS`, #314). + pub workers: bool, /// The memory limit of each of its containers (ADR-0033), bytes. pub memory_limit: Option, /// Their CPU limit, cores. @@ -964,6 +966,9 @@ impl LaneRun { if self.warm { args.extend(["-e", "DEVSTACK_WARM=1"]); } + if self.workers { + args.extend(["-e", "DEVSTACK_LANE_WORKERS=1"]); + } if let Some(n) = networks.first() { args.extend(["--network", n.as_str()]); } @@ -1360,6 +1365,7 @@ mod tests { port_offset: 100, profile: None, relay_udp: false, + workers: false, memory_limit: None, cpu_limit: None, network: Network::Lan, diff --git a/crates/devstack-node/src/node.rs b/crates/devstack-node/src/node.rs index c982d9ca..2629de34 100644 --- a/crates/devstack-node/src/node.rs +++ b/crates/devstack-node/src/node.rs @@ -1116,6 +1116,7 @@ impl Inner { port_offset: 0, profile: None, relay_udp: false, + workers: false, memory_limit: None, cpu_limit: None, network: crate::policy::Network::Lan, @@ -2118,6 +2119,10 @@ pub struct Start { /// does not send it, an older agent does not read it. #[serde(default, skip_serializing_if = "std::ops::Not::not")] pub relay_udp: bool, + /// Its background workers run (`devstack up --workers`, #314); its + /// profile may say so too. An older agent does not read it. + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub workers: bool, } fn default_stack_file() -> String { @@ -2178,8 +2183,8 @@ async fn start( format!("{} cannot run lanes: its agent is no Linux build", s.name), )); }; - let (stack_file, display_root, port_offset, profile, relay_udp) = body.map_or_else( - || (default_stack_file(), None, 0, None, false), + let (stack_file, display_root, port_offset, profile, relay_udp, workers) = body.map_or_else( + || (default_stack_file(), None, 0, None, false, false), |Json(b)| { ( b.stack_file, @@ -2187,6 +2192,7 @@ async fn start( b.port_offset, b.profile, b.relay_udp, + b.workers, ) }, ); @@ -2271,6 +2277,7 @@ async fn start( run.port_offset = port_offset; run.profile = profile; run.relay_udp = relay_udp; + run.workers = workers; let policies = s2.policies(); let all: Vec<&crate::policy::NodePolicy> = policies.iter().collect(); if let Some(p) = crate::policy::NodePolicy::strictest(&all) { diff --git a/crates/devstack-node/src/nodeclient.rs b/crates/devstack-node/src/nodeclient.rs index e3713ec5..11e79ab7 100644 --- a/crates/devstack-node/src/nodeclient.rs +++ b/crates/devstack-node/src/nodeclient.rs @@ -186,6 +186,7 @@ impl NodeClient { port_offset: u16, profile: Option<&str>, relay_udp: bool, + workers: bool, within: std::time::Duration, phase: &(dyn Fn(&str) + Send + Sync), over: &(dyn Fn(&str, u64) + Send + Sync), @@ -200,6 +201,7 @@ impl NodeClient { port_offset, profile: profile.map(str::to_string), relay_udp, + workers, }), ) .await?; diff --git a/crates/devstack/src/client.rs b/crates/devstack/src/client.rs index 12853149..5eadd076 100644 --- a/crates/devstack/src/client.rs +++ b/crates/devstack/src/client.rs @@ -1045,7 +1045,8 @@ pub fn up( ); } } - if c.lane().is_some_and(|l| l != "-") && on.is_none() && (workers || force) { + // Started already, here or on a node: nothing restarts it (#314). + if c.lane().is_some_and(|l| l != "-") && (workers || force) { eprintln!( "note: this worktree's lane is started already; --workers and --force apply when it starts (`devstack down` here first)" ); @@ -1473,6 +1474,9 @@ pub fn lane_list(stack_file: &Path) -> Result<()> { if let Some(p) = l["profile"].as_str() { troubles.push(format!("{name}: runs with the profile `{p}`")); } + if l["workers"] == true && l["owns_main"] != true { + troubles.push(format!("{name}: runs its background workers")); + } if let Some(e) = l["node_error"].as_str() { troubles.push(format!("{name}: {e}")); } diff --git a/crates/devstack/src/poolcmd.rs b/crates/devstack/src/poolcmd.rs index db76ab0b..0cf5a5df 100644 --- a/crates/devstack/src/poolcmd.rs +++ b/crates/devstack/src/poolcmd.rs @@ -757,6 +757,7 @@ pub fn run_lane(file: &Path, on: &str, lane: &str, keep: bool) -> Result<()> { 0, None, false, + false, Duration::from_secs(1800), &|p| println!(" {p}"), &|p, ms| println!(" ({p}: {:.1} s)", ms as f64 / 1000.0), diff --git a/crates/devstack/tests/remote_lane.rs b/crates/devstack/tests/remote_lane.rs index a5bb008e..24e3dd74 100644 --- a/crates/devstack/tests/remote_lane.rs +++ b/crates/devstack/tests/remote_lane.rs @@ -523,6 +523,9 @@ fn a_lane_runs_on_a_node_of_the_pool() { let port = 5080 + offset; let body = http_get(port, "/health"); assert!(body.contains("ok"), "GET /health on {port}: {body}"); + // A lane runs without its workers unless asked (ADR-0030 point 6). + let info = http_get(port, "/info"); + assert!(info.contains("\"workers\":false"), "{info}"); // The lane's containers, which its daemon cannot reach (no Docker in the // lane container): their output and what they use come from the node @@ -681,8 +684,13 @@ fn a_lane_runs_on_a_node_of_the_pool() { // Its data thrown away, the lane starts afresh on the node: its build's // `prepare` comes from the member's store there (ADR-0062). + // With `--workers` its workers run there too (#314). cli(&main, &["lane", "reset", "wt"]); - cli(&wt, &["up", "--on", "ci-node"]); + cli(&wt, &["up", "--workers", "--on", "ci-node"]); + let info = http_get(port, "/info"); + assert!(info.contains("\"workers\":true"), "{info}"); + let list = cli(&main, &["lane", "list"]); + assert!(list.contains("wt: runs its background workers"), "{list}"); let (st, body) = api_request( &main, state.path(), diff --git a/docs/dashboard-api.md b/docs/dashboard-api.md index efafcdb5..fe5db167 100644 --- a/docs/dashboard-api.md +++ b/docs/dashboard-api.md @@ -362,7 +362,7 @@ type StoreView = { | `POST /v1/infra/check` | probe every ready container's published ports from this machine: `[{group, service, ports}]` that accept and close at once on three probes a second apart (Docker lost the port forward, or nothing listens inside); recorded as `ContainerView.unreachable`. The daemon also judges each container once it has been ready for 20 s, and probes a port found lost again every few seconds until it answers; a restart from devstack clears the verdict. A service with `after = ["compose.."]` restarts such a container before it starts, if it has been ready for 20 s and was not restarted for this in the last 10 minutes | | `GET /v1/infra/{group}/{service}/logs?tail=200&grep=&since=` | text, a container's output (`docker compose logs`), stdout and stderr merged by Docker's timestamps, each line starting with one; `since` as Docker takes it (`30m`); `502` when Docker fails. `/v1/services/{name}/logs` answers the same for a name that is no service but exactly one Compose service | | `GET /v1/infra/{group}/{service}/logs/stream?tail=500` | SSE (`tail` at most 5000): `{"type":"line","text":"..."}` per line of `docker compose logs --follow` (timestamped), the same events as a service's log stream; in a lane its own container, the main tree's for a `shared` one | -| `GET /v1/lanes` | JSON, the lanes: the repository's other worktrees ([ADR-0024](adr/0024-a-lane-is-a-supervisor-in-the-main-trees-daemon.md)), `[{name, path, branch, number, port_offset, active, owns_main, running, services, containers_running, containers, node?, pool?, shared_with?, profile?, node_error?, node_warning?, not_forwarded?}]`; `active`: started; `containers_running`/`containers`: its Compose containers devstack starts that run, and all (a stack of containers only shows by them that it runs); `node`: the node of the pool it runs on (absent: this machine), `pool`: that node's pool, `shared_with`: whom it is shared with (member ids, tags, `*`; absent: nobody), `profile`: the profile it runs with, `node_error`: what goes wrong with it now (a sync, a renewal, a port that cannot be forwarded here), each until it works again, several joined by `; `, `node_warning`: the node or the coordinator runs another devstack than this machine, or does not say which (from the lease on, so while it starts too; [ADR-0031](adr/0031-a-coordinator-places-lanes.md) point 8); `not_forwarded`: its containers' published ports that run on the node but are not forwarded here (`5353/udp`): UDP ports a node older than 0.20.0 does not relay ([ADR-0056](adr/0056-a-lane-on-a-node-relays-its-udp-ports-through-a-tunnel-per-session.md)), ports of another protocol than TCP and UDP (#192; a lane daemon of an older devstack does not say), `not_forwarded_reason`: why; `moving`: `{kind: start|move, to, step, steps, what, since, phases, phase_since, error?, failed_at?}` (`phases`: `[{phase, ms}]` over so far, `phase_since`: when the current one began) while a start on a node or a move runs, and for ten minutes after one failed; `removing`: `true` while the lane of a worktree that is gone is stopped and its data removed (it leaves the list after); `main_stack_file`: `true` while its worktree has no stack file at the main one's path, so it runs with the main working tree's, here and on a node ([ADR-0055](adr/0055-a-lane-without-a-stack-file-says-so-and-can-be-given-one.md)) | +| `GET /v1/lanes` | JSON, the lanes: the repository's other worktrees ([ADR-0024](adr/0024-a-lane-is-a-supervisor-in-the-main-trees-daemon.md)), `[{name, path, branch, number, port_offset, active, owns_main, running, services, containers_running, containers, node?, pool?, shared_with?, profile?, workers?, node_error?, node_warning?, not_forwarded?}]`; `active`: started; `containers_running`/`containers`: its Compose containers devstack starts that run, and all (a stack of containers only shows by them that it runs); `node`: the node of the pool it runs on (absent: this machine), `pool`: that node's pool, `shared_with`: whom it is shared with (member ids, tags, `*`; absent: nobody), `profile`: the profile it runs with, `workers`: `true` while its background workers run (`--workers` or its profile, here or on a node, #314), `node_error`: what goes wrong with it now (a sync, a renewal, a port that cannot be forwarded here), each until it works again, several joined by `; `, `node_warning`: the node or the coordinator runs another devstack than this machine, or does not say which (from the lease on, so while it starts too; [ADR-0031](adr/0031-a-coordinator-places-lanes.md) point 8); `not_forwarded`: its containers' published ports that run on the node but are not forwarded here (`5353/udp`): UDP ports a node older than 0.20.0 does not relay ([ADR-0056](adr/0056-a-lane-on-a-node-relays-its-udp-ports-through-a-tunnel-per-session.md)), ports of another protocol than TCP and UDP (#192; a lane daemon of an older devstack does not say), `not_forwarded_reason`: why; `moving`: `{kind: start|move, to, step, steps, what, since, phases, phase_since, error?, failed_at?}` (`phases`: `[{phase, ms}]` over so far, `phase_since`: when the current one began) while a start on a node or a move runs, and for ten minutes after one failed; `removing`: `true` while the lane of a worktree that is gone is stopped and its data removed (it leaves the list after); `main_stack_file`: `true` while its worktree has no stack file at the main one's path, so it runs with the main working tree's, here and on a node ([ADR-0055](adr/0055-a-lane-without-a-stack-file-says-so-and-can-be-given-one.md)) | | `POST /v1/lanes` | `{"path", "infra"?, "workers"?, "force"?, "on"?, "profile"?}`: start the lane of that worktree, with `profile` with that profile of its stack file ([ADR-0041](adr/0041-a-profile-says-how-a-lane-runs-for-a-purpose.md); `409` when the worktree's stack file has no such profile or it does not apply); with `on` (a node's name or member id, or `pool` for the coordinator to choose; in another pool than the default one `:`, or `` for its coordinator to choose, [ADR-0034](adr/0034-a-machine-can-belong-to-several-pools.md)) on that node of the pool instead, leased, synced and started there, its API passed through under `/v1/lanes/{lane}/v1/...` ([ADR-0025](adr/0025-a-lane-can-run-on-another-node.md)) (what `devstack up` in it does; `infra` starts the main tree's `shared` Compose services if needed, the lane's own containers start with its `up`; `workers` runs its background workers; `force` skips the memory check, which otherwise answers `409` with what the lane needs and what is free, ADR-0030; with Docker Desktop its containers are checked against its VM's free memory and its services against the host's, #309), then `/v1/lanes/{lane}/v1/up` starts its services and its containers. `201` with its entry. With `on`: `202` with its entry once the lane is leased and admitted by the node; its sync and its start there (minutes on a first start: images pulled and built, containers created) go on in the background, shown as the entry's `moving` (`kind: "start"`, in `lanes` events and here). It runs there once `moving` is gone and `active` is `true`, which is once the lane's daemon answers there: its containers come up after, under it (#164; a node of an earlier release answers once they are healthy), and show as `created`, then `starting` and `healthy` in its `InfraView`s (then call `/v1/up`, which starts its services once their infrastructure is up); it failed when `moving` carries `error` (for ten minutes, until the lane stops, the main tree's `/v1/down` or a start of it here). What can be told at once is refused at once: no such worktree, a lane that runs elsewhere, no lease (`409` with the reason: no node, the coordinator or the node refuses, a node with another pool protocol). The same start asked again while it goes on answers `202` too; `201` when the lane runs on that node already. Up to 0.10.1 a start on a node answered `201` only when done. Worktrees are git's: there is no route that creates or removes one | | `POST /v1/lanes/{lane}/share` | `{"with"}`: share a lane on a node with others in its pool: member ids, tags, `*` for every member; `[]` for nobody ([ADR-0035](adr/0035-lanes-can-be-shared-with-the-pool.md)). They open its services and view it, read only ([ADR-0040](adr/0040-a-shared-lane-can-be-watched-like-ones-own.md)); `view`, a separate list up to 0.11.1, is ignored. Kept per lane, told the coordinator while it runs on a node. Answers with the lanes (`LaneView.shared_with`) | | `POST /v1/lanes/{lane}/reset` | a stopped lane's data goes, here and on the nodes it ran on (ADR-0038): `[Pruned]` (`{place, lane, bytes, why, removed, error}`; `removed: false` with `error` where it did not go, this machine's containers too); `409` while it runs | diff --git a/docs/pool.md b/docs/pool.md index fa31323e..3b5fd7b6 100644 --- a/docs/pool.md +++ b/docs/pool.md @@ -369,7 +369,9 @@ stopped lane's data away, here and on the nodes it ran on; `devstack lane prune [--older-than 7d]` removes what this repository's gone lanes left (both ask the node with `DELETE /v1/slots`). A move to another node is a cold start there: data never moves between nodes. It runs without background workers unless it holds the -main ports. When its lease ends (an admin ends it, the node goes away for +main ports, or was started with `devstack up --workers` (or a +profile with `workers = true`), as a lane here; a node before 0.25.1 does +not take `--workers`, and `up` warns. When its lease ends (an admin ends it, the node goes away for longer than a lease lives), the main working tree takes the main ports back by itself. diff --git a/ui/src/api/types.ts b/ui/src/api/types.ts index f250f9dc..1102be01 100644 --- a/ui/src/api/types.ts +++ b/ui/src/api/types.ts @@ -158,6 +158,8 @@ export type LaneView = { shared_with?: string[]; /** The profile it runs with (ADR-0041), while it runs. */ profile?: string; + /** Its background workers run (`--workers` or its profile), while it runs. Older daemons omit it. */ + workers?: boolean; /** What went wrong with it on its node lately (a sync, a renewal). */ node_error?: string; /** Its node or the pool's coordinator runs another devstack than this machine, or does not say which. */ From d5cf9a0dbba58a60eee4e717e17b897d241736eb Mon Sep 17 00:00:00 2001 From: Sebastian Gieseler Date: Tue, 27 Oct 2026 18:06:39 +0100 Subject: [PATCH 2/2] test: the node's lanerun test names workers Co-Authored-By: Claude Opus 5.5 --- crates/devstack-node/tests/lanerun.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/devstack-node/tests/lanerun.rs b/crates/devstack-node/tests/lanerun.rs index dc3fa7f3..cec3c41c 100644 --- a/crates/devstack-node/tests/lanerun.rs +++ b/crates/devstack-node/tests/lanerun.rs @@ -80,6 +80,7 @@ volumes: port_offset: 0, profile: None, relay_udp: false, + workers: false, memory_limit: Some(256 << 20), cpu_limit: None, network: Network::Lan,