Skip to content

Show /goal-started threads in resume picker#20800

Closed
etraut-openai wants to merge 7 commits into
mainfrom
etraut/goal-resume-thread-bug
Closed

Show /goal-started threads in resume picker#20800
etraut-openai wants to merge 7 commits into
mainfrom
etraut/goal-resume-thread-bug

Conversation

@etraut-openai

@etraut-openai etraut-openai commented May 2, 2026

Copy link
Copy Markdown
Collaborator

Addresses #20792

Why

Starting a new thread with /goal <objective> creates goal state, but it can happen before the lazily-created thread has a rollout file or first user message. The resume picker relies on the existing thread listing/preview path, so these goal-started threads were invisible until the user first sent a normal prompt.

What changed

  • Materialize the running lazy thread before setting a new goal objective, so the rollout exists on disk for resume discovery.
  • If the thread does not already have a first user message, append and flush a /goal <objective> user message so existing preview/listing logic can surface the thread.
  • Leave threads that already have user history unchanged.

Alternative considered

Another viable fix would be to treat goals as resumable metadata in the listing stack: include thread_goals rows whose threads.first_user_message is empty, merge those metadata-only rows through codex-rollout and codex-thread-store, and derive the resume preview from the goal objective.

That keeps the goal command out of rollout history, but it couples goal state into the core list/read pagination paths and requires new preview hydration logic outside the goal feature. This PR keeps the existing resume contract instead: a resumable thread has a materialized rollout and a first-user-message preview. The extra work is localized to thread/goal/set and only runs when a goal objective is set on a running thread.

@etraut-openai etraut-openai force-pushed the etraut/goal-resume-thread-bug branch from b5c12d6 to 4574639 Compare May 4, 2026 02:45

@jif-oai jif-oai left a comment

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.

I don’t think we should fix this by writing a fake /goal ... user message into the rollout. That solves the resume-picker symptom, but it does it by forging synthetic transcript history, and that leaks into a bunch of other behavior... (history, title, state, ...). TBH I'm not convinced this is the good layer to patch this

Comment thread codex-rs/app-server/src/codex_message_processor/thread_goal_handlers.rs Outdated
Comment thread codex-rs/app-server/src/request_processors/thread_goal_processor.rs
Comment thread codex-rs/app-server/src/codex_message_processor/thread_goal_handlers.rs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants