Reduce idle Codex adapter CPU usage - #1192
Merged
Merged
Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
/clearrebindingMotivation
A live sample of an idle
construct __adapter codexprocess showed CPU in recursive rollout discovery and whole-fileread_to_stringcalls. On this machine, 28 Codex adapters consumed roughly 33–36% of one core in aggregate. The rollout store contains 2,120 files / 1.0 GB; one sampled adapter reread an 18.9 MB root transcript multiple times per second while idle.After this change, idle root and child transcripts cost a file-length metadata check with no content read. Directory discovery normally stats the 68 rollout directories and only enumerates a directory whose entries changed; the 10-second full enumeration backstop handles coarse or coalesced timestamps.
Verification
cargo test -p construct-adapter-codex— 31 passedcargo clippy -p construct-adapter-codex --all-targets --no-deps -- -D warnings -A clippy::too_many_argumentscargo buildNo screenshot or recording: this is an internal adapter performance change with no UI difference.