mirror of
https://github.com/openai/codex.git
synced 2026-05-15 08:42:34 +00:00
Thread Store
codex-thread-store is the storage boundary for Codex threads. It defines the
ThreadStore trait plus local and in-memory implementations. Other storage
implementations may live outside this repository.
Responsibilities
LiveThreadis the preferred API for active session persistence. It owns aThreadStore, serializes live operations, and sends canonical rollout items and explicit metadata updates in order.ThreadMetadataHandleris private to this crate and owned byLiveThread. It synthesizes initialSessionMeta, filters and sanitizes rollout items, observes implicit metadata changes, and preparesThreadMetadataUpdatevalues forLiveThreadto send throughThreadStore::apply_thread_metadata.ThreadStore::append_itemsis the raw canonical history append API. It does not infer metadata from item contents. Callers that need metadata correctness should useLiveThread.ThreadStore::apply_thread_metadatais the explicit metadata API. Local storage writes these facts to SQLite; other stores can route them to a metadata endpoint independent of rollout item contents.LocalThreadStorepersists history throughcodex-rolloutJSONL files and persists queryable metadata through the SQLite state database.RolloutRecorderis the local JSONL writer. It writes already-canonical items and does not decide which rollout events should be persisted.core/sessioncreates or resumesLiveThreadhandles and should not need to know whether persistence is backed by local files or a remote store.- App-server code should use
LiveThreadfor loaded threads.
Direction
New metadata semantics should live above ThreadStore. The store is
allowed to persist explicit metadata fields, but it should not derive metadata by
inspecting rollout item payloads.