Treat empty workspaceRoot as null when matching hosts by basename

A pending-task placeholder project has workspaceRoot "" when no cwd was
snapshotted; an "" basename rejected every real host, emptying the
environment picker for that queued task.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
Theo BrowneandClaude Fable 5 committed 2026-07-04 06:38:03 -07:00
1 parent 3fd7f73c95
commit cf9a56460c
1 file changed
+4 -2
@@ -283,7 +283,9 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
// identity is the primary signal; projects that haven't reported one yet (still
// indexing) fall back to workspace basename / title so a valid host isn't hidden.
const selectedRepositoryKey = selectedProject?.repositoryIdentity?.canonicalKey ?? null;
const selectedWorkspaceBasename = selectedProject?.workspaceRoot.split("/").at(-1) ?? null;
// `|| null` (not `??`): a pending-task placeholder project can have an empty
// workspaceRoot, and an "" basename would reject every real host below.
const selectedWorkspaceBasename = selectedProject?.workspaceRoot.split("/").at(-1) || null;
const selectedProjectTitle = selectedProject?.title ?? null;
const environments = useMemo(() => {
const seen = new Set<EnvironmentId>();
@@ -510,7 +512,7 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
// indexed) fall back to workspace basename, then title, so switching
// computers still follows the same repo instead of resetting to
// whatever project is first on the target machine.
const workspaceBasename = selectedProject?.workspaceRoot.split("/").at(-1) ?? null;
const workspaceBasename = selectedProject?.workspaceRoot.split("/").at(-1) || null;
const match =
(repositoryKey !== null
? projectsOnTarget.find(