Key workspace status and ownership by ID, not directory
Multiple workspaces can share one checkout directory. Agent and terminal status, sidebar tabs, and ownership now attribute strictly by workspace ID, so a running or blocked agent in one workspace no longer shows up on its same-directory siblings. A one-time startup migration backfills workspace IDs onto legacy agents, and every agent and terminal is created with one thereafter. Directory lookups remain only for genuinely folder-derived git facts (branch, diff) and the archive-by-path adapter.
This commit is contained in:
@@ -60,6 +60,7 @@ describe("terminal-session-controller restore", () => {
|
||||
id: "term-1",
|
||||
name: "Terminal",
|
||||
cwd: "/tmp",
|
||||
workspaceId: "ws-test",
|
||||
send: vi.fn(),
|
||||
subscribe: (listener) => {
|
||||
terminalListener = listener;
|
||||
@@ -154,6 +155,7 @@ function listSession(input: { id: string; name: string; cwd: string }): Terminal
|
||||
id: input.id,
|
||||
name: input.name,
|
||||
cwd: input.cwd,
|
||||
workspaceId: "ws-test",
|
||||
send: vi.fn(),
|
||||
subscribe: () => vi.fn(),
|
||||
onExit: () => vi.fn(),
|
||||
@@ -193,6 +195,7 @@ describe("terminal-session-controller wrap-flag gating", () => {
|
||||
id: "term-1",
|
||||
name: "Terminal",
|
||||
cwd: "/tmp",
|
||||
workspaceId: "ws-test",
|
||||
send: vi.fn(),
|
||||
subscribe: (listener) => {
|
||||
queueMicrotask(() => listener({ type: "snapshotReady", revision: 1 }));
|
||||
@@ -329,7 +332,7 @@ describe("terminal-session-controller subdirectory aggregation", () => {
|
||||
|
||||
changedListener?.({
|
||||
cwd: subdirCwd,
|
||||
terminals: [{ id: "subdir-term", name: "Mobile", cwd: subdirCwd }],
|
||||
terminals: [{ id: "subdir-term", name: "Mobile", cwd: subdirCwd, workspaceId: "ws-test" }],
|
||||
});
|
||||
await flushMicrotasks();
|
||||
|
||||
@@ -339,8 +342,8 @@ describe("terminal-session-controller subdirectory aggregation", () => {
|
||||
payload: {
|
||||
cwd: rootCwd,
|
||||
terminals: [
|
||||
{ id: "root-term", name: "Terminal 1", activity: null },
|
||||
{ id: "subdir-term", name: "Mobile", activity: null },
|
||||
{ id: "root-term", name: "Terminal 1", workspaceId: "ws-test", activity: null },
|
||||
{ id: "subdir-term", name: "Mobile", workspaceId: "ws-test", activity: null },
|
||||
],
|
||||
},
|
||||
},
|
||||
@@ -403,7 +406,9 @@ describe("terminal-session-controller subdirectory aggregation", () => {
|
||||
type: "list_terminals_response",
|
||||
payload: {
|
||||
cwd: rootCwd,
|
||||
terminals: [{ id: "root-term", name: "Terminal 1", activity: null }],
|
||||
terminals: [
|
||||
{ id: "root-term", name: "Terminal 1", workspaceId: "ws-test", activity: null },
|
||||
],
|
||||
requestId: "req-root",
|
||||
},
|
||||
},
|
||||
@@ -411,7 +416,9 @@ describe("terminal-session-controller subdirectory aggregation", () => {
|
||||
type: "list_terminals_response",
|
||||
payload: {
|
||||
cwd: worktreeCwd,
|
||||
terminals: [{ id: "worktree-term", name: "Feature", activity: null }],
|
||||
terminals: [
|
||||
{ id: "worktree-term", name: "Feature", workspaceId: "ws-test", activity: null },
|
||||
],
|
||||
requestId: "req-worktree",
|
||||
},
|
||||
},
|
||||
@@ -500,6 +507,7 @@ describe("terminal-session-controller backpressure snapshot fallback", () => {
|
||||
id: "term-1",
|
||||
name: "Terminal",
|
||||
cwd: "/tmp",
|
||||
workspaceId: "ws-test",
|
||||
send: vi.fn(),
|
||||
subscribe: (listener) => {
|
||||
terminalListener = listener;
|
||||
|
||||
Reference in New Issue
Block a user