Skip to content

Commit e94e99f

Browse files
mthsmbclaude
andcommitted
fix(server): rewound Codex rollouts with unreadable history stay skipped
A rewound Codex rollout can add no messages of its own and rely on the history it inherits from an earlier rollout. When that history could not be read, the rollout looked empty and was dropped silently. Report it as skipped again, as on main; ordinary unused rollouts have no history base and are still ignored. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent fdbf0e7 commit e94e99f

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

‎apps/server/src/project/AgentSessionScanner.test.ts‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,48 @@ it.layer(NodeServices.layer)("AgentSessionScanner", (it) => {
16311631
}),
16321632
);
16331633

1634+
it.effect("skips a rewound Codex rollout whose inherited history is unavailable", () =>
1635+
Effect.gen(function* () {
1636+
const path = yield* Path.Path;
1637+
const nowMs = Date.parse("2026-08-24T12:00:00.000Z");
1638+
yield* TestClock.setTime(nowMs);
1639+
const claudeHomePath = yield* makeTempDir("t3code-claude-home-");
1640+
const codexHomePath = yield* makeTempDir("t3code-codex-home-");
1641+
const workspace = yield* makeTempDir("t3code-workspace-");
1642+
const threadId = "019a0000-0000-7000-8000-000000000001";
1643+
const rolloutId = "019a0000-0000-7000-8000-000000000002";
1644+
// The ancestor rollout is missing, and this rollout added no messages of its own.
1645+
yield* writeTranscript({
1646+
filePath: path.join(
1647+
codexHomePath,
1648+
"sessions",
1649+
"2026",
1650+
"08",
1651+
"24",
1652+
`rollout-2026-08-24T11-00-00-${threadId}_${rolloutId}.jsonl`,
1653+
),
1654+
contents: encodeTranscriptRecord({
1655+
type: "session_meta",
1656+
payload: {
1657+
id: threadId,
1658+
cwd: workspace,
1659+
history_mode: "paginated",
1660+
history_base: { thread_id: threadId, end_ordinal_exclusive: 3, end_byte_offset: 512 },
1661+
},
1662+
}),
1663+
mtimeMs: nowMs,
1664+
});
1665+
1666+
const outcomes = yield* runRecentThreadOutcomes({
1667+
claudeHomePath,
1668+
codexHomePath,
1669+
workspaceRoot: workspace,
1670+
});
1671+
1672+
expect(outcomes).toEqual([{ _tag: "Skipped" }]);
1673+
}),
1674+
);
1675+
16341676
it.effect("skips excessive records without blocking an older valid transcript", () =>
16351677
Effect.gen(function* () {
16361678
const path = yield* Path.Path;

‎apps/server/src/project/AgentSessionScanner.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,10 @@ export const make = Effect.gen(function* () {
18351835
snapshot.claudeFields,
18361836
);
18371837
if (parsedThread === "empty") {
1838+
// null means an unreadable history base, which may hold the conversation.
1839+
if (candidate.source === "codex" && inheritedRecords === null) {
1840+
return Option.some<AgentSessionRecentThread>({ _tag: "Skipped" });
1841+
}
18381842
// Never recorded as imported, so charging them would starve real sessions every run.
18391843
transcriptsRemaining += 1;
18401844
return Option.none<AgentSessionRecentThread>();

0 commit comments

Comments
 (0)