mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
## Why Guardian prompts are synthetic review context, but legacy thread metadata can duplicate them in titles, previews, and first messages. Keep SQLite metadata small while retaining rollout JSONL as the canonical record. ## What changed Add a migration for Guardian threads that: - Replaces blank or prompt-derived titles with `Guardian review`. - Preserves nonblank names and distinct nonblank titles, using the title as the name when no name exists. - Sets `preview` to `Approval review` and clears `first_user_message`. ## Testing Add a migration test covering prompt-derived and blank titles, custom titles and names, and unchanged metadata for a non-Guardian worker thread. GitOrigin-RevId: 65b5ff5200a39a19fb11f494de6dca7710ff6cc6
22 lines
823 B
SQL
22 lines
823 B
SQL
-- Guardian prompts are synthetic review context, not user-authored messages.
|
|
-- Keep the SQLite projection small; rollout JSONL remains canonical.
|
|
-- Legacy automatic titles were empty or copied first_user_message; preserve a
|
|
-- different non-empty title because it may have been set explicitly.
|
|
UPDATE threads
|
|
SET title = CASE
|
|
WHEN trim(title) = '' OR trim(title) = trim(first_user_message)
|
|
THEN 'Guardian review'
|
|
ELSE title
|
|
END,
|
|
name = CASE
|
|
WHEN trim(COALESCE(name, '')) != ''
|
|
THEN name
|
|
WHEN trim(title) != ''
|
|
AND trim(title) != trim(COALESCE(first_user_message, ''))
|
|
THEN title
|
|
ELSE 'Guardian review'
|
|
END,
|
|
preview = 'Approval review',
|
|
first_user_message = ''
|
|
WHERE source = '{"subagent":{"other":"guardian"}}';
|