Skip to content

Commit 59245ab

Browse files
committed
fix: preserve all-agent session listings
1 parent 6ec0e78 commit 59245ab

2 files changed

Lines changed: 4 additions & 33 deletions

File tree

‎ui/src/lib/sessions/index-list.test.ts‎

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,12 @@ function listResult(keys: string[] = [], totalCount = keys.length, offset = 0):
1919
};
2020
}
2121

22-
function sessionHarness(
23-
request: unknown,
24-
options: { sessionKey?: string; assistantAgentId?: string } = {},
25-
) {
22+
function sessionHarness(request: unknown) {
2623
const snapshot = {
2724
client: { request } as unknown as GatewayBrowserClient,
2825
phase: "connected" as "connected" | "reconnecting",
29-
sessionKey: options.sessionKey ?? "agent:main:main",
30-
assistantAgentId: options.assistantAgentId ?? "main",
26+
sessionKey: "agent:main:main",
27+
assistantAgentId: "main",
3128
hello: null,
3229
};
3330
let listener: ((next: typeof snapshot) => void) | undefined;
@@ -85,7 +82,6 @@ describe("session list requests", () => {
8582
await sessions.list({ boardFace: "dashboard" });
8683
expect(request).toHaveBeenCalledWith("sessions.list", {
8784
configuredAgentsOnly: true,
88-
agentId: "main",
8985
boardFace: "dashboard",
9086
includeGlobal: true,
9187
includeUnknown: true,
@@ -94,22 +90,6 @@ describe("session list requests", () => {
9490
sessions.dispose();
9591
});
9692

97-
it("defaults ad hoc lists to the selected session agent", async () => {
98-
const request = vi.fn(async () => listResult());
99-
const { sessions } = sessionHarness(request, {
100-
sessionKey: "agent:work:dashboard:current",
101-
assistantAgentId: "main",
102-
});
103-
104-
await sessions.list({ boardFace: "dashboard" });
105-
106-
expect(request).toHaveBeenCalledWith(
107-
"sessions.list",
108-
expect.objectContaining({ agentId: "work" }),
109-
);
110-
sessions.dispose();
111-
});
112-
11393
it("discards a list rejection from a retired same-client connection", async () => {
11494
let rejectStale!: (error: Error) => void;
11595
const staleRequest = new Promise<SessionsListResult>((_resolve, reject) => {

‎ui/src/lib/sessions/session-roster-refresh.ts‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,8 @@ export function createSessionRosterRefresh(host: SessionRosterRefreshHost) {
181181
if (!scope) {
182182
return null;
183183
}
184-
// Ad hoc lists inherit the visible session owner so strict multi-agent
185-
// gateways never receive an ambiguous ambient request.
186-
const snapshot = host.snapshot();
187-
const agentId = normalizeAgentId(
188-
options.agentId ??
189-
parseAgentSessionKey(snapshot.sessionKey)?.agentId ??
190-
host.readState().agentId ??
191-
resolveUiSelectedGlobalAgentId(snapshot),
192-
);
193184
try {
194-
const result = await requestSessionList(scope.client, { ...options, agentId });
185+
const result = await requestSessionList(scope.client, options);
195186
return host.connection.isCurrent(scope) ? host.decorate(result ?? null) : null;
196187
} catch (error) {
197188
if (!host.connection.isCurrent(scope)) {

0 commit comments

Comments
 (0)