Skip to content

app-server: keep the model cache warm#28699

Merged
jif-oai merged 2 commits into
mainfrom
jif/keep-model-hot
Jun 17, 2026
Merged

app-server: keep the model cache warm#28699
jif-oai merged 2 commits into
mainfrom
jif/keep-model-hot

Conversation

@jif-oai

@jif-oai jif-oai commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Why

The app server is long-lived, but its shared model cache otherwise refreshes only when a caller needs it. Once the five-minute cache expires, starting a thread or calling model/list can wait for /models on the request path.

Refresh the cache in the background before it expires so foreground callers normally use fresh local state.

What changed

  • Start an app-server worker that refreshes models immediately and then every three minutes using the existing models-manager API.
  • Hold only a weak reference to the models manager between refreshes, so the worker does not extend its lifetime.
  • Stop scheduling refreshes when the app-server lifecycle handle is shut down or dropped. A refresh already in progress is allowed to finish.
  • Adjust affected app-server test fixtures to distinguish the background /models probe from the connection they are testing.

The existing models-manager cache, refresh strategies, auth handling, ETag behavior, and concurrency semantics are unchanged.

Testing

  • models_refresh_worker::tests::refreshes_immediately_periodically_and_stops_when_dropped
  • suite::v2::remote_control::listen_off_honors_persisted_remote_control_enable
  • suite::v2::attestation::attestation_generate_round_trip_adds_header_to_responses_websocket_handshake

@jif-oai jif-oai changed the title feat: keep cache model hot app-server: keep the model cache warm Jun 17, 2026

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

Copy link
Copy Markdown
Contributor

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.

Reviewed commit: e76d6a83fa

ℹ️ 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 thread codex-rs/app-server/src/message_processor.rs Outdated
Comment thread codex-rs/app-server/src/models_refresh_worker_tests.rs Outdated
Comment thread codex-rs/app-server/src/models_refresh_worker.rs
Comment thread codex-rs/app-server/src/models_refresh_worker.rs Outdated
@jif-oai
jif-oai requested a review from a team as a code owner June 17, 2026 12:27
@jif-oai
jif-oai force-pushed the jif/keep-model-hot branch from 8b7d9ab to eb8f8e8 Compare June 17, 2026 13:04
@jif-oai jif-oai changed the title app-server: keep the model cache warm app-server: refresh the model catalog off the request path Jun 17, 2026
@jif-oai

jif-oai commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@jif-oai
jif-oai force-pushed the jif/keep-model-hot branch from eb8f8e8 to 35e5d6b Compare June 17, 2026 13:20
@jif-oai
jif-oai force-pushed the jif/keep-model-hot branch from 35e5d6b to 8d81430 Compare June 17, 2026 13:39
@jif-oai jif-oai changed the title app-server: refresh the model catalog off the request path app-server: keep the model cache warm Jun 17, 2026
@jif-oai
jif-oai enabled auto-merge (squash) June 17, 2026 13:47
@jif-oai
jif-oai disabled auto-merge June 17, 2026 14:18
@jif-oai
jif-oai merged commit 5935a90 into main Jun 17, 2026
30 of 32 checks passed
@jif-oai
jif-oai deleted the jif/keep-model-hot branch June 17, 2026 14:18
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants