mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Route pet asset downloads through the shared HTTP client (#36008)
## Why Built-in pet downloads used a standalone blocking client, so CDN redirects did not use Codex's configured route handling. ## What changed - Download pet spritesheets asynchronously with a reusable `RouteAwareClientPool`. - Keep cache validation, asset installation, and pet decoding off the async runtime while sharing one asset-and-load path across startup, previews, and selection. - Preserve the download size limit while consuming streamed response chunks, and remove the TUI's direct `reqwest` dependency. ## Testing Add coverage for oversized response chunks, cached built-in assets, pet loads without an existing Tokio runtime, and stale preview and selection completions. GitOrigin-RevId: 725e76f3ddb7e84b7212769892f28dc0add15741
This commit is contained in:
1 parent
ad6fc66b6d
commit
09cf609218
11 files changed
+293
-95
No files matched your search
@@ -82,18 +82,18 @@ impl App {
|
||||
let frame_requester = tui.frame_requester();
|
||||
let animations_enabled = self.config.animations;
|
||||
let tx = self.app_event_tx.clone();
|
||||
std::mem::drop(tokio::task::spawn_blocking(move || {
|
||||
let result = crate::pets::ensure_builtin_pack_for_pet(&pet_id, &codex_home)
|
||||
.and_then(|()| {
|
||||
crate::pets::AmbientPet::load(
|
||||
Some(&pet_id),
|
||||
&codex_home,
|
||||
frame_requester,
|
||||
animations_enabled,
|
||||
)
|
||||
})
|
||||
.map(Some)
|
||||
.map_err(|err| err.to_string());
|
||||
let pet_http_client = self.chat_widget.pet_http_client.clone();
|
||||
std::mem::drop(tokio::spawn(async move {
|
||||
let result = crate::pets::load_pet_with_assets(
|
||||
pet_id.clone(),
|
||||
codex_home,
|
||||
frame_requester,
|
||||
animations_enabled,
|
||||
&pet_http_client,
|
||||
)
|
||||
.await
|
||||
.map(Some)
|
||||
.map_err(|err| err.to_string());
|
||||
tx.send(AppEvent::PetSelectionLoaded {
|
||||
request_id,
|
||||
pet_id,
|
||||
|
||||
Reference in new issue
Block a user