@@ -91,6 +91,9 @@ const DEFAULT_COMPLETION_DELIVERY_RETRY_DELAYS_MS = [
|
91 | 91 | ]; |
92 | 92 | const DEFAULT_TASK_ROW_RECONCILE_INTERVAL_MS = 10_000; |
93 | 93 | const RECENT_TERMINAL_TASK_RECONCILE_GRACE_MS = 60_000; |
| 94 | +// Codex's recorder uses this filename contract; non-canonical names keep the |
| 95 | +// legacy substring fallback for older or test-created transcript files. |
| 96 | +const CODEX_ROLLOUT_FILENAME_RE = /^rollout-\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-(.+)\.jsonl$/u; |
94 | 97 | |
95 | 98 | const defaultRuntime: NativeSubagentMonitorRuntime = { |
96 | 99 | createAgentHarnessTaskRuntime, |
@@ -1188,8 +1191,9 @@ async function findTranscriptPaths(params: {
|
1188 | 1191 | }): Promise<Map<string, string>> { |
1189 | 1192 | const sessionsDir = path.join(params.codexHome, "sessions"); |
1190 | 1193 | const found = new Map<string, string>(); |
| 1194 | +const remaining = new Set(params.childThreadIds); |
1191 | 1195 | const stack = [sessionsDir]; |
1192 | | -while (stack.length > 0 && found.size < params.childThreadIds.size) { |
| 1196 | +while (stack.length > 0 && remaining.size > 0) { |
1193 | 1197 | const dir = stack.pop()!; |
1194 | 1198 | let entries: Array<{ name: string; isDirectory(): boolean; isFile(): boolean }>; |
1195 | 1199 | try { |
@@ -1206,10 +1210,20 @@ async function findTranscriptPaths(params: {
|
1206 | 1210 | if (!entry.isFile() || !entry.name.endsWith(".jsonl")) { |
1207 | 1211 | continue; |
1208 | 1212 | } |
1209 | | -for (const childThreadId of params.childThreadIds) { |
1210 | | -if (!found.has(childThreadId) && entry.name.includes(childThreadId)) { |
| 1213 | +const rolloutMatch = entry.name.match(CODEX_ROLLOUT_FILENAME_RE); |
| 1214 | +if (rolloutMatch) { |
| 1215 | +const childThreadId = rolloutMatch[1]; |
| 1216 | +if (remaining.delete(childThreadId)) { |
1211 | 1217 | found.set(childThreadId, entryPath); |
1212 | 1218 | } |
| 1219 | +continue; |
| 1220 | +} |
| 1221 | +for (const childThreadId of remaining) { |
| 1222 | +if (entry.name.includes(childThreadId)) { |
| 1223 | +found.set(childThreadId, entryPath); |
| 1224 | +remaining.delete(childThreadId); |
| 1225 | +break; |
| 1226 | +} |
1213 | 1227 | } |
1214 | 1228 | } |
1215 | 1229 | } |
@@ -1236,10 +1250,13 @@ async function findTranscriptPath(params: {
|
1236 | 1250 | stack.push(entryPath); |
1237 | 1251 | continue; |
1238 | 1252 | } |
| 1253 | +const rolloutMatch = entry.name.match(CODEX_ROLLOUT_FILENAME_RE); |
1239 | 1254 | if ( |
1240 | 1255 | entry.isFile() && |
1241 | 1256 | entry.name.endsWith(".jsonl") && |
1242 | | -entry.name.includes(params.childThreadId) |
| 1257 | +(rolloutMatch |
| 1258 | + ? rolloutMatch[1] === params.childThreadId |
| 1259 | + : entry.name.includes(params.childThreadId)) |
1243 | 1260 | ) { |
1244 | 1261 | return entryPath; |
1245 | 1262 | } |
|