noticed a stale-state issue around same size transcript rewrites in src/providers/cursor/transcripts.ts file
right now tryCacheHit() treats the file as unchanged whenever sizeBytes matches the cached value, so if cursor rewrites/regenerates a transcript but the resulting file happens to have the same byte size, the parser skips reparsing entirely and just reuses the old cached parse state
const contentChanged = fileSizeBytes !== cached.sizeBytes;
if (!contentChanged) {
return {
result: {
agents: resolveAgentsFromState(cached.state, sourcePath, cached.fileUpdatedAt, now),
success: true,
warnings: [],
},
updatedCache: { ...cached, mtimeMs: fileUpdatedAt },
};
}
there is also a related assumption in resolveParseStrategy() where incremental parsing resumes from cached.lineCount whenever size/line count are at least the cached values which only seems safe for strictly append-only transcripts
in practice, if a session file gets rewritten/reset with different content but identical byte length, stale agents/task state from the previous session can persist until the file size changes again, this looked especially risky for restarted/re-generated cursor conversations
was append-only behaviour guaranteed here or could rewritten transcripts bypass cache invalidation?
noticed a stale-state issue around same size transcript rewrites in
src/providers/cursor/transcripts.tsfileright now
tryCacheHit()treats the file as unchanged wheneversizeBytesmatches the cached value, so if cursor rewrites/regenerates a transcript but the resulting file happens to have the same byte size, the parser skips reparsing entirely and just reuses the old cached parse statethere is also a related assumption in
resolveParseStrategy()where incremental parsing resumes fromcached.lineCountwhenever size/line count are at least the cached values which only seems safe for strictly append-only transcriptsin practice, if a session file gets rewritten/reset with different content but identical byte length, stale agents/task state from the previous session can persist until the file size changes again, this looked especially risky for restarted/re-generated cursor conversations
was append-only behaviour guaranteed here or could rewritten transcripts bypass cache invalidation?