Conversation
aibrahim-oai
approved these changes
Apr 2, 2026
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.
Why
This continues the compile-time cleanup from #16630.
SessionTaskimplementations are monomorphized, butSessionstores the task behind adynboundary so it can drive and abort heterogenous turn tasks uniformly. That means we can move the#[async_trait]expansion off the implementation trait, keep a small boxed adapter only at the storage boundary, and preserve the existing task lifecycle semantics while reducing the amount of generated async-trait glue incodex-core.One measurement caveat showed up while exploring this: a warm incremental benchmark based on
touch core/src/tasks/mod.rs && cargo check -p codex-core --libwas basically flat, but that was the wrong benchmark for this change. Using package-cleancodex-corerebuilds, like #16630, shows the real win.Relevant pre-change code:
SessionTaskwith#[async_trait]RunningTaskstoringArc<dyn SessionTask>What changed
SessionTask::{run, abort}to native RPITIT futures with explicitSendbounds.AnySessionTaskadapter that boxes those futures only at theArc<dyn ...>storage boundary.RunningTaskto storeArc<dyn AnySessionTask>and removed#[async_trait]from the concrete task impls plus test-onlySessionTaskimpls.Timing
Benchmarked package-clean
codex-corerebuilds with dependencies left warm:totalrealgenerate_crate_metadataMIR_borrow_checkingmonomorphization_collector_graph_walk3c7f013f97352cafd783ac22For completeness, the warm touched-file benchmark stayed flat (
1.96sparent vs1.97sthis PR), which is why that benchmark should not be used to evaluate this refactor.Verification
cargo test -p codex-core; this change compiled and task-related tests passed before hitting the same unrelated 5config::tests::*guardian*failures already present on the parent stack.