Skip to content

Fix goal-first live threads missing from thread/list#28808

Merged
etraut-openai merged 4 commits into
mainfrom
etraut/goal-first-thread-list
Jun 18, 2026
Merged

Fix goal-first live threads missing from thread/list#28808
etraut-openai merged 4 commits into
mainfrom
etraut/goal-first-thread-list

Conversation

@etraut-openai

@etraut-openai etraut-openai commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Fixes #28263.

Why

When a thread starts with /goal, the goal extension can update SQLite goal state before the thread has any user-turn rollout items. thread/list and thread/search rely on persisted listing metadata, so a goal-first live thread could be absent from app-server listings after restart even though the goal itself existed.

This regressed when goal handling moved out of core: the core path wrote the goal update through the live thread rollout path, while the extension-backed app-server path only updated goal state and emitted the live notification.

What

  • Add GoalSetOutcome::thread_goal_updated_item() so the goal extension owns the canonical ThreadGoalUpdated rollout item shape.
  • Expose a narrow CodexThread::append_rollout_items() helper that appends through the live thread and keeps derived SQLite metadata in sync.
  • When app-server sets a goal on an active live thread, persist the goal update through that live-thread path.
  • Add an app-server regression test that starts a live thread with thread/goal/set and verifies it appears in state-DB-only thread/list.

Verification

  • env -u CODEX_SQLITE_HOME just test -p codex-app-server goal_first_live_thread_appears_in_state_db_thread_list

@etraut-openai etraut-openai changed the title Fix goal-first threads in thread/list Fix goal-first live threads missing from thread/list Jun 17, 2026
if self.thread_manager.get_thread(thread_id).await.is_ok()
&& let Err(err) = self
.thread_store
.append_items(AppendThreadItemsParams {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we persist this through the live session’s metadata-aware path? Raw ThreadStore::append_items skips ThreadMetadataSync, so state-DB-only op such as list/search still miss this thread

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I was trying to avoid exporting a new function from ThreadStore, but it looks like that may be necessary here.

@etraut-openai etraut-openai requested a review from a team as a code owner June 18, 2026 16:09
@etraut-openai etraut-openai merged commit e8dd1b4 into main Jun 18, 2026
45 of 47 checks passed
@etraut-openai etraut-openai deleted the etraut/goal-first-thread-list branch June 18, 2026 17:50
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/goal-first sessions can still be omitted from codex resume when preview metadata stays empty

2 participants