perf(tui): defer startup skills refresh#18370
Merged
fcoury-oai merged 1 commit intomainfrom Apr 17, 2026
Merged
Conversation
Load startup skill metadata through the background app-server request handle so initial TUI rendering is not blocked by `skills/list`. The UI still applies the same result once the request completes.
Contributor
Author
|
@codex review |
etraut-openai
approved these changes
Apr 17, 2026
Collaborator
etraut-openai
left a comment
There was a problem hiding this comment.
Looks good. I built and manually tested.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This removes startup
skills/listfrom the critical path to first input. In release measurements, median startup-to-input time improved from307.5 msto191.0 msacross 30 measured runs with 5 warmups.Background
Startup currently waits for a forced
skills/listapp-server request before scheduling the first usable TUI frame. That makes skill metadata freshness part of the process-launch-to-input path, even though the prompt can safely accept normal input before skill metadata has finished loading.I measured startup from process launch until the TUI reports that the user can type. The measurement harness watched the startup measurement record, killed Codex after a successful sample, and enforced a timeout so repeated runs would not leave TUI processes behind. The debug runs had enough outliers that I used median as the primary signal and ran a baseline self-compare to understand the noise floor.
Why skills/list
The
skills/listcut was the best practical optimization because it improved startup without changing the important readiness contract: when the prompt is shown, it is still backed by an active session. Only enrichment data arrives later.skills/list524.0 msto348.0 ms; release median improved from307.5 msto191.0 ms.thread/start494.0 msto256.0 ms, but the prompt could appear before an active thread was attached.509.0 msto512.0 ms.496.5 msto531.5 ms.Implementation
App::refresh_startup_skillsnow clones the app-server request handle, spawns a background task, and issues the same forcedskills/listrequest after the first frame is scheduled. When the request completes, the task sendsAppEvent::SkillsListLoadedback through the normal app event queue.The existing skills response handling still converts the app-server response, updates the chat widget, and emits invalid
SKILL.mdwarnings. Explicit user-initiated skills refreshes still use the existing synchronous app command path, so callers that intentionally requested fresh skill state do not race ahead of their own refresh.Tradeoffs
The main tradeoff is a narrow theoretical race at startup: skill mention completion depends on a background
skills/listresponse, so it could briefly show stale or empty metadata if opened before that response arrives. In manual testing, pressing$as soon as possible after launch still showed populated skill metadata, so this risk appears minimal in normal use. Plain input remains available immediately, and the UI updates through the existing skills response path once the refresh completes.This PR does not change how skills are discovered, cached, force-reloaded, displayed, enabled, or warned about. It only changes when the startup refresh is allowed to complete relative to the first usable TUI frame.
Verification
cargo test -p codex-tui