mirror of
https://github.com/openai/codex.git
synced 2026-11-09 20:50:33 +00:00
## What changed - Add a storage-neutral `QueueStore` interface backed by a dedicated SQLite database for ordered, thread-scoped user submissions. - Support enqueueing, paginated listing, editing, deletion, and atomic reordering, with a limit of 100 pending items per thread. - Remove queued submissions when their thread is deleted. ## Testing - Cover concurrent inserts, ordering and pagination, edits, deletion, cross-thread isolation, queue limits, and thread cleanup. GitOrigin-RevId: 0a8e95ac71137afc6f3a039d4b5fc8603110c891
23 lines
614 B
Rust
23 lines
614 B
Rust
use anyhow::Result;
|
|
use codex_protocol::ThreadId;
|
|
use sqlx::Row;
|
|
use sqlx::sqlite::SqliteRow;
|
|
|
|
/// One durable, ordered user submission for a thread.
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
pub struct QueuedUserSubmissionRecord {
|
|
pub id: String,
|
|
pub thread_id: ThreadId,
|
|
pub payload: String,
|
|
}
|
|
|
|
impl QueuedUserSubmissionRecord {
|
|
pub(crate) fn try_from_row(row: &SqliteRow) -> Result<Self> {
|
|
Ok(Self {
|
|
id: row.try_get("id")?,
|
|
thread_id: ThreadId::try_from(row.try_get::<String, _>("thread_id")?)?,
|
|
payload: row.try_get("payload_json")?,
|
|
})
|
|
}
|
|
}
|