Repository navigation
fix(codex): compare the v7 millisecond timestamp, not the full UUID, in the fork-replay gate #735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8007961
fix(codex): compare the v7 millisecond timestamp, not the full UUID, …
Nanako0129 13b1be9
fix(codex): disambiguate same-millisecond fork turns via task_started
Nanako0129 212f13b
fix(codex): count same-millisecond user-fork own turns without task_s…
Nanako0129 d1e712f
docs(codex): document accepted same-ms user-fork residual + lock its …
junhoyeo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a forked log has replayed parent metadata and the child's first real
turn_contextshares the UUID-v7 millisecond prefix with the childsession_meta, this equal-prefix branch now only closes the replay skip if atask_startedwas observed. The parser already supports user fork logs that haveforked_from_id/thread_source:"user"without anytask_started, so in that same-ms caseforked_child_waiting_for_turn_contextnever clears and the child's subsequenttoken_countrows are skipped, making the fork's own usage disappear.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch — fixed in 212f13b. The
task_started-only discriminator did break the same-millisecond user-fork case:thread_source:"user"forks never emit atask_started, so the equal-prefix branch never closed the skip and the child's owntoken_countrows were dropped.A user fork's replayed parent turns carry the parent session's millisecond prefix, not the child's, so they sort strictly earlier and never reach the equal-prefix branch; reaching it already means the turn shares the child's fork millisecond and is the child's own turn. The fix tracks whether the active fork is a user fork (
CodexParseState.forked_child_is_user_fork, set fromthread_source) and, in the equal-prefix case, ends the skip for a user fork even without atask_started. Subagent forks still require thetask_starteddiscriminator, so the same-millisecond over-count guard from the previous commit is unchanged. Bumped the cache schema to 22 for the new state field.Added
test_user_forked_child_same_millisecond_own_turn_counts_without_task_started, which fails before the change (0 messages instead of 1). Fulltokscale-coresuite stays green (962) andclippy --all-targetsis clean.