Keep legacy daemon agents attached to workspaces

Old daemons can report agents by cwd without workspace IDs. Build path-backed workspace rows for that compatibility path and reapply ownership to legacy snapshots so tab reconciliation keeps those agents visible.
This commit is contained in:
Mohamed Boudra
2026-06-18 22:41:48 +07:00
parent ef87b09146
commit 3d5059ab05
7 changed files with 852 additions and 86 deletions
@@ -14,6 +14,7 @@ import { useHostRuntimeClient, useHostRuntimeIsConnected } from "@/runtime/host-
import { normalizeWorkspaceDescriptor, useSessionStore } from "@/stores/session-store";
import { useWorkspaceSetupStore } from "@/stores/workspace-setup-store";
import { normalizeAgentSnapshot } from "@/utils/agent-snapshots";
import { applyLegacyDaemonWorkspaceOwnership } from "@/workspace/legacy-daemon-workspaces";
import { encodeImages } from "@/utils/encode-images";
import { toErrorMessage } from "@/utils/error-messages";
import { splitComposerAttachmentsForSubmit } from "@/composer/attachments/submit";
@@ -322,7 +323,13 @@ export function WorkspaceSetupDialog() {
setAgents(serverId, (previous) => {
const next = new Map(previous);
next.set(agent.id, normalizeAgentSnapshot(agent, serverId));
next.set(
agent.id,
applyLegacyDaemonWorkspaceOwnership({
serverId,
agent: normalizeAgentSnapshot(agent, serverId),
}),
);
return next;
});
navigateAfterCreation(ensuredWorkspace.id, { kind: "agent", agentId: agent.id });