Skip to content

Show goal-started threads in resume lists#21489

Open
etraut-openai wants to merge 3 commits intomainfrom
etraut/goal-resume-metadata-v2
Open

Show goal-started threads in resume lists#21489
etraut-openai wants to merge 3 commits intomainfrom
etraut/goal-resume-metadata-v2

Conversation

@etraut-openai
Copy link
Copy Markdown
Collaborator

Fixes #20792

Why

Threads that start with /goal can have useful user-facing starting metadata even before a normal UserMessage appears. Resume listing currently filters out rollouts unless it sees both session metadata and a user-facing start event, and the state metadata path only sets first_user_message from UserMessage. That made /goal-first sessions resumable by id but invisible in codex resume and Desktop recents.

The earlier approach in #20800 attempted to fix this by materializing a synthetic /goal user message. This PR takes a narrower route: treat the already-emitted ThreadGoalUpdated event as metadata-bearing rollout state and derive the preview from the goal objective.

What changed

  • Persist ThreadGoalUpdated events in the limited rollout stream.
  • Mark goal updates as thread-metadata affecting and synthesize first_user_message from the first non-empty goal objective.
  • Update the filesystem resume scan so a non-empty goal objective satisfies the same discoverability check used for user-message-started threads.

Verification

  • Added coverage for extracting first_user_message from ThreadGoalUpdated.
  • cargo test -p codex-state
  • cargo test -p codex-rollout

Manually confirmed the bug (before) and fix (after).

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Provided git ref refs/pull/21489/head does not exist
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@etraut-openai
Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

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

Stepping back, I’m still not convinced this is the right shape for the fix. The bug is real, but this makes ThreadGoalUpdated behave like a synthetic first user message across persistence, metadata extraction, and listing, which feels like we’re solving a preview/discoverability problem by widening the meaning of first_user_message.

We should probably model the user-facing preview/discoverability bit directly instead of making goal lifecycle events stand in for user input.
What do you think?

| EventMsg::AgentReasoningRawContent(_)
| EventMsg::PatchApplyEnd(_)
| EventMsg::TokenCount(_)
| EventMsg::ThreadGoalUpdated(_)
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.

For the record, this won't backfill previous sessions but it's fine I guess

}
}
}
EventMsg::ThreadGoalUpdated(event) => {
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.

Won't this have an impact on the title? If a reaul user message arrives after the goal, it will now look like a distinct title and start shwoing up as thread name
Maybe I'm wrong though, I can't repro

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.

/goal-first sessions are missing from resume lists

2 participants