Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ impl Okena {
.collect();
let mut known = known_project_ids.lock();
for (id, path, saved_terminals) in &local_projects {
// Skip projects whose directory doesn't exist yet (deferred worktrees).
// They'll be picked up by the observer once the directory is ready.
if !std::path::Path::new(path).exists() {
continue;
}
service_manager.update(cx, |sm, cx| {
sm.load_project_services(id, path, saved_terminals, cx);
});
Expand All @@ -290,24 +295,28 @@ impl Okena {

let mut known = known_project_ids.lock();

// Load services for new projects
// Load services for new projects (or deferred worktrees whose directory now exists)
for (id, path, saved_terminals) in &local_projects {
if !known.contains(id) {
// Skip projects whose directory doesn't exist yet (deferred worktrees).
if !std::path::Path::new(path).exists() {
continue;
}
service_manager.update(cx, |sm, cx| {
sm.load_project_services(id, path, saved_terminals, cx);
});
known.insert(id.clone());
}
Comment on lines +298 to 309
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workspace→service loading observer logic is now diverging from the nearly-identical implementation in src/app/headless.rs. To avoid inconsistent behavior between GUI and headless modes (and future drift), consider either applying the same deferred-directory Path::exists() handling there as well, or extracting the shared project-service sync logic into a helper used by both call sites.

Copilot uses AI. Check for mistakes.
}

// Unload services for removed projects
let removed: Vec<String> = known.difference(&current_ids).cloned().collect();
for id in removed {
for id in &removed {
service_manager.update(cx, |sm, cx| {
sm.unload_project_services(&id, cx);
sm.unload_project_services(id, cx);
});
known.remove(id);
}

*known = current_ids;
})
.detach();
}
Expand Down
Loading