fix: retry enricher when tool-call found but result not yet written - #2
Merged
Conversation
Adds a retry when readToolCallBlob returns a non-null object with result: null — which happens when the tool-call blob is present but the paired tool-result hasn't been flushed yet. Previously the retry loop was only entered when the blob was missing entirely (null). Also returns the best partial result (args populated) on timeout instead of null, so callers get at least the tool name and args. Two new tests cover both the race-condition recovery and the timeout-fallback behaviour.
antonvp
added a commit
that referenced
this pull request
Apr 3, 2026
Adds a retry when readToolCallBlob returns a non-null object with result: null — which happens when the tool-call blob is present but the paired tool-result hasn't been flushed yet. Previously the retry loop was only entered when the blob was missing entirely (null). Also returns the best partial result (args populated) on timeout instead of null, so callers get at least the tool name and args. Two new tests cover both the race-condition recovery and the timeout-fallback behaviour. Co-authored-by: Anton Pavlov <anton@loris.ai>
antonvp
added a commit
that referenced
this pull request
Apr 3, 2026
Adds a retry when readToolCallBlob returns a non-null object with result: null — which happens when the tool-call blob is present but the paired tool-result hasn't been flushed yet. Previously the retry loop was only entered when the blob was missing entirely (null). Also returns the best partial result (args populated) on timeout instead of null, so callers get at least the tool name and args. Two new tests cover both the race-condition recovery and the timeout-fallback behaviour. Co-authored-by: Anton Pavlov <anton@loris.ai>
antonvp
added a commit
that referenced
this pull request
Apr 3, 2026
Adds a retry when readToolCallBlob returns a non-null object with result: null — which happens when the tool-call blob is present but the paired tool-result hasn't been flushed yet. Previously the retry loop was only entered when the blob was missing entirely (null). Also returns the best partial result (args populated) on timeout instead of null, so callers get at least the tool name and args. Two new tests cover both the race-condition recovery and the timeout-fallback behaviour.
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.
TL;DR
Fixes a race condition where
enrich()returnednullfor the result even when the tool-call was found instore.db. Cursor fires the ACP "completed" event before flushing the result blob, so the retry loop was exiting early with a partial result.Summary
result.result === null(call found but result not yet written), not only when the blob is missing entirelynull, so callers still getargs/toolNameeven if the result never arrivesTesting