-
Notifications
You must be signed in to change notification settings - Fork 7k
Refresh on models etag mismatch #8491
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
base: main
Are you sure you want to change the base?
Conversation
|
@codex review this |
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 fix this |
| let _ = tx_event.send(Ok(ResponseEvent::RateLimits(snapshot))).await; | ||
| } | ||
| if let Some(etag) = models_etag { | ||
| let _ = tx_event.send(Ok(ResponseEvent::ModelsEtag(etag))).await; |
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.
bit annoying to have to push everything through events but that's how it is.
|
|
||
| /// Fetch the latest remote models, using the on-disk cache when still fresh. | ||
| pub async fn refresh_available_models(&self, config: &Config) -> CoreResult<()> { | ||
| pub async fn attempt_refresh_available_models(&self, config: &Config) -> CoreResult<()> { |
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.
can we keep one method? the difference is very subtle. Maybe add a "force" parameter?
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.
or pass etag as the parameter
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.
I feel it's cleaner this way though
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.
there are 3 different public refresh methods with subtly different semantics.
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.
at least name them better
refresh_if_new_etag
refresh_no_cache
refresh
or something similar.
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.
makes sense. will do that
| } | ||
|
|
||
| async fn get_etag(&self) -> Option<String> { | ||
| self.etag.read().await.clone() |
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.
It's not great that etag and models are not updated atomically.
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.
Only one method updates them though
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.
yes, but one value can be updated while the other isn't
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.
ok will see what I can change
| .url | ||
| .query_pairs() | ||
| .any(|(k, _)| k == "client_version"), | ||
| "expected /models refresh to include client_version query param" |
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.
Reminder to decide on how we are sending client_version consistently across endpoints.
|
Summary
Testing
|
ModelsManagertoModelFamilyso we don't mutate it mid-turn