From 00253f1c8b69187c929cccb7f2e8303af9145b11 Mon Sep 17 00:00:00 2001 From: Sebastian Gieseler Date: Wed, 21 Oct 2026 12:35:57 +0200 Subject: [PATCH] fix(lanes): a deferred forget says whose the lane is busy with `pending` is held by a start, a move and a forget; a second forget of a lane being removed logged "it is being started". A `forgetting` set tells the cases apart. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 3 +++ crates/devstack-daemon/src/lanes.rs | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b81d912..8a72d236 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,9 @@ and listed with their assets on the ### Fixed +- The daemon log says why a lane whose worktree went is not removed at once: + `lane_forget_deferred` said "it is being started" also when a removal of + the same lane was under way already, or a move. - Docs: a viewer of a shared lane reads its containers' logs, as it has since 0.11.0 (the node answers them itself); the docs and notes of 0.15.0 said otherwise. diff --git a/crates/devstack-daemon/src/lanes.rs b/crates/devstack-daemon/src/lanes.rs index 6f1f899f..303bda83 100644 --- a/crates/devstack-daemon/src/lanes.rs +++ b/crates/devstack-daemon/src/lanes.rs @@ -257,8 +257,11 @@ pub struct Lanes { remote: Mutex>>, /// Starts on a node and moves under way, or failed lately. moves: Mutex>, - /// Lanes being started right now, so one is not started twice. + /// Lanes being started, moved or forgotten right now, so one is not + /// started twice. pending: Mutex>, + /// Of `pending`, the lanes being forgotten: what a second forget says. + forgetting: Mutex>, /// Whom each lane is shared with, where its owner said so (ADR-0035); /// else `[lanes] share`. They may view it too (ADR-0040, amended /// 2026-10-20). Kept in `.devstack/lane-shares.json`. @@ -693,6 +696,7 @@ impl Lanes { remote: Mutex::new(BTreeMap::new()), moves: Mutex::new(BTreeMap::new()), pending: Mutex::new(BTreeSet::new()), + forgetting: Mutex::new(BTreeSet::new()), shares: Mutex::new(shares), profiles: Mutex::new(BTreeMap::new()), handover: Mutex::new(Handover::default()), @@ -979,13 +983,21 @@ impl Lanes { // Held for the whole of it: a start that comes in meanwhile is // refused ("is being started"), and finds the lane gone after. if !self.pending.lock().unwrap().insert(name.to_string()) { + // `pending` is a start's, a move's or another forget's: say whose. + let busy = if self.forgetting.lock().unwrap().contains(name) { + "it is being removed already" + } else { + "it is being started or moved" + }; crate::diag::info( "lane_forget_deferred", - serde_json::json!({ "lane": name, "why": "it is being started" }), + serde_json::json!({ "lane": name, "why": busy }), ); return; } + self.forgetting.lock().unwrap().insert(name.to_string()); self.forget_claimed(name, why); + self.forgetting.lock().unwrap().remove(name); self.pending.lock().unwrap().remove(name); self.announce(); }