Skip to content

fix(codex): measure real tool-call duration from item.started#103

Merged
frederikprijck merged 1 commit into
mainfrom
fix/codex-tool-timing
Jul 10, 2026
Merged

fix(codex): measure real tool-call duration from item.started#103
frederikprijck merged 1 commit into
mainfrom
fix/codex-tool-timing

Conversation

@frederikprijck

Copy link
Copy Markdown
Member

Summary

The Codex runner stamped a tool call's startTime inside the item.completed handler, immediately before computing endTime — so every tool call had a ~0s duration regardless of how long it actually ran. This made the Setup Speed dimension meaningless for Codex (active tool time was always ~0).

This captures the start timestamp on item.started (keyed by item id) and uses it as the ToolCallRecord.startTime when the matching item.completed arrives, so the recorded duration reflects the real active window. If an item.started was never seen for an id, it falls back to now (keeping the duration non-negative).

Changes

  • packages/eval/src/runners/codex/agent.ts:
    • Add itemStartTimes: Map<string, number> to the run context.
    • Handle item.started — record the start timestamp per item id.
    • item.completed — look up the captured start time (fallback to now), delete the entry, and pass it as the tool call's startTime.
  • packages/eval/tests/runners/codex-agent.test.ts — tests asserting the duration reflects the started→completed window (other items completing in between advance the clock) and that a missing item.started yields a non-negative duration.

Test plan

  • eval codex-agent tests (35 pass)

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@frederikprijck, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 54eb8fe2-4919-4cbc-820c-c8fa3275cc19

📥 Commits

Reviewing files that changed from the base of the PR and between a950430 and 1e6272c.

📒 Files selected for processing (2)
  • packages/eval/src/runners/codex/agent.ts
  • packages/eval/tests/runners/codex-agent.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/codex-tool-timing

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The Codex runner only handled item.completed, reading both startTime and
endTime inside that handler — so every tool call recorded a ~0s active
duration and Codex effectively always scored ~100 on Setup Speed, unlike
the other three runners. Capture the start timestamp on item.started
(keyed by item id) and use it when the item completes, falling back to now
for items whose start was never observed.
@frederikprijck frederikprijck force-pushed the fix/codex-tool-timing branch from 186e1dd to 1e6272c Compare July 9, 2026 14:16
@frederikprijck frederikprijck merged commit 5330460 into main Jul 10, 2026
6 checks passed
@frederikprijck frederikprijck deleted the fix/codex-tool-timing branch July 10, 2026 08:08
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.

2 participants