mirror of
https://github.com/openai/codex.git
synced 2026-05-22 03:54:18 +00:00
## Why Thread goals are moving toward extension-owned runtime behavior, but their persisted state was still stored in the shared state database. This makes the goal store harder to isolate and keeps future storage splits tied to ad hoc runtime plumbing. This PR gives goals their own SQLite database while keeping the existing `StateRuntime` entry point. The goal is to make this the pattern for adding more dedicated runtime databases later. This also reduce load on existing DB and reduce contention ## Limitation Thread preview from goal is not supported anymore. I'm looking into this [EDIT]: solved ## What changed - Added a dedicated `goals_1.sqlite` database with its own `goals_migrations` directory. - Moved `thread_goals` creation into the goals DB migration set. - Dropped the old `thread_goals` table from the main state DB with a normal state migration. There is intentionally no backfill for existing goal rows. - Changed `GoalStore` to be backed only by the goals DB pool. - Removed the old goal-write side effect that filled empty `threads.preview` values from the goal objective. - Added shared runtime DB path metadata so startup, telemetry, `codex doctor`, and repair handling can include future DBs without bespoke path lists. - Updated Bazel compile data so the new goals migration directory is available to `sqlx::migrate!`. ## Verification - `cargo check --tests -p codex-state -p codex-cli -p codex-core -p codex-app-server` - `just fix -p codex-state` - `just fix -p codex-cli` - `just fix -p codex-app-server`
19 lines
495 B
SQL
19 lines
495 B
SQL
CREATE TABLE thread_goals (
|
|
thread_id TEXT PRIMARY KEY NOT NULL,
|
|
goal_id TEXT NOT NULL,
|
|
objective TEXT NOT NULL,
|
|
status TEXT NOT NULL CHECK(status IN (
|
|
'active',
|
|
'paused',
|
|
'blocked',
|
|
'usage_limited',
|
|
'budget_limited',
|
|
'complete'
|
|
)),
|
|
token_budget INTEGER,
|
|
tokens_used INTEGER NOT NULL DEFAULT 0,
|
|
time_used_seconds INTEGER NOT NULL DEFAULT 0,
|
|
created_at_ms INTEGER NOT NULL,
|
|
updated_at_ms INTEGER NOT NULL
|
|
);
|