Skip to content

[codex] Break down between-sampling overhead - #27115

Closed
aibrahim-oai wants to merge 2 commits into
mainfrom
codex/turn-sampling-phases
Closed

[codex] Break down between-sampling overhead#27115
aibrahim-oai wants to merge 2 commits into
mainfrom
codex/turn-sampling-phases

Conversation

@aibrahim-oai

@aibrahim-oai aibrahim-oai commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • classify between-sampling overhead as post-response, retry, compaction, follow-up, request preparation, or residual work
  • keep committed and pending phase durations in one ledger, derive the parent total from it, and assign millisecond-rounding residue to other
  • commit pending durations only when another sampling request begins, preserving after_last_sampling_ms and excluding tool-blocking time
  • expose the additive breakdown in turn analytics

Semantics

  • phase markers annotate existing control-flow boundaries; they do not add timing guards, explicit drops, or timing-only blocks
  • retry backoff and compaction work remain between-sampling overhead, while model sampling and blocking tool waits retain their existing owners
  • child timings always sum exactly to between_sampling_overhead_ms

Testing

  • just test -p codex-core turn_profile_
  • just test -p codex-analytics
  • just test -p codex-app-server turn_start_tracks_turn_event_analytics
  • just test -p codex-app-server turn_profile_
  • just fix -p codex-core
  • just fix -p codex-analytics
  • just fix -p codex-app-server
  • UV_CACHE_DIR=/tmp/codex-uv-cache just fmt

@aibrahim-oai
aibrahim-oai force-pushed the codex/turn-sampling-phases branch from 0e440c2 to 46dce52 Compare June 9, 2026 03:44
@aibrahim-oai aibrahim-oai changed the title [codex] Break down turn sampling time [codex] Break down between-sampling overhead Jun 9, 2026
@aibrahim-oai
aibrahim-oai force-pushed the codex/turn-sampling-phases branch from 46dce52 to 7c9c053 Compare June 9, 2026 04:19
## Summary
- add optional `comp_hash` metadata to `ModelInfo`
- update `ModelInfo` fixtures for the shared schema change
- keep older model responses compatible by defaulting the field to
`None`

## Why
The models endpoint needs an opaque identifier for compaction-compatible
model configurations. This PR only exposes that value in model metadata;
it does not add it to turn context or change runtime behavior.

Follow-up #27520 carries the value through turn context and rollouts,
then uses it to trigger compaction.

## Stack
- based on #27115
- functionality follow-up: #27520

## Testing
- `just test -p codex-protocol
model_info_defaults_availability_nux_to_none_when_omitted`
- `just fix -p codex-core -p codex-protocol -p codex-analytics -p
codex-models-manager`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant