Skip to content
Merged
Show file tree
Hide file tree
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
26 changes: 9 additions & 17 deletions src/CodexAcpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,11 +580,6 @@ export class CodexAcpClient {
"vscode",
"exec",
"appServer",
"subAgent",
"subAgentReview",
"subAgentCompact",
"subAgentThreadSpawn",
"subAgentOther",
"unknown",
];
const requestedCwd = request.cwd?.trim() ?? null;
Expand All @@ -605,26 +600,23 @@ export class CodexAcpClient {
sourceKinds: sourceKinds,
});

const mapThreadToSession = (thread: Thread) => ({
sessionId: thread.id,
cwd: thread.cwd,
title: (thread.name ?? thread.preview) || null,
updatedAt: new Date(thread.updatedAt * 1000).toISOString(),
});

if (listResponse.data.length === 0) {
const diagnostics = await this.runSessionListDiagnostics();
logger.log("Session list diagnostics", diagnostics);
}

let sessions = listResponse.data.map((thread) => ({
sessionId: thread.id,
cwd: thread.cwd,
title: (thread.name ?? thread.preview) || null,
updatedAt: new Date(thread.updatedAt * 1000).toISOString(),
}));
let sessions = listResponse.data.map(mapThreadToSession);
if (requestedCwd) {
const filtered = listResponse.data
.filter(filterByCwd)
.map((thread) => ({
sessionId: thread.id,
cwd: thread.cwd,
title: (thread.name ?? thread.preview) || null,
updatedAt: new Date(thread.updatedAt * 1000).toISOString(),
}));
.map(mapThreadToSession);
if (filtered.length > 0 || path.isAbsolute(requestedCwd)) {
sessions = filtered;
} else {
Expand Down
5 changes: 0 additions & 5 deletions src/__tests__/CodexACPAgent/list-sessions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ describe("CodexACPAgent - list sessions", () => {
"vscode",
"exec",
"appServer",
"subAgent",
"subAgentReview",
"subAgentCompact",
"subAgentThreadSpawn",
"subAgentOther",
"unknown",
],
}));
Expand Down
Loading