Files
codex/codex-rs/state/src/model/mod.rs
T
joeytrasatti-openai 26a49b3882 Add paginated reverse lookup for thread attachments (#50083)
## What changed

Add `StateRuntime::list_thread_attachment_threads` to find threads by exact `attachment_type` and `identity_key`, including threads without previews. Return thread IDs and archive state, with filters for all, archived, or non-archived threads.

Order results by thread ID and bind pagination cursors to the attachment identity and archive filter. Add a database index on `(attachment_type, identity_key, thread_id)` to support the lookup.

## Testing

Add coverage for exact identity matching, archive filters, pagination, rejection of cursors reused with different lookup parameters, and membership updates after attachment removal or thread deletion.

GitOrigin-RevId: 21f32eb0cb1845a82d740d67b374080b6e12eb03
2026-10-01 19:55:36 +00:00

60 lines
2.1 KiB
Rust

mod backfill_state;
mod graph;
mod log;
mod memories;
mod project;
mod queued_item;
mod rollout_migration_state;
mod thread_attachment;
mod thread_goal;
mod thread_metadata;
pub use backfill_state::BackfillState;
pub use backfill_state::BackfillStatus;
pub use graph::DirectionalThreadSpawnEdgeStatus;
pub use log::LogEntry;
pub use log::LogQuery;
pub use log::LogRow;
pub use memories::Phase2JobClaimOutcome;
pub use memories::Stage1JobClaim;
pub use memories::Stage1JobClaimOutcome;
pub use memories::Stage1Output;
pub use memories::Stage1StartupClaimParams;
pub use project::CreatedProject;
pub use project::Project;
pub use project::ProjectRoot;
pub use project::ProjectSortKey;
pub use project::ProjectsPage;
pub use queued_item::QueuedUserSubmissionRecord;
pub use rollout_migration_state::RolloutMigrationCursor;
pub use rollout_migration_state::RolloutMigrationSkippedRollout;
pub use rollout_migration_state::RolloutMigrationState;
pub use thread_attachment::AddThreadAttachmentOutcome;
pub use thread_attachment::RemoveThreadAttachmentOutcome;
pub use thread_attachment::ThreadAttachment;
pub use thread_attachment::ThreadAttachmentArchiveFilter;
pub use thread_attachment::ThreadAttachmentOwner;
pub use thread_attachment::ThreadAttachmentOwnerPage;
pub use thread_attachment::ThreadAttachmentPage;
pub use thread_goal::ThreadGoal;
pub use thread_goal::ThreadGoalStatus;
pub use thread_metadata::Anchor;
pub use thread_metadata::BackfillStats;
pub use thread_metadata::ExtractionOutcome;
pub use thread_metadata::SortDirection;
pub use thread_metadata::SortKey;
pub use thread_metadata::ThreadMetadata;
pub use thread_metadata::ThreadMetadataBuilder;
pub use thread_metadata::ThreadRelationFilter;
pub use thread_metadata::ThreadSection;
pub use thread_metadata::ThreadSectionAppearance;
pub use thread_metadata::ThreadSectionsPage;
pub use thread_metadata::ThreadsPage;
pub(crate) use thread_goal::ThreadGoalRow;
pub(crate) use thread_metadata::ThreadRow;
pub(crate) use thread_metadata::anchor_from_item;
pub(crate) use thread_metadata::datetime_to_epoch_millis;
pub(crate) use thread_metadata::datetime_to_epoch_seconds;
pub(crate) use thread_metadata::epoch_millis_to_datetime;