fix(parallel): invoke onPatchesGenerated callback in parallel execution#167
Merged
fix(parallel): invoke onPatchesGenerated callback in parallel execution#167
Conversation
The runMultiTurnForItems function (parallel execution path) was not calling the onPatchesGenerated callback, while the serial path did. This prevented consumers from observing patches and stats (including turnStats.prompts) when parallel execution was enabled, breaking features like token composition tracking that depend on prompt data. The fix adds the callback invocation after agent response and before applying patches, matching the serial path behavior at line 729. Impact: - onPatchesGenerated now fires for all execution modes - turnStats.prompts is now accessible in parallel execution - Enables token breakdown and other observability features Related: The callback was introduced for observability but the parallel path was missing the invocation when parallel execution was implemented. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Contributor
Coverage Report for packages/markform
File Coverage
|
||||||||||||||||||||||||||||||||||||||
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.
Problem
The
runMultiTurnForItemsfunction (parallel execution path) was not calling theonPatchesGeneratedcallback, while the serial path did (line 729).This prevented consumers from observing patches and stats (including
turnStats.prompts) when parallel execution was enabled, breaking features like token composition tracking that depend on prompt data.Solution
Added the callback invocation after agent response and before applying patches, matching the serial path behavior.
Impact
onPatchesGeneratednow fires for all execution modes (serial and parallel)turnStats.promptsis now accessible in parallel executionTesting
Related
The callback was introduced for observability but the parallel path was missing the invocation when parallel execution was implemented.