mirror of
https://github.com/openai/codex.git
synced 2026-09-02 14:49:14 +00:00
## What changed - Add `thread/section/move` to atomically move a thread into, within, or out of a section. Threads can be inserted before an existing member or appended, and moves within a section preserve `sectionEnteredAt`. - Add `section_position` sorting to `thread/list`, with ascending order as its default, and expose `sectionEnteredAt` in thread responses. - Persist section positions and entry times in SQLite, including migration of existing section members into recency order. Section membership is no longer updated through `thread/metadata/update`. ## Testing - Cover section moves, reordering, pagination, persistence across restarts and rollout reconciliation, concurrent updates, and rank renumbering. GitOrigin-RevId: aec6d7ddedca5277029b5caf5c074975397e956c
21 lines
686 B
SQL
21 lines
686 B
SQL
ALTER TABLE threads ADD COLUMN section_position INTEGER;
|
|
ALTER TABLE threads ADD COLUMN section_entered_at_ms INTEGER;
|
|
|
|
UPDATE threads
|
|
SET section_position = ranked.position,
|
|
section_entered_at_ms = threads.recency_at_ms
|
|
FROM (
|
|
SELECT id,
|
|
ROW_NUMBER() OVER (
|
|
PARTITION BY thread_section_id
|
|
ORDER BY recency_at_ms DESC, id DESC
|
|
) * 1000000 AS position
|
|
FROM threads
|
|
WHERE thread_section_id IS NOT NULL
|
|
) AS ranked
|
|
WHERE threads.id = ranked.id;
|
|
|
|
CREATE INDEX idx_threads_section_position
|
|
ON threads(archived, thread_section_id, section_position ASC, id ASC)
|
|
WHERE thread_section_id IS NOT NULL AND preview <> '';
|