Compare commits

...
Author SHA1 Message Date
Cursor Agent 645e6dbe3c Fix missing root-level fallback for turns in parseThreadSnapshot
When the API returns a flat response (threadId at root level instead of
nested under thread), parseThreadSnapshot correctly fell back to reading
threadId from the root but silently defaulted turns to []. This caused
checkpoint listings to return no checkpoints and revert operations to
use a messageCount of zero, leading to data loss.

Add a fallback to read turns from the root-level response, matching the
existing fallback pattern used for threadId.
2026-02-17 19:45:11 +00:00
+1 -1
View File
@@ -795,7 +795,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
throw new Error(`${method} response did not include a thread id.`);
}
const turnsRaw = this.readArray(thread, "turns") ?? [];
const turnsRaw = this.readArray(thread, "turns") ?? this.readArray(responseRecord, "turns") ?? [];
const turns = turnsRaw.map((turnValue, index) => {
const turn = this.readObject(turnValue);
const turnId = this.readString(turn, "id") ?? `${threadId}:turn:${index + 1}`;