File tree Expand file tree Collapse file tree
src/main/services/discovery Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -754,6 +754,12 @@ export class ProjectScanner {
754754 ? firstMessageTimestampMs
755755 : birthtimeMs ;
756756
757+ // If messages suggest ongoing but the file hasn't been written to in 5+ minutes,
758+ // the session likely crashed/was killed — mark as dead (issue #94)
759+ const STALE_SESSION_THRESHOLD_MS = 5 * 60 * 1000 ;
760+ const isOngoing =
761+ metadata . isOngoing && Date . now ( ) - effectiveMtime < STALE_SESSION_THRESHOLD_MS ;
762+
757763 return {
758764 id : sessionId ,
759765 projectId,
@@ -764,7 +770,7 @@ export class ProjectScanner {
764770 messageTimestamp : metadata . firstUserMessage ?. timestamp ,
765771 hasSubagents,
766772 messageCount : metadata . messageCount ,
767- isOngoing : metadata . isOngoing ,
773+ isOngoing,
768774 gitBranch : metadata . gitBranch ?? undefined ,
769775 metadataLevel,
770776 contextConsumption : metadata . contextConsumption ,
You can’t perform that action at this time.
0 commit comments