Skip to content

Conversation

@JaviSoto
Copy link
Contributor

@JaviSoto JaviSoto commented Dec 3, 2025

This caused some conversations to not appear when they otherwise should.

Prior to this change, thread/list/list_conversations_common would:

  • Fetch N conversations from RolloutRecorder::list_conversations
  • Then it would filter those (like by the provided model_providers)
  • This would make it potentially return less than N items.

With this change:

  • list_conversations_common now continues fetching more conversations from RolloutRecorder::list_conversations until it "fills up" the requested_page_size.
  • Ultimately this means that clients can rely on getting eg 20 conversations if they request 20 conversations.

@JaviSoto JaviSoto force-pushed the dev/javi/thread-list-count branch from 3192da2 to fc620ac Compare December 3, 2025 00:55
@JaviSoto JaviSoto marked this pull request as ready for review December 3, 2025 01:52
@ambrosino-oai ambrosino-oai changed the title fix: thread/list returning fewer than the requested amount due to filtering fix: thread/list returning fewer than the requested amount due to filtering CXA-293 Dec 3, 2025
@JaviSoto JaviSoto force-pushed the dev/javi/thread-list-count branch from fc620ac to 4253c31 Compare December 8, 2025 18:35
@etraut-openai
Copy link
Collaborator

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

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

@JaviSoto
Copy link
Contributor Author

JaviSoto commented Dec 9, 2025

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

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

@bolinfest
Copy link
Collaborator

@JaviSoto can you please add more detail to the PR body as this code change is larger than I expect given the description

@JaviSoto JaviSoto force-pushed the dev/javi/thread-list-count branch 2 times, most recently from b2f35cc to a063271 Compare December 9, 2025 23:19
@JaviSoto
Copy link
Contributor Author

@JaviSoto can you please add more detail to the PR body as this code change is larger than I expect given the description

@bolinfest totally fair! The diff looks a lot worse because of the test changes. It may be easier to review commit-by-commit and hiding whitespace changes. I updated the description too, let me know if that's enough detail or I can elaborate on it!

@JaviSoto
Copy link
Contributor Author

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

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

@JaviSoto JaviSoto force-pushed the dev/javi/thread-list-count branch 4 times, most recently from 09f9764 to 64affe5 Compare December 10, 2025 01:56
@JaviSoto
Copy link
Contributor Author

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

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

@JaviSoto JaviSoto force-pushed the dev/javi/thread-list-count branch from 64affe5 to 78c9ab5 Compare December 10, 2025 19:33
@JaviSoto
Copy link
Contributor Author

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

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

Comment on lines +1894 to +1893
let next_cursor_value = page.next_cursor.clone();
next_cursor = next_cursor_value
.as_ref()
.and_then(|cursor| serde_json::to_value(cursor).ok())
.and_then(|value| value.as_str().map(str::to_owned));
Copy link
Contributor

Choose a reason for hiding this comment

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

P2 Badge Clear next_cursor when no further threads exist

list_conversations_common always forwards the cursor from the last page even after the requested page size has been satisfied. RolloutRecorder::list_conversations marks next_cursor as soon as a page fills (see core/src/rollout/list.rs where more_matches_available is set when items.len() == page_size), so a request that matches exactly limit conversations—e.g., three threads for a single provider when only three exist—returns a non-null next_cursor despite there being no additional results. Clients will keep paginating and receive an empty page, which contradicts the API contract that nextCursor should be None once results are exhausted.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looked into this, and if that happens, you just request more with that cursor and then get an empty array, which is fine, and it seems that changing that behavior will just add more complexity so I think this is fine.

Copy link
Collaborator

@bolinfest bolinfest left a comment

Choose a reason for hiding this comment

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

Please make sure all outstanding comments from codex review bot are addressed!

Comment on lines 1851 to 1869
let page = match RolloutRecorder::list_conversations(
&self.config.codex_home,
page_size,
cursor_obj.as_ref(),
INTERACTIVE_SESSION_SOURCES,
model_provider_filter.as_deref(),
fallback_provider.as_str(),
)
.await
{
Ok(p) => p,
Err(err) => {
return Err(JSONRPCErrorError {
code: INTERNAL_ERROR_CODE,
message: format!("failed to list conversations: {err}"),
data: None,
});
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

protip

Suggested change
let page = match RolloutRecorder::list_conversations(
&self.config.codex_home,
page_size,
cursor_obj.as_ref(),
INTERACTIVE_SESSION_SOURCES,
model_provider_filter.as_deref(),
fallback_provider.as_str(),
)
.await
{
Ok(p) => p,
Err(err) => {
return Err(JSONRPCErrorError {
code: INTERNAL_ERROR_CODE,
message: format!("failed to list conversations: {err}"),
data: None,
});
}
};
let page = match RolloutRecorder::list_conversations(
&self.config.codex_home,
page_size,
cursor_obj.as_ref(),
INTERACTIVE_SESSION_SOURCES,
model_provider_filter.as_deref(),
fallback_provider.as_str(),
)
.await.map_err(|err| Err(JSONRPCErrorError {
code: INTERNAL_ERROR_CODE,
message: format!("failed to list conversations: {err}"),
data: None,
})?;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated, thank you!

@JaviSoto JaviSoto force-pushed the dev/javi/thread-list-count branch from 78c9ab5 to e65c6d5 Compare December 10, 2025 22:51
@JaviSoto
Copy link
Contributor Author

Please make sure all outstanding comments from codex review bot are addressed!

This is the only outstanding one: #7509 (comment) do you agree with my response? Happy to change the behavior though.

@JaviSoto JaviSoto enabled auto-merge (squash) December 10, 2025 22:52
@JaviSoto JaviSoto merged commit e2559ab into main Dec 10, 2025
26 checks passed
@JaviSoto JaviSoto deleted the dev/javi/thread-list-count branch December 10, 2025 23:06
@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2025
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.

4 participants