Skip to content

Commit 5fb3139

Browse files
committed
fix(sessions): mark derived sessions in detail for disabling convert
1 parent 0b79956 commit 5fb3139

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

cli.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6346,10 +6346,14 @@ function isDerivedSessionFile(filePath) {
63466346
const metaPath = getDerivedSessionMetaPath(filePath);
63476347
if (!metaPath) return false;
63486348
try {
6349-
return fs.existsSync(metaPath);
6349+
if (fs.existsSync(metaPath)) {
6350+
return true;
6351+
}
63506352
} catch (_) {
63516353
return false;
63526354
}
6355+
const base = path.basename(filePath || '', path.extname(filePath || ''));
6356+
return /-\d{8}-\d{6}-[0-9a-f]{6}$/i.test(base);
63536357
}
63546358

63556359
function resolveStateMaxMessages(state) {
@@ -6697,6 +6701,20 @@ async function readSessionDetail(params = {}) {
66976701
sessionId,
66986702
cwd: extracted.cwd || '',
66996703
updatedAt: extracted.updatedAt || '',
6704+
derived: (() => {
6705+
try {
6706+
const metaPath = filePath.toLowerCase().endsWith('.jsonl')
6707+
? `${filePath.slice(0, -5)}.meta.json`
6708+
: `${filePath}.meta.json`;
6709+
if (fs.existsSync(metaPath)) {
6710+
return true;
6711+
}
6712+
} catch (_) {
6713+
return false;
6714+
}
6715+
const base = path.basename(filePath || '', path.extname(filePath || ''));
6716+
return /-\d{8}-\d{6}-[0-9a-f]{6}$/i.test(base);
6717+
})(),
67006718
totalMessages: hasExactTotalMessages ? extracted.totalMessages : null,
67016719
clipped: typeof extracted.clipped === 'boolean'
67026720
? extracted.clipped

web-ui/session-helpers.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,9 @@ export async function loadActiveSessionDetail(api, options = {}) {
422422
if (res.sourceLabel) {
423423
this.activeSession.sourceLabel = res.sourceLabel;
424424
}
425+
if (typeof res.derived === 'boolean') {
426+
this.activeSession.derived = res.derived;
427+
}
425428
if (res.sessionId) {
426429
this.activeSession.sessionId = res.sessionId;
427430
if (!this.activeSession.title) {

0 commit comments

Comments
 (0)