Skip to main content

Crate codex_state

Crate codex_state 

Source
Expand description

SQLite-backed state for rollout metadata.

This crate is intentionally small and focused: it extracts rollout metadata from JSONL rollouts and mirrors it into a local SQLite database. Backfill orchestration and rollout scanning live in codex-core.

Modules§

log_db
Tracing log export into the local SQLite log database.

Structs§

Anchor
A pagination anchor used for keyset pagination.
BackfillState
Persisted lifecycle state for rollout metadata backfill.
BackfillStats
Statistics about a backfill operation.
ExternalAgentConfigImportDetailsRecord
ExternalAgentConfigImportFailureRecord
ExternalAgentConfigImportHistoryRecord
ExternalAgentConfigImportSuccessRecord
ExtractionOutcome
The outcome of extracting metadata from a rollout.
GoalStore
GoalUpdate
LogEntry
LogQuery
LogRow
MemoryStore
Store for generated memory state and memory extraction/consolidation jobs.
RemoteControlEnrollmentRecord
Persisted remote-control server enrollment, including the lookup key.
RuntimeDbBackup
RuntimeDbPath
SqliteConfig
Resolved configuration shared by all Codex SQLite connections.
Stage1JobClaim
Claimed stage-1 job with thread metadata.
Stage1Output
Stored stage-1 memory extraction output for a single thread.
Stage1StartupClaimParams
StateRuntime
Preferred entrypoint: owns configuration and metrics.
ThreadFilterOptions
ThreadGoal
ThreadMetadata
Canonical persisted thread metadata.
ThreadMetadataBuilder
Builder data required to construct ThreadMetadata without parsing filenames.
ThreadStateAuditRow
Minimal thread metadata used by read-only state database audits.
ThreadsPage
A single page of thread metadata results.

Enums§

BackfillStatus
Backfill lifecycle status.
DirectionalThreadSpawnEdgeStatus
Status attached to a directional thread-spawn edge.
GoalAccountingMode
GoalAccountingOutcome
Phase2JobClaimOutcome
Result of trying to claim a phase-2 consolidation job.
SortDirection
Sort direction to use when listing threads.
SortKey
The sort key to use when listing threads.
Stage1JobClaimOutcome
Result of trying to claim a stage-1 memory extraction job.
ThreadGoalStatus
ThreadRelationFilter
Spawn-graph relationship used to filter thread listings.

Constants§

DB_ERROR_METRIC
Errors encountered during DB operations. Tags: [stage]
DB_FALLBACK_METRIC
Rollout fallback attempts. Tags: [caller, reason]
DB_INIT_DURATION_METRIC
SQLite initialization latency. Tags: [status, phase, db, error]
DB_INIT_METRIC
SQLite initialization attempts. Tags: [status, phase, db, error]
DB_METRIC_BACKFILL
Metrics on backfill process. Tags: [status]
DB_METRIC_BACKFILL_DURATION_MS
Metrics on backfill duration. Tags: [status]
GOALS_DB_FILENAME
LOGS_DB_FILENAME
MEMORIES_DB_FILENAME
SQLITE_HOME_ENV
Environment variable for overriding the SQLite state database home directory.
STATE_DB_FILENAME
THREAD_HISTORY_DB_FILENAME

Traits§

DbTelemetry
Low-cardinality sink for SQLite startup and fallback telemetry.

Functions§

apply_rollout_item
Low-level storage engine: useful for focused tests.
backup_runtime_db_for_fresh_start
Move one Codex runtime SQLite database out of the way so that database can be recreated without discarding unrelated runtime databases.
goals_db_filename
goals_db_path
install_process_db_telemetry
Install the process-wide SQLite telemetry sink.
is_sqlite_corruption_error
logs_db_filename
logs_db_path
memories_db_filename
memories_db_path
open_thread_history_db
Open and migrate the rebuildable paginated thread-history database.
read_thread_state_audit_rows
Read persisted thread rows from a state DB without creating, migrating, or repairing it.
record_backfill_gate
record_fallback
rollout_item_affects_thread_metadata
Return whether this rollout item can mutate thread metadata stored in SQLite.
runtime_db_path_for_corruption_error
runtime_db_paths
sqlite_error_detail_is_corruption
sqlite_error_detail_is_lock
sqlite_integrity_check
Run SQLite’s built-in integrity check against an existing database file.
state_db_filename
state_db_path
thread_history_db_filename
thread_history_db_path

Type Aliases§

DbTelemetryHandle