zhuddan (Discord, Codex app 26.1023): a Codex conversation deleted in magpie went on showing in the Codex app. The app lists threads from its own catalog, <CODEX_HOME>/sqlite/codex.db (codex-dev.db for a non-prod build), table local_thread_catalog, and drops a row only on the app-server's thread/deleted or thread/archived. After its first full sweep it takes in only threads newer than its watermark, so a row of a thread whose rollout magpie moved to its trash stayed. Delete now does what the app does on thread/deleted: the local host's rows of threads whose rollout is gone from that Codex folder's sessions and archived_sessions (as Codex's state database names them; neither the file nor its packed twin there, and a file that can't be looked at counts as there) are deleted and catalog_revision raised, in one BEGIN IMMEDIATE transaction that waits for the app's own. The rows go into the trash note (codex_catalog) and Restore puts them back, since the app wouldn't take in a thread that old by itself. /api/sessions/manage does the same once a run (TidyCodexCatalog) for threads deleted before this release. Run (Windows, win-run, go1.26.8): - go test -count=1 -v -timeout 25m ./internal/sessions/: 339 PASS, including TestDeleteForgetsCodexAppCatalog, TestTidyCodexCatalogForgetsEarlierDeletes and TestTidyCodexCatalogKeepsWhatItCantJudge. Red: TestAgySessions, TestAgyRowOnly (#4115), TestOneListing and TestShareListing hanging the package (#4114). The same four are red at origin/mainbc247a8ccon the same box, run alone. A second run also had TestPurgeOne, TestPurgeAll, TestUnchangedPackedNotReadAgain red and TestReadNotHeldByAnotherRead hanging, and internal/gui TestGatewaySessionHistoryAndCalendar red; all the same atbc247a8cc(#4177). After the rebase onto origin/main (mote, go test -count=1 ./internal/sessions/ ./internal/gui/): sessions ok; gui red only in ten AppKit window tests killed at 30s (TestPanelCloseHidesIt, TestMainWindowCorners and others), mote's pboard being down (#4125). Broken by hand: forgetCodexCatalog returning nothing turns TestDeleteForgetsCodexAppCatalog and TestTidyCodexCatalogForgetsEarlierDeletes red. Not tried: the real Codex app (its catalog is in the owner's live ~/.codex, which sessions never touch); the schemas in testdata are Codex 26.1023's.
77 lines
3.5 KiB
SQL
77 lines
3.5 KiB
SQL
-- The Codex app's catalog tables in <CODEX_HOME>/sqlite/codex.db, as its migrations made them (codex_schema_migrations up to legacy_0034, app 26.901 to 26.1023): sqlite3 .schema
|
|
CREATE TABLE IF NOT EXISTS "local_thread_catalog" (
|
|
host_id TEXT NOT NULL,
|
|
thread_id TEXT NOT NULL,
|
|
display_title TEXT NOT NULL,
|
|
source_created_at REAL NOT NULL,
|
|
source_updated_at REAL NOT NULL,
|
|
cwd TEXT,
|
|
source_kind TEXT NOT NULL,
|
|
source_detail TEXT,
|
|
model_provider TEXT,
|
|
git_branch TEXT,
|
|
observation_sequence INTEGER NOT NULL,
|
|
missing_candidate INTEGER NOT NULL DEFAULT 0
|
|
CHECK (missing_candidate IN (0, 1)),
|
|
thread_source TEXT,
|
|
source_recency_at REAL NOT NULL DEFAULT 0,
|
|
pending_observed_title INTEGER NOT NULL DEFAULT 0,
|
|
project_id TEXT,
|
|
conversation_origin TEXT, trial_conversation_type TEXT, chatgpt_async_status INTEGER,
|
|
PRIMARY KEY (host_id, thread_id)
|
|
);
|
|
CREATE INDEX local_thread_catalog_updated_idx
|
|
ON local_thread_catalog (
|
|
host_id, source_recency_at DESC, source_created_at DESC, thread_id
|
|
) WHERE missing_candidate = 0;
|
|
CREATE INDEX local_thread_catalog_created_idx
|
|
ON local_thread_catalog (
|
|
host_id, source_created_at DESC, source_updated_at DESC, thread_id
|
|
) WHERE missing_candidate = 0;
|
|
CREATE INDEX local_thread_catalog_cwd_updated_idx
|
|
ON local_thread_catalog (
|
|
host_id, cwd, source_recency_at DESC, source_created_at DESC,
|
|
thread_id
|
|
) WHERE missing_candidate = 0;
|
|
CREATE INDEX local_thread_catalog_cwd_created_idx
|
|
ON local_thread_catalog (
|
|
host_id, cwd, source_created_at DESC, source_updated_at DESC,
|
|
thread_id
|
|
) WHERE missing_candidate = 0;
|
|
CREATE INDEX local_thread_catalog_thread_lookup_idx
|
|
ON local_thread_catalog (
|
|
thread_id, source_recency_at DESC, source_created_at DESC, host_id
|
|
) WHERE missing_candidate = 0;
|
|
CREATE INDEX local_thread_catalog_project_updated_idx
|
|
ON local_thread_catalog (
|
|
host_id, project_id, source_recency_at DESC,
|
|
source_created_at DESC, thread_id
|
|
) WHERE missing_candidate = 0;
|
|
CREATE INDEX local_thread_catalog_origin_updated_idx
|
|
ON local_thread_catalog (
|
|
host_id, conversation_origin, source_recency_at DESC,
|
|
source_created_at DESC, thread_id
|
|
) WHERE missing_candidate = 0;
|
|
CREATE TABLE IF NOT EXISTS "local_thread_catalog_hosts" (
|
|
host_id TEXT PRIMARY KEY,
|
|
host_kind TEXT NOT NULL CHECK (
|
|
host_kind IN ('local', 'ssh', 'wsl', 'remote-control', 'chatgpt')
|
|
)
|
|
);
|
|
CREATE TABLE local_thread_catalog_metadata (
|
|
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
catalog_revision INTEGER NOT NULL DEFAULT 0
|
|
);
|
|
CREATE TABLE local_thread_catalog_sync_state (
|
|
host_id TEXT PRIMARY KEY,
|
|
watermark_updated_at REAL,
|
|
initial_build_complete INTEGER NOT NULL DEFAULT 0,
|
|
observation_sequence INTEGER NOT NULL DEFAULT 0
|
|
, last_full_reconciled_at INTEGER);
|
|
CREATE TABLE local_thread_catalog_scan_entries (
|
|
host_id TEXT NOT NULL,
|
|
thread_id TEXT NOT NULL,
|
|
removed INTEGER NOT NULL DEFAULT 0,
|
|
PRIMARY KEY (host_id, thread_id)
|
|
) WITHOUT ROWID;
|