diff --git a/.claude/skills/devstack-config/SKILL.md b/.claude/skills/devstack-config/SKILL.md index cf5a9fea..f06d3c07 100644 --- a/.claude/skills/devstack-config/SKILL.md +++ b/.claude/skills/devstack-config/SKILL.md @@ -63,6 +63,9 @@ without a stack file starts from `devstack init` (a draft with TODOs). a `package.json` and no `prepare`). When git hooks need it (`npx eslint` in a pre-commit hook), `prepare.link = ["web/node_modules"]` links it into the worktree; `.gitignore` then needs `node_modules` without a trailing slash. + The linked directory is the lane's copy: reinstalling or deleting it in + the worktree empties what the lane runs from (say so in project notes + that tell agents to run `npm ci`). Name what it makes as `outputs = ["web/node_modules"]` (and `version = "node --version"`): the next lane with the same lockfile copies it from the machine's store instead of running `npm ci` again. `link` must be diff --git a/.claude/skills/devstack/SKILL.md b/.claude/skills/devstack/SKILL.md index 0960d0a2..7ede9df7 100644 --- a/.claude/skills/devstack/SKILL.md +++ b/.claude/skills/devstack/SKILL.md @@ -57,6 +57,7 @@ Run from the repository root (devstack looks for `devstack.toml` there; `-f` oth | `devstack hot-reload on\|off` | for a debugging session: the toolchain's watcher (e.g. `dotnet watch`) from the source tree instead of builds and candidates; needs `hot_reload` in the stack file. Switch it off again afterwards | | `devstack up` in a `git worktree` | starts that worktree's **lane** (every worktree is one) in the main tree's daemon: its own builds, ports moved by +100 (+200, ...), its own containers (a Compose project per lane, ports moved alike; `shared` services come from the main tree), no background workers (`--workers` turns them on; `--force` skips the memory check). Every command in the worktree then acts on the lane (`devstack lane list` shows all) | | `git worktree add -b ` | a new worktree is a lane at once, not started (devstack never creates or removes worktrees; use git or your tool); tell the user its dashboard page (`devstack ui --link` in it). A lane runs from a copy of its worktree, so `git worktree remove` works while it runs and stops it. `devstack lane stop ` stops a lane and keeps the worktree | +| a directory in a worktree that `prepare` links (`node_modules`, see `devstack lane list`: `linked`) | it is **the lane's copy**, not the worktree's own: on Windows a junction, which looks like a folder. Do not reinstall, delete or clean it there (`npm ci`, `rm -rf`, `git clean -x`, an IDE's "delete node_modules"): that empties what the lane runs from (for a lane on a node, its copy from the store), and a running dev server then fails. To install your own, ask the user, then stop the lane (`devstack lane stop ` removes the link) or remove only the link (`cmd /c rmdir ` on Windows, without `/s`; `rm ` elsewhere, no trailing slash), then install | | `devstack lane start [--on ]` | start a lane from the main tree (or anywhere in the repository), as `devstack up` in its worktree does; `status` in the main tree lists the lanes in one line. **To run another branch or commit beside the main stack** (an end-to-end run against a given commit, a review): `git worktree add `, `devstack lane start ` (its ports are the main ports plus its offset, `devstack lane list`), test against those, `devstack lane stop `, `git worktree remove `. A commit without a stack file of its own runs with the main tree's. **For an acceptance run** use the stack file's profile if it has one (`status` lists none; `[profiles]` in the file): `devstack lane start --profile

--run` starts the lane as the profile says (a build instead of a dev server, workers, fresh data, the suite's env) and runs its suite command. A worktree another tool or script created is a lane too: starting it gives its own ports, containers and database without building a separate environment | | `devstack lane reset ` / `devstack lane prune [--older-than 7d] [--dry-run]` | throw a stopped lane's data away (it starts fresh, seeded again); remove what lanes whose worktree is gone left behind, here and on the pool's nodes. A lane on a node keeps its data there between starts. Ask the user before either: data goes | | `devstack promote --lane ` | the lane's services, dev servers included, answer on the main ports; ask the user first, `--lane main` gives them back. A lane on a node may take them only on a dedicated node (a server) | @@ -180,7 +181,8 @@ Register it once (project `.mcp.json` or user configuration): | dashboard: "runs devstack X, Y is installed" | the stack still runs the old daemon: "Restart stack" there, or `devstack down` + `devstack up` | | a job `failed` after a long wait | jobs end after 30 minutes unless the stack file sets `timeout`; read its log, then ask the user before raising it (skill `devstack-config`) | | `devstack down` names services that did not stop | they still run: `devstack status`, then `devstack stop `; ask before ending a process yourself | -| `devstack up --on`: the node refuses the lane | the message names what the lane's Compose files ask that a node does not allow (privileged, host mounts, devices, build `tags`, a service key the node does not know, ...) or that the pool has not granted that node; the lane can still run here (`devstack up`) | +| `devstack up --on`: the node refuses the lane | the message names what the lane's Compose files ask that a node does not allow (privileged, host mounts, devices, build `tags`, a service key the node does not know, ...) or that the pool has not granted that node; the lane can still run on this machine with `devstack up --on local` (a plain `devstack up` goes to the machine's default, which may be the pool again) | +| `devstack up`: "no node of the pool can take the lane now" | the pool is this machine's default (`devstack pool default-on`) and is full: `devstack pool placement ` says what is free where; try again later, or run it here with `devstack up --on local`. The user chose the pool as the default: ask before running it here | | `devstack up --on` (or the MCP `up` with `on`) was interrupted or timed out while the lane started on the node | the start goes on there: `devstack lane list` shows its step; the same `devstack up --on ` again follows it to the end. A first start can take minutes (images pulled and built). It ends when the lane's daemon answers; its containers come up after, and its services start once those are healthy. A container that does not get healthy shows in `devstack status` with its group's error; `devstack logs ` has its output | ## 7. Problems in devstack itself diff --git a/CHANGELOG.md b/CHANGELOG.md index d856baf5..424acd2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,29 @@ and listed with their assets on the ## [Unreleased] +### Fixed + +- **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; + a lane that did not fit there started and the engine hung. The + containers' part is now checked against what is free in the VM, the + services' part against the host, and the refusal names the limit. +- **A refused start on the pool says how to go on** (#310): the error now + names `devstack pool placement`, another node and `devstack up --on + local`, and when the pool is the machine's default, that running here is + the user's call. `--on ` runs the lane here + instead of being refused as a node not granted lanes. The skill's rows + say the same. +- **The skills warn about a linked `node_modules`** (#311): a directory + `prepare.link` puts in a worktree is the lane's copy; reinstalling or + deleting it there empties what the lane runs from. The `devstack` and + `devstack-config` skills say so and how to get one's own. +- **The upgrade prompt checks the version and asks before a restart** + (#312): it starts with `devstack --version`, and before restarting the + stack it has the agent look for lanes and other sessions and ask; the + restart keeps the containers (`down --keep-infra`). + ## [0.25.0] - 2026-10-27 A stop takes the stack's containers too, as stopping a lane already did; diff --git a/crates/devstack-compose/src/lib.rs b/crates/devstack-compose/src/lib.rs index 7ee6d4c9..4cc4aedc 100644 --- a/crates/devstack-compose/src/lib.rs +++ b/crates/devstack-compose/src/lib.rs @@ -1330,7 +1330,45 @@ pub struct VolumeSize { pub size: u64, } +/// The memory of the machine the engine runs containers on, when that is a +/// VM of its own (Docker Desktop on Windows and macOS, #309): its total, and +/// what every running container uses in it now. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct EngineMemory { + pub total: u64, + pub used: u64, +} + impl Docker { + /// [`EngineMemory`] of Docker Desktop's VM; `None` for an engine that + /// runs on the host itself (its containers take the host's memory) or + /// one that does not answer. Takes about two seconds (`docker stats`). + pub fn engine_memory(&self) -> Option { + let a: Vec = vec![ + "info".into(), + "--format".into(), + "{{.MemTotal}}|{{.OperatingSystem}}".into(), + ]; + let out = self.run(Path::new("."), &a, budget::QUICK).ok()?; + let (total, os) = parse_engine_info(&String::from_utf8_lossy(&out.stdout))?; + if !os.contains("Docker Desktop") { + return None; + } + let a: Vec = vec![ + "stats".into(), + "--no-stream".into(), + "--format".into(), + "json".into(), + ]; + let out = self.run(Path::new("."), &a, budget::QUICK).ok()?; + let used = parse_stats(&String::from_utf8_lossy(&out.stdout)) + .ok()? + .iter() + .map(|c| c.memory) + .sum(); + Some(EngineMemory { total, used }) + } + /// One `docker stats --no-stream` sample of the named containers. Takes /// about two seconds: Docker measures over an interval. pub fn stats(&self, names: &[String]) -> Result> { @@ -1471,6 +1509,13 @@ pub fn parse_volumes(json: &str) -> std::result::Result, String> .collect()) } +/// `docker info --format "{{.MemTotal}}|{{.OperatingSystem}}"`: the bytes +/// and the engine's OS name. +pub fn parse_engine_info(text: &str) -> Option<(u64, String)> { + let (total, os) = text.trim().split_once('|')?; + Some((total.trim().parse().ok()?, os.trim().to_string())) +} + /// Docker's human sizes: `12B`, `37.56kB`, `1.2MB` (SI), `35.27MiB`, `31.35GiB` (binary). pub fn parse_size(s: &str) -> Option { let s = s.trim(); @@ -1558,6 +1603,15 @@ mod tests { #[test] fn stats_and_sizes() { + assert_eq!( + parse_engine_info("33610137600|Docker Desktop\n"), + Some((33_610_137_600, "Docker Desktop".into())) + ); + assert_eq!( + parse_engine_info("16000000000|Ubuntu 24.04.1 LTS"), + Some((16_000_000_000, "Ubuntu 24.04.1 LTS".into())) + ); + assert_eq!(parse_engine_info(""), None); let text = r#"{"BlockIO":"1.63GB / 0B","CPUPerc":"12.50%","Container":"cb21","ID":"cb21","MemPerc":"0.11%","MemUsage":"35.27MiB / 31.35GiB","Name":"probe-db-1","NetIO":"1MB / 1MB","PIDs":"11"}"#; let s = parse_stats(text).unwrap(); assert_eq!(s[0].name, "probe-db-1"); diff --git a/crates/devstack-daemon/src/api.rs b/crates/devstack-daemon/src/api.rs index 7234c733..86bab276 100644 --- a/crates/devstack-daemon/src/api.rs +++ b/crates/devstack-daemon/src/api.rs @@ -551,12 +551,18 @@ async fn lanes_start(State(s): State, Json(body): Json) -> } } -/// What a lane takes: about what the main tree takes now, containers -/// included (ADR-0030). -fn lane_need(main: &crate::supervisor::Supervisor, usage: &crate::usage::Sampler) -> u64 { +/// What a lane takes: about what the main tree takes now (ADR-0030), as +/// its services' part and its containers' part: they may live in different +/// memory (#309). +fn lane_need_parts( + main: &crate::supervisor::Supervisor, + usage: &crate::usage::Sampler, +) -> (u64, u64) { let r = usage.report(main, false); - r.services.iter().map(|e| e.load.memory).sum::() - + r.containers.iter().map(|e| e.load.memory).sum::() + ( + r.services.iter().map(|e| e.load.memory).sum::(), + r.containers.iter().map(|e| e.load.memory).sum::(), + ) } /// What a lane on a node is expected to need, as this machine estimates it @@ -633,20 +639,66 @@ fn disk_fits( fn memory_fits( main: &crate::supervisor::Supervisor, usage: &crate::usage::Sampler, +) -> Result<(), String> { + let (services, containers) = lane_need_parts(main, usage); + let free = devstack_proc::memory_available(); + // Docker Desktop runs the containers in a VM with a limit of its own; + // the host's free memory does not say whether they fit (#309). + let vm = if containers > 0 { + main.docker().engine_memory() + } else { + None + }; + memory_verdict(services, containers, free, vm) +} + +/// [`memory_fits`] on numbers: with `vm` the containers are checked against +/// what is free in it and only the services against the host. +fn memory_verdict( + services: u64, + containers: u64, + free: Option, + vm: Option, ) -> Result<(), String> { const MARGIN: u64 = 1 << 30; - let need = lane_need(main, usage); - let Some(free) = devstack_proc::memory_available() else { + let gb = |b: u64| b as f64 / (1u64 << 30) as f64; + let ways = "stop another lane or close something, start it on another machine of the pool \ + (`devstack up --on `, see `devstack pool`), or start it anyway with `devstack up --force`"; + if let Some(vm) = vm { + let vm_free = vm.total.saturating_sub(vm.used); + if containers > 0 && vm_free < containers + MARGIN { + return Err(format!( + "a lane's containers need about {:.1} GB (what the main tree's take now), and Docker Desktop's VM, \ + where they run, has {:.1} GB with {:.1} GB used by the containers that run: {:.1} GB are free there, \ + whatever the host has (raise its limit in Docker Desktop, or in `.wslconfig` for WSL 2). {ways}", + gb(containers), + gb(vm.total), + gb(vm.used), + gb(vm_free) + )); + } + let Some(free) = free else { + return Ok(()); + }; + if services == 0 || free >= services + MARGIN { + return Ok(()); + } + return Err(format!( + "a lane's services need about {:.1} GB (what the main tree's take now; its containers fit in Docker Desktop's VM), \ + {:.1} GB are free on this machine: {ways}", + gb(services), + gb(free) + )); + } + let need = services + containers; + let Some(free) = free else { return Ok(()); // not measurable here: no reason to refuse }; if need == 0 || free >= need + MARGIN { return Ok(()); } - let gb = |b: u64| b as f64 / (1u64 << 30) as f64; Err(format!( - "a lane needs about {:.1} GB (what the main tree takes now, containers included), {:.1} GB are free: \ - stop another lane or close something, start it on another machine of the pool \ - (`devstack up --on `, see `devstack pool`), or start it anyway with `devstack up --force`", + "a lane needs about {:.1} GB (what the main tree takes now, containers included), {:.1} GB are free: {ways}", gb(need), gb(free) )) @@ -1890,6 +1942,34 @@ mod tests { use super::*; use axum::body::Body; + const GB: u64 = 1 << 30; + + #[test] + fn containers_in_docker_desktops_vm_are_checked_against_the_vm() { + // The case of #309: the host has plenty, the VM does not. + let vm = devstack_compose::EngineMemory { + total: 31 * GB, + used: 20 * GB, + }; + let e = memory_verdict(GB, 19 * GB, Some(36 * GB), Some(vm)).unwrap_err(); + assert!( + e.contains("Docker Desktop's VM") && e.contains("--force"), + "{e}" + ); + // Room in the VM: only the services count against the host. + let vm = devstack_compose::EngineMemory { + total: 31 * GB, + used: 5 * GB, + }; + assert!(memory_verdict(GB, 19 * GB, Some(3 * GB), Some(vm)).is_ok()); + let e = memory_verdict(4 * GB, 19 * GB, Some(3 * GB), Some(vm)).unwrap_err(); + assert!(e.contains("services"), "{e}"); + // An engine on the host: everything against the host, as before. + assert!(memory_verdict(GB, 19 * GB, Some(36 * GB), None).is_ok()); + assert!(memory_verdict(GB, 19 * GB, Some(10 * GB), None).is_err()); + assert!(memory_verdict(GB, 19 * GB, None, None).is_ok()); + } + fn refused(body: Body, len: Option) -> Response { let mut b = Response::builder() .status(StatusCode::CONFLICT) diff --git a/crates/devstack-daemon/src/remote.rs b/crates/devstack-daemon/src/remote.rs index 6f9f3e7c..37d7cb29 100644 --- a/crates/devstack-daemon/src/remote.rs +++ b/crates/devstack-daemon/src/remote.rs @@ -216,7 +216,7 @@ pub fn local_member(pool: &str) -> Local { /// its pool is not joined. pub fn effective_on(on: Option<&str>) -> Option { match on.map(str::trim).filter(|o| !o.is_empty()) { - Some(o) if devstack_node::member::is_here(o) => None, + Some(o) if devstack_node::member::is_here(o) || is_this_machine(o) => None, Some(o) => Some(o.to_string()), None => { let d = devstack_node::member::default_on(&state_dir())?; @@ -231,6 +231,20 @@ pub fn effective_on(on: Option<&str>) -> Option { } } +/// `on` names this machine in its pool, by its member id or name: the +/// pool would refuse it as a node not granted lanes (#310); it means +/// `local`. +pub fn is_this_machine(on: &str) -> bool { + let Ok((pool, node)) = resolve_on(on) else { + return false; + }; + local_member(&pool) + .membership() + .ok() + .flatten() + .is_some_and(|m| m.id.eq_ignore_ascii_case(&node) || m.name.eq_ignore_ascii_case(&node)) +} + /// `--on` split into the pool and the node asked for (ADR-0034 point 3). pub fn resolve_on(on: &str) -> Result<(String, String), String> { devstack_node::member::resolve_on(&state_dir(), on) diff --git a/crates/devstack-hub/src/prompts.rs b/crates/devstack-hub/src/prompts.rs index 1e22e1ff..e359ce39 100644 --- a/crates/devstack-hub/src/prompts.rs +++ b/crates/devstack-hub/src/prompts.rs @@ -120,13 +120,14 @@ pub fn text(p: &Prompt) -> String { {about} -1. Read what changed since then: {changes}. Note what concerns this repository: keys that changed or went away, new defaults, new features. -2. Hold {file} against the stack file reference of {current}: {at}/docs/stack-file.md -3. Run `devstack check` (and `devstack check --compose`) and `devstack doctor`, and fix every error and warning. -4. Tell me which new features would help this stack, and add only those I agree to. Raise `[stack] requires` only when the file uses something an older devstack does not know: it shuts out everyone still on one. -5. Set `reviewed = \"{current}\"` in `[stack]`: the stack file is up to date with devstack {current} then, and the dashboard stops offering this.{requires} -6. Run `devstack skills install` to refresh the generated skills. Check the project's own skills, CLAUDE.md and AGENTS.md for anything that contradicts devstack {current}. -7. Restart the stack (`devstack down`, then `devstack up`) and check that every service becomes healthy. {careful}", +1. `devstack --version` must say {current}: `check`, `skills install` and `reviewed` below are only right with that devstack. If it says another, run `devstack update` first and tell me. +2. Read what changed since then: {changes}. Note what concerns this repository: keys that changed or went away, new defaults, new features. +3. Hold {file} against the stack file reference of {current}: {at}/docs/stack-file.md +4. Run `devstack check` (and `devstack check --compose`) and `devstack doctor`, and fix every error and warning. +5. Tell me which new features would help this stack, and add only those I agree to. Raise `[stack] requires` only when the file uses something an older devstack does not know: it shuts out everyone still on one. +6. Set `reviewed = \"{current}\"` in `[stack]`: the stack file is up to date with devstack {current} then, and the dashboard stops offering this.{requires} +7. Run `devstack skills install` to refresh the generated skills. Check the project's own skills, CLAUDE.md and AGENTS.md for anything that contradicts devstack {current}. +8. Restart the stack so it runs devstack {current}, and check that every service becomes healthy. Before you stop it, look at `devstack status` and `devstack lane list`: when lanes run, a lane holds the main ports, or other sessions may use this stack, ask me first. Restart with `devstack down --keep-infra`, then `devstack up`: the containers keep running (a plain `down` removes them since 0.25.0). {careful}", repo = display(repo), file = display(file), ) @@ -297,6 +298,8 @@ mod tests { assert!(p[3].contains("last brought up to date with devstack 0.1.0")); assert!(p[3].contains("the sections after 0.1.0, up to 0.2.0")); assert!(p[3].contains("Set `reviewed = \"0.2.0\"`")); + assert!(p[3].contains("`devstack --version` must say 0.2.0")); + assert!(p[3].contains("`devstack lane list`") && p[3].contains("down --keep-infra")); assert!(!p[3].contains("raise `requires`"), "the file has the key"); assert!(p[4].contains("an earlier devstack")); assert!(p[5].contains("its generated agent skills name")); diff --git a/crates/devstack/src/client.rs b/crates/devstack/src/client.rs index 36ccd02e..12853149 100644 --- a/crates/devstack/src/client.rs +++ b/crates/devstack/src/client.rs @@ -999,6 +999,12 @@ pub fn up( explicit.map(str::to_string) }; let on = resolved.as_deref(); + if let Some(o) = explicit + && on.is_none() + && worktree().is_some() + { + println!("`{o}` is this machine: the lane runs here, as with `--on local`"); + } if on.is_some() && worktree().is_none() { bail!( "--on runs a worktree's lane on another machine: run it in a `git worktree` of the repository" @@ -1051,11 +1057,20 @@ pub fn up( println!("leasing, syncing and starting the lane on {node}..."); } // A start on a node answers once leased; its steps follow. - let name = c.join_lane(wt, workers, force, on, profile, None, |m| { - if m["step"] != 0 { - println!("{}", step_line(m)); - } - })?; + let name = c + .join_lane(wt, workers, force, on, profile, None, |m| { + if m["step"] != 0 { + println!("{}", step_line(m)); + } + }) + .map_err(|e| match on { + Some(node) => anyhow!( + "{e:#} +{}", + refused_ways(node, explicit.is_none()) + ), + None => e, + })?; // `pool`: the coordinator chose; say which node, and whether it // runs another devstack (known once the start is followed). let view = on.and_then(|_| { @@ -2272,6 +2287,28 @@ fn end_unanswering_daemon(state_dir: &Path, why: anyhow::Error, all: bool) -> Re Ok(()) } +/// What to do when a lane's start on `node` failed (#310): the error alone +/// gives no way on, and `up` again asks the same. `default`: `node` is +/// this machine's default (`devstack pool default-on`), not `--on`. +fn refused_ways(node: &str, default: bool) -> String { + format!( + "{}the ways on: try again once something is free; `devstack pool placement ` says what is free where; \ + `devstack up --on ` picks another; `devstack up --on local` runs it on this machine (its memory check applies){}", + if default { + format!( + "the lane did not start on `{node}`, where this machine starts lanes by default (`devstack pool default-on`).\n" + ) + } else { + format!("the lane did not start on `{node}`.\n") + }, + if default { + ": the user chose the pool as the default, so ask them before running it here" + } else { + "" + } + ) +} + /// The lanes a `200` from the main tree's `/v1/down` names: they still run. pub fn running_lanes(status: u16, body: &str) -> Vec { if status != 200 { @@ -2474,6 +2511,22 @@ pub fn print_placement(stack_file: &Path, lane: &str) -> Result<()> { mod tests { use super::*; + #[test] + fn a_refused_start_on_the_pool_names_the_ways_on() { + let by_default = refused_ways("pool", true); + assert!( + by_default.contains("default-on") + && by_default.contains("--on local") + && by_default.contains("ask them"), + "{by_default}" + ); + let asked = refused_ways("node-1", false); + assert!( + asked.contains("--on local") && !asked.contains("ask them"), + "{asked}" + ); + } + #[test] fn server_sent_events_are_read_one_by_one() { let stream = b": keep-alive\n\ndata: {\"type\":\"line\",\"text\":\"a\"}\n\n\ diff --git a/docs/adr/0030-each-lane-has-its-own-infrastructure.md b/docs/adr/0030-each-lane-has-its-own-infrastructure.md index 6ed2fd1c..7da060af 100644 --- a/docs/adr/0030-each-lane-has-its-own-infrastructure.md +++ b/docs/adr/0030-each-lane-has-its-own-infrastructure.md @@ -58,6 +58,11 @@ that is half isolated. takes now (services and containers, plan ยง12) with the memory available, and refuses with that number and the ways out (stop another lane, a lane on another machine) unless `devstack up --force`. + *Amended 2026-10-27 (#309):* where the containers run in a VM of their + own (Docker Desktop on Windows and macOS), the containers' part of + that is compared with what is free in the VM (`docker info` `MemTotal` + less what every running container uses), and only the services' part + with the host's free memory; the refusal names the limit that was hit. 6. **Workers:** a lane still runs without background workers by default (they may also talk to systems outside the stack). `devstack up --workers` turns them on for that lane: its coordinators are its own now. A service with diff --git a/docs/adr/README.md b/docs/adr/README.md index cc15a183..ec387ca4 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -78,7 +78,7 @@ stay. | [0027](0027-trust-between-nodes.md) | Nodes and requesters trust each other by pinned keys, never by network location | Accepted; points 1, 2 replaced by ADR-0031; point 5 amended | | [0028](0028-lane-images.md) | A remote lane runs in a stack-provided toolchain image; the node supplies devstack | Accepted, amended (a Dockerfile the node builds); point 3 noted 2026-10-26 (`prepare`'s results are in ADR-0062's store) | | [0029](0029-source-sync-and-port-forwarding-for-remote-lanes.md) | A remote lane works on a mirror of the requester's tree; ports and API come back over one connection | Accepted; point 2 amended (`[lanes] sync`); Consequences built by ADR-0038; point 4 extended to UDP by ADR-0056 | -| [0030](0030-each-lane-has-its-own-infrastructure.md) | Each lane has its own infrastructure | Accepted; point 2 detailed by ADR-0057 (an announced port moves inside the container too); the main tree's stop while lanes run, ADR-0068 | +| [0030](0030-each-lane-has-its-own-infrastructure.md) | Each lane has its own infrastructure | Accepted; point 2 detailed by ADR-0057 (an announced port moves inside the container too); the main tree's stop while lanes run, ADR-0068; point 5 amended 2026-10-27 (Docker Desktop's VM checked for the containers) | | [0031](0031-a-coordinator-places-lanes.md) | A coordinator places lanes and admits members; nodes admit leases; data goes directly | Accepted, amended (one binary: `devstack node`), amended 2026-10-19 (versions in the pool), amended 2026-10-21 (no share switch) | | [0032](0032-the-pool-is-administered-in-the-dashboard.md) | The pool is administered in the dashboard, by members with the admin role | Accepted, amended (admins grant nodes); extended by ADR-0039 (updating a server) | | [0033](0033-a-node-decides-what-runs-on-it.md) | A node decides who runs lanes on it, and what a lane there may do | Accepted, amended (what Compose files may ask; limits; the node's own policy; amended 2026-10-20: the node runs the model it checked, known keys only, a lane's projects end with it; noted 2026-10-21: what holds while a lane's containers start under its running daemon) | diff --git a/docs/dashboard-api.md b/docs/dashboard-api.md index f9ab8661..07b73cf7 100644 --- a/docs/dashboard-api.md +++ b/docs/dashboard-api.md @@ -362,7 +362,7 @@ type StoreView = { | `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)) | -| `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), 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` | `{"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 | | `POST /v1/lanes/prune` | `{"older_than"?: "7d", "dry_run"?: bool}`: what this repository's lanes leave behind: on this machine the Compose projects of lanes whose worktree is gone (only those whose files are in this repository's lane state), on the pool's nodes this machine's kept lanes of this repository that are gone or not used for `older_than`; `[Pruned]` | diff --git a/skills/devstack-config/SKILL.md b/skills/devstack-config/SKILL.md index 72357d1f..fbaca362 100644 --- a/skills/devstack-config/SKILL.md +++ b/skills/devstack-config/SKILL.md @@ -63,6 +63,9 @@ without a stack file starts from `devstack init` (a draft with TODOs). a `package.json` and no `prepare`). When git hooks need it (`npx eslint` in a pre-commit hook), `prepare.link = ["web/node_modules"]` links it into the worktree; `.gitignore` then needs `node_modules` without a trailing slash. + The linked directory is the lane's copy: reinstalling or deleting it in + the worktree empties what the lane runs from (say so in project notes + that tell agents to run `npm ci`). Name what it makes as `outputs = ["web/node_modules"]` (and `version = "node --version"`): the next lane with the same lockfile copies it from the machine's store instead of running `npm ci` again. `link` must be diff --git a/skills/devstack/SKILL.md b/skills/devstack/SKILL.md index 5f16edb3..f42e961a 100644 --- a/skills/devstack/SKILL.md +++ b/skills/devstack/SKILL.md @@ -57,6 +57,7 @@ Run from the repository root (devstack looks for `{{devstack:stack_file}}` there | `devstack hot-reload on\|off` | for a debugging session: the toolchain's watcher (e.g. `dotnet watch`) from the source tree instead of builds and candidates; needs `hot_reload` in the stack file. Switch it off again afterwards | | `devstack up` in a `git worktree` | starts that worktree's **lane** (every worktree is one) in the main tree's daemon: its own builds, ports moved by +100 (+200, ...), its own containers (a Compose project per lane, ports moved alike; `shared` services come from the main tree), no background workers (`--workers` turns them on; `--force` skips the memory check). Every command in the worktree then acts on the lane (`devstack lane list` shows all) | | `git worktree add -b ` | a new worktree is a lane at once, not started (devstack never creates or removes worktrees; use git or your tool); tell the user its dashboard page (`devstack ui --link` in it). A lane runs from a copy of its worktree, so `git worktree remove` works while it runs and stops it. `devstack lane stop ` stops a lane and keeps the worktree | +| a directory in a worktree that `prepare` links (`node_modules`, see `devstack lane list`: `linked`) | it is **the lane's copy**, not the worktree's own: on Windows a junction, which looks like a folder. Do not reinstall, delete or clean it there (`npm ci`, `rm -rf`, `git clean -x`, an IDE's "delete node_modules"): that empties what the lane runs from (for a lane on a node, its copy from the store), and a running dev server then fails. To install your own, ask the user, then stop the lane (`devstack lane stop ` removes the link) or remove only the link (`cmd /c rmdir

` on Windows, without `/s`; `rm ` elsewhere, no trailing slash), then install | | `devstack lane start [--on ]` | start a lane from the main tree (or anywhere in the repository), as `devstack up` in its worktree does; `status` in the main tree lists the lanes in one line. **To run another branch or commit beside the main stack** (an end-to-end run against a given commit, a review): `git worktree add `, `devstack lane start ` (its ports are the main ports plus its offset, `devstack lane list`), test against those, `devstack lane stop `, `git worktree remove `. A commit without a stack file of its own runs with the main tree's. **For an acceptance run** use the stack file's profile if it has one (`status` lists none; `[profiles]` in the file): `devstack lane start --profile

--run` starts the lane as the profile says (a build instead of a dev server, workers, fresh data, the suite's env) and runs its suite command. A worktree another tool or script created is a lane too: starting it gives its own ports, containers and database without building a separate environment | | `devstack lane reset ` / `devstack lane prune [--older-than 7d] [--dry-run]` | throw a stopped lane's data away (it starts fresh, seeded again); remove what lanes whose worktree is gone left behind, here and on the pool's nodes. A lane on a node keeps its data there between starts. Ask the user before either: data goes | | `devstack promote --lane ` | the lane's services, dev servers included, answer on the main ports; ask the user first, `--lane main` gives them back. A lane on a node may take them only on a dedicated node (a server) | @@ -180,7 +181,8 @@ Register it once (project `.mcp.json` or user configuration): | dashboard: "runs devstack X, Y is installed" | the stack still runs the old daemon: "Restart stack" there, or `devstack down` + `devstack up` | | a job `failed` after a long wait | jobs end after 30 minutes unless the stack file sets `timeout`; read its log, then ask the user before raising it (skill `devstack-config`) | | `devstack down` names services that did not stop | they still run: `devstack status`, then `devstack stop `; ask before ending a process yourself | -| `devstack up --on`: the node refuses the lane | the message names what the lane's Compose files ask that a node does not allow (privileged, host mounts, devices, build `tags`, a service key the node does not know, ...) or that the pool has not granted that node; the lane can still run here (`devstack up`) | +| `devstack up --on`: the node refuses the lane | the message names what the lane's Compose files ask that a node does not allow (privileged, host mounts, devices, build `tags`, a service key the node does not know, ...) or that the pool has not granted that node; the lane can still run on this machine with `devstack up --on local` (a plain `devstack up` goes to the machine's default, which may be the pool again) | +| `devstack up`: "no node of the pool can take the lane now" | the pool is this machine's default (`devstack pool default-on`) and is full: `devstack pool placement ` says what is free where; try again later, or run it here with `devstack up --on local`. The user chose the pool as the default: ask before running it here | | `devstack up --on` (or the MCP `up` with `on`) was interrupted or timed out while the lane started on the node | the start goes on there: `devstack lane list` shows its step; the same `devstack up --on ` again follows it to the end. A first start can take minutes (images pulled and built). It ends when the lane's daemon answers; its containers come up after, and its services start once those are healthy. A container that does not get healthy shows in `devstack status` with its group's error; `devstack logs ` has its output | ## 7. Problems in devstack itself