Add persisted manual ordering for thread sections (#36007)

## 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
This commit is contained in:
joeytrasatti-openai
2026-07-29 18:27:59 +00:00
committed by copyberry
parent c41a38dd10
commit ad6fc66b6d
75 changed files with 2879 additions and 543 deletions

View File

@@ -336,6 +336,7 @@ fn turn_items_for_thread_returns_matching_turn_items() {
preview: String::new(),
ephemeral: false,
section: None,
section_entered_at: None,
history_mode: Default::default(),
model_provider: "openai".to_string(),
created_at: 0,
@@ -804,6 +805,7 @@ fn sample_thread_start_response() -> ThreadStartResponse {
preview: String::new(),
ephemeral: false,
section: None,
section_entered_at: None,
history_mode: Default::default(),
model_provider: "openai".to_string(),
created_at: 0,