Skip to content
Open
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
3 changes: 2 additions & 1 deletion server/codex-app-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ function isArchivedOrDeletedDesktopThread(thread = null) {
if (!thread || typeof thread !== 'object') {
return true;
}
const status = String(thread.status || '').toLowerCase();
const statusValue = typeof thread.status === 'string' ? thread.status : thread.status?.type;
const status = String(statusValue || '').toLowerCase();
const archivedAt = String(thread.archivedAt || thread.deletedAt || thread.archived_at || thread.deleted_at || '').trim();
const deletedFlag = Boolean(thread.deleted) || Boolean(thread.isDeleted) || status === 'deleted' || status === 'archived';
const archivedFlag = Boolean(thread.archived) || Boolean(thread.isArchived) || status === 'archived';
Expand Down
6 changes: 5 additions & 1 deletion server/codex-app-server.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ test('filterDesktopThreadsForArchiveMode keeps archived threads only for archive
{ id: 'open-1', status: 'completed' },
{ id: 'archived-1', status: 'archived' },
{ id: 'archived-2', archived: true },
{ id: 'archived-3', status: { type: 'archived' } },
{ id: 'deleted-1', status: { type: 'deleted' } },
{ status: 'archived' }
];

assert.deepEqual(filterDesktopThreadsForArchiveMode(threads, { archived: false }).map((thread) => thread.id), ['open-1']);
assert.deepEqual(filterDesktopThreadsForArchiveMode(threads, { archived: true }).map((thread) => thread.id), [
'open-1',
'archived-1',
'archived-2'
'archived-2',
'archived-3',
'deleted-1'
]);
});

Expand Down
4 changes: 2 additions & 2 deletions server/codex-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export { messagesFromDesktopThread } from './desktop-thread-projector.js';
export { normalizeComparablePath } from './session-index-builder.js';

const INCLUDE_MISSING_SUBAGENT_THREADS = process.env.CODEXMOBILE_INCLUDE_MISSING_SUBAGENT_THREADS === '1';
const USE_APP_SERVER_THREAD_LIST = /^(1|true|yes|on)$/i.test(String(process.env.CODEXMOBILE_USE_APP_SERVER_THREAD_LIST || '').trim());
const USE_LOCAL_THREAD_SCAN = /^(1|true|yes|on)$/i.test(String(process.env.CODEXMOBILE_USE_LOCAL_THREAD_SCAN || '').trim());
const execFileAsync = promisify(execFile);
const LOCAL_THREAD_SCAN_LIMIT = 1000;
const LOCAL_THREAD_HEAD_BYTES = 512 * 1024;
Expand Down Expand Up @@ -458,7 +458,7 @@ async function listLocalDesktopThreadsFromJsonl({ limit = LOCAL_THREAD_SCAN_LIMI
}

async function listDesktopThreadsForCache() {
if (!USE_APP_SERVER_THREAD_LIST) {
if (USE_LOCAL_THREAD_SCAN) {
return listLocalDesktopThreadsFromJsonl({ limit: LOCAL_THREAD_SCAN_LIMIT });
}
const remote = listDesktopThreads({ limit: 1000 })
Expand Down
3 changes: 2 additions & 1 deletion server/session-index-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ function isArchivedOrDeletedDesktopThread(thread = null) {
if (!thread || typeof thread !== 'object') {
return true;
}
const status = String(thread.status || '').toLowerCase();
const statusValue = typeof thread.status === 'string' ? thread.status : thread.status?.type;
const status = String(statusValue || '').toLowerCase();
const archivedAt = String(thread.archivedAt || thread.deletedAt || thread.archiveAt || thread.archived_at || thread.deleted_at || '').trim();
const deletedAt = String(thread.deletedAt || thread.deleted_at || '').trim();
const flaggedDeleted = Boolean(thread.deleted) || Boolean(thread.isDeleted) || status === 'deleted' || status === 'archived';
Expand Down
9 changes: 9 additions & 0 deletions server/session-index-builder.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ test('session index builder preserves project ordering, projectless sessions, hi
status: 'archived',
updatedAt: 1_800_000_040,
source: 'vscode'
},
{
id: 'archived-object-status',
cwd: projectB,
name: 'archived object status',
status: { type: 'archived' },
updatedAt: 1_800_000_041,
source: 'vscode'
}
],
spawnEdges: [
Expand Down Expand Up @@ -168,6 +176,7 @@ test('session index builder preserves project ordering, projectless sessions, hi
assert.equal(index.projectById.get(projectAId).sessionCount, 3);
assert.equal(index.sessionById.has('hidden-1'), false);
assert.equal(index.sessionById.has('archived-1'), false);
assert.equal(index.sessionById.has('archived-object-status'), false);

const parent = index.sessionById.get('parent-1');
assert.equal(parent.title, '手机标题');
Expand Down