A rewound turn's id is forgotten, so sending it again runs the turn anew
The turn log answered a repeated id with what that turn had answered, which was right for a prompt sent twice over a dropped link and wrong for a turn the web UI had just rewound to edit: the same id came back with the old reply. rewind now returns the ids it took out, both handlers forget them from the log, and the turn file drops them too, or the next load would have brought them back. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
7 files changed
+49
-15
No files matched your search
@@ -123,10 +123,11 @@ export class Store {
|
||||
return rows.find((r) => (JSON.parse(r.json) as Message).role === "user" && (JSON.parse(r.json) as { turnId?: string }).turnId === turnId)?.id
|
||||
}
|
||||
|
||||
/** How many turns start at row `fromId` or after it: the visible user messages that carry a turn id. */
|
||||
turnsFrom(sessionId: string, fromId: number): number {
|
||||
const rows = this.db.query("SELECT json FROM messages WHERE session_id = ? AND role = 'user' AND kind = 'message' AND id >= ?").all(sessionId, fromId) as { json: string }[]
|
||||
return rows.filter((r) => typeof (JSON.parse(r.json) as { turnId?: string }).turnId === "string").length
|
||||
/** The turns that start at row `fromId` or after it, oldest first: the ids the visible user
|
||||
* messages carry. */
|
||||
turnIdsFrom(sessionId: string, fromId: number): string[] {
|
||||
const rows = this.db.query("SELECT json FROM messages WHERE session_id = ? AND role = 'user' AND kind = 'message' AND id >= ? ORDER BY id").all(sessionId, fromId) as { json: string }[]
|
||||
return rows.map((r) => (JSON.parse(r.json) as { turnId?: string }).turnId).filter((id): id is string => typeof id === "string")
|
||||
}
|
||||
|
||||
/** Record a compaction: what the model sees from here on starts with this summary. */
|
||||
|
||||
Reference in new issue
Block a user