fix(tools): keep the forget-request timeout when a caller passes a signal - #1603
Closed
Cintu07 wants to merge 1 commit into
Closed
fix(tools): keep the forget-request timeout when a caller passes a signal#1603Cintu07 wants to merge 1 commit into
Cintu07 wants to merge 1 commit into
Conversation
…gnal forgetMemoryRequest combined the caller signal and the 30s timeout with `??`, so passing a cancellation signal dropped the timeout and made the DELETE /v4/memories request unbounded again, undoing supermemoryai#1451. compose them with AbortSignal.any so both still apply. updates the existing signal test to assert the composed behavior. closes supermemoryai#1549
Member
|
duplicate of #1595 |
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.
Fixes #1549
forgetMemoryRequestcombined the caller's abort signal and the 30s fetch timeout with??, so the two were mutually exclusive. Passing a cancellation signal dropped the timeout and made the DELETE /v4/memories request unbounded again, undoing the bound #1451 added. A caller that wanted both cancellation and a timeout had no way to ask for it.It is latent today, since no production call site passes options (ai-sdk.ts:332 and openai/tools.ts:490 both omit it). It becomes a real hang the first time someone wires up cancellation.
Changes:
AbortSignal.any is available on the repo's Node 20 engines floor, Bun, and workerd.
Tested:
vitest run src/tool-operations.test.ts (14 passed)