Skip to content

Commit ebc8e04

Browse files
committed
fix(desktop): never reattach a previous installation's volumes on a fresh install
A desktop install set up again after its folder was deleted refused to reuse only the old database. Every other volume the previous install left was reattached silently: Compose project volumes (agent-workspace, agent-profiles, spire-*) and the supervisor's per-Bot volumes (<ns>-workspace-<bot>, <ns>-profile-<bot>). Default Bot ids are stable across installs, so a new Bot opened the old Bot's files and Chromium profile, including its website sign-ins. On Start, a verified-fresh installation (no usable key, no database URL, no saved model) now lists every leftover it can prove it owns: Compose volumes and containers by project label, supervisor volumes and containers by all three supervisor labels in this namespace. Start is refused with one confirmed reset that removes the stopped containers, then the volumes, bound to the exact set shown. A running owned container blocks the reset and nothing is removed. Installations with their saved key keep their data as before.
1 parent f1961c3 commit ebc8e04

8 files changed

Lines changed: 1639 additions & 167 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ Newest first. `Unreleased` is what is on `main` and not yet tagged.
3232
`code_required` (below). A server and a computer must be upgraded together: an older computer has
3333
no `/sign-in/code`.
3434

35+
### A reinstall no longer picks up the previous installation's Bot files and sign-ins
36+
37+
A desktop installation set up again after its folder was deleted reused whatever the previous one
38+
left in the container engine: Bot workspace files, and each Bot's browser profile with its website
39+
sign-ins, under the same Bot ids. Only the database was checked. Start now lists every volume and
40+
stopped container the previous installation left, and offers one confirmed reset that removes them;
41+
nothing is reused without asking. A container from it that is still running stops the reset until it
42+
is stopped. An installation with its saved key keeps its data as before.
43+
3544
### A new desktop install starts its server again
3645

3746
A desktop install of v0.2.0 stopped at start with `server stopped straight away (exit status: 1)` and

‎desktop/src-tauri/src/main.rs‎

Lines changed: 424 additions & 75 deletions
Large diffs are not rendered by default.

‎desktop/src-tauri/src/problem.rs‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,21 @@ pub struct Problem {
3636
/// The full, verified Compose volume name offered for an explicit fresh-install reset.
3737
#[serde(skip_serializing_if = "Option::is_none")]
3838
pub database_reset: Option<String>,
39+
/// A verified fresh-install reset of everything a previous installation left behind.
40+
/// Boxed and flattened: the window reads `leftover_reset` and `leftover_containers`.
41+
#[serde(flatten, skip_serializing_if = "Option::is_none")]
42+
pub leftover: Option<Box<LeftoverReset>>,
43+
}
44+
45+
/// Exactly what one confirmed reset removes: the containers first, then the volumes.
46+
#[derive(Clone, Debug, Default, Serialize, PartialEq, Eq)]
47+
pub struct LeftoverReset {
48+
/// Every verified volume, the database included.
49+
#[serde(rename = "leftover_reset", skip_serializing_if = "Vec::is_empty")]
50+
pub volumes: Vec<String>,
51+
/// Stopped containers that still hold those volumes.
52+
#[serde(rename = "leftover_containers", skip_serializing_if = "Vec::is_empty")]
53+
pub containers: Vec<String>,
3954
}
4055

4156
impl Problem {
@@ -46,6 +61,7 @@ impl Problem {
4661
detail: None,
4762
connection: None,
4863
database_reset: None,
64+
leftover: None,
4965
}
5066
}
5167

@@ -57,9 +73,22 @@ impl Problem {
5773
detail: (!detail.trim().is_empty()).then_some(detail),
5874
connection: None,
5975
database_reset: None,
76+
leftover: None,
6077
}
6178
}
6279

80+
/// The volumes a confirmed reset removes, or none when no reset is offered.
81+
pub fn leftover_volumes(&self) -> &[String] {
82+
self.leftover.as_deref().map_or(&[], |reset| &reset.volumes)
83+
}
84+
85+
/// The stopped containers a confirmed reset removes before those volumes.
86+
pub fn leftover_containers(&self) -> &[String] {
87+
self.leftover
88+
.as_deref()
89+
.map_or(&[], |reset| &reset.containers)
90+
}
91+
6392
pub fn connection(mut self, connection: Connection) -> Self {
6493
self.connection = Some(connection);
6594
self

0 commit comments

Comments
 (0)