You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Hard ceiling on persisted run directories on disk. Beyond this, the oldest runs (by updatedAt)
22
+
* are pruned by cleanupOldRuns. Set generously above LOAD_PERSISTED_LIMIT so runs hidden from the
23
+
* panel can still be resumed manually before aging out.
24
+
*/
25
+
constKEEP_MAX_RUNS=50
26
+
13
27
/**
14
28
* Single source for runsDir: shares the same root as ports.ts journalStore (${projectRoot}/.claude/workflow-runs).
15
29
* Extracted as a function: eliminates duplicated path concatenation between ports.ts and persistence logic, staying in the same root when entering worktree/subdirectory.
@@ -86,9 +100,12 @@ export async function readRunState(
86
100
* - A subdirectory without state.json (half-written run) → skip
87
101
* - A subdirectory whose state.json is corrupted → skip that single one, keep scanning the rest
88
102
* - Sort by updatedAt descending (consistent with store.list() ordering)
103
+
* - Optional limit: keep only the first N newest (used by loadPersistedRuns so the panel
104
+
* doesn't drown under months of history; full scan stays available by omitting the arg).
89
105
*/
90
106
exportasyncfunctionlistPersistedRuns(
91
107
runsDir: string,
108
+
limit?: number,
92
109
): Promise<RunProgress[]>{
93
110
letentries: string[]
94
111
try{
@@ -101,7 +118,56 @@ export async function listPersistedRuns(
0 commit comments