mirror of
https://github.com/openai/codex.git
synced 2026-12-04 00:51:02 +00:00
## Why A stale read acknowledgement must not clear unread results published after the client’s snapshot or overwrite another read-state edit. Read state also needs to survive thread metadata rebuilds. ## What changed - Add `thread_read_receipts` and state APIs to query read state, publish thread attention, and mark threads read or unread. - Track the first unread turn and require matching revisions for explicit edits, returning the current state on conflicts. Allow manually marking even an empty thread unread. - Retain the last published turn across acknowledgements to suppress duplicate delivery. Keep receipts independent of rebuildable metadata and remove them on thread deletion. - Return initial read states without creating receipt rows. ## Testing Add tests covering stale edits, thread-specific initial revisions, repeated unread marks, duplicate publication, persistence across metadata rebuilds and restarts, clearing a reverted turn’s unread position, and deleted-thread handling. GitOrigin-RevId: fee8c05c20903b1d7aea7e8b61c9248c7f623a72
9 lines
350 B
SQL
9 lines
350 B
SQL
-- Independent of rebuildable thread metadata: only actual thread deletion removes receipts.
|
|
-- NULL means read; the empty string means manually unread from the start, even when empty.
|
|
CREATE TABLE thread_read_receipts (
|
|
thread_id TEXT PRIMARY KEY NOT NULL,
|
|
first_unread_turn TEXT,
|
|
revision TEXT NOT NULL,
|
|
last_published_turn TEXT
|
|
);
|