Skip to content

Conversation

@bolinfest
Copy link
Collaborator

@bolinfest bolinfest commented Oct 24, 2025

Prior to this change, spawn_conversation() would call finalize_spawn():

self.finalize_spawn(codex, conversation_id).await

which would then categorically insert the conversation into self.conversations:

self.conversations
.write()
.await
.insert(conversation_id, conversation.clone());

but this is potentially problematic because the resuming the same conversation could potentially be requested multiple times over the lifetime of the app server.

This updates the business logic to return the existing conversation, if appropriate.

@bolinfest
Copy link
Collaborator Author

@codex please review

} = Codex::spawn(config, auth_manager, initial_history, self.session_source).await?;
self.finalize_spawn(codex, conversation_id).await
if let InitialHistory::Resumed(resumed) = &initial_history
&& let Some(existing) = self
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, I don't love that we do the read() here and on that basis do the write() later, as that means there is still time between these two events for the conversation to be inserted twice?

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Keep them coming!

ℹ️ 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".

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