Repository navigation
fix: end a Codex turn when its task completes, not at the next prompt - #371
Open
Mark Warren (ZeSnarf) wants to merge 1 commit into
Open
Mark Warren (ZeSnarf) wants to merge 1 commit into
Mark Warren (ZeSnarf) wants to merge 1 commit into
Conversation
A Codex turn's totalElapsed ran from the prompt to the last line before the next prompt, so the time the user spent away between turns counted as the agent working: a 30-second answer read the next morning became a ten-hour turn. The turn now ends at task_complete or turn_aborted; work Codex logs after that extends the turn to that work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-actions
Bot
requested review from
TamasBoncz,
Aymen (aymenfurter) and
Sanjay Singh (san360)
November 3, 2026 21:25
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.
Description
A Codex turn's
totalElapsedran from the prompt to the last line logged before the next prompt. That line is often the next turn'stask_started, so the time between turns counted as agent time. A 30-second answer followed by a prompt the next morning became a ten-hour turn, which inflated slow-response findings and turn-duration charts.This PR:
task_completeorturn_aborted) and measurestotalElapsedto that point;task_complete, so late work stays in the turn;CACHE_VERSION.We found this by running the extension on real Codex logs, where turns spanning an overnight gap showed up as hours-long agent runs.
Related Issues
None filed.
Checklist
npm run checkpasses (typecheck + lint + spellcheck + knip + tests)parser-codex.test.ts: a turn ended bytask_complete, one ended byturn_aborted, and work logged aftertask_complete)