-
Notifications
You must be signed in to change notification settings - Fork 6.7k
fix: thread/list returning fewer than the requested amount due to filtering CXA-293 #7509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
3192da2 to
fc620ac
Compare
fc620ac to
4253c31
Compare
|
@codex review |
There was a problem hiding this 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".
|
@codex review |
There was a problem hiding this 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 can you please add more detail to the PR body as this code change is larger than I expect given the description |
b2f35cc to
a063271
Compare
@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! |
|
@codex review |
There was a problem hiding this 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".
09f9764 to
64affe5
Compare
|
@codex review |
There was a problem hiding this 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".
64affe5 to
78c9ab5
Compare
|
@codex review |
There was a problem hiding this 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".
| 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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 👍 / 👎.
There was a problem hiding this comment.
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.
bolinfest
left a comment
There was a problem hiding this 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!
| 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, | ||
| }); | ||
| } | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protip
| 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, | |
| })?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, thank you!
…tering This caused some conversations to not appear when they otherwise should.
78c9ab5 to
e65c6d5
Compare
This is the only outstanding one: #7509 (comment) do you agree with my response? Happy to change the behavior though. |
This caused some conversations to not appear when they otherwise should.
Prior to this change,
thread/list/list_conversations_commonwould:RolloutRecorder::list_conversationsmodel_providers)With this change:
list_conversations_commonnow continues fetching more conversations fromRolloutRecorder::list_conversationsuntil it "fills up" therequested_page_size.