fix: finalize the Stop hook target turn - #71
Open
tutar wants to merge 1 commit into
Open
Conversation
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.
Summary
turn_idfrom the Stop-hook payload as the turn that has stoppedWhy
Codex can invoke the Stop hook before it appends the matching
task_completeevent, and persist that event only after the hook process exits. The current implementation can therefore export an incomplete turn without recording it in the sidecar. A later invocation exports the completed turn again. Simply deferring incomplete turns prevents that duplicate but permanently loses the final turn when no later Stop hook runs.The Stop payload already identifies the exact stopped turn. This change uses that signal only for the named turn; arbitrary incomplete turns remain suppressed.
The corrected lifecycle was reproduced and production-verified in tutar#1.
Verification
tsc --noEmittsdown --config plugins/tracing/tsdown.config.tsRelated upstream work
Fixes #46.
Related to #12 and #65. This covers both halves of the lifecycle that are handled separately or incompletely by #17, #31, and #50.