fix(tools): compose caller abort signal with the forget-memory timeout - #1588
Open
Sravanjangam wants to merge 1 commit into
Open
fix(tools): compose caller abort signal with the forget-memory timeout#1588Sravanjangam wants to merge 1 commit into
Sravanjangam wants to merge 1 commit into
Conversation
signal: options?.signal ?? AbortSignal.timeout(...) treated the two as mutually exclusive: passing a caller signal silently disarmed the 30s deadline that supermemoryai#1451 added, so a hung request could wait forever. AbortSignal.any now arms both; tests cover caller-abort and the no-signal deadline path.
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.
Hi supermemory team 👋 Thanks for building such a great product! While running a security & quality audit of the repo we hit this issue and put together a small, tested fix — details below.
Problem
forgetMemoryRequestselected between signals with??:Passing a caller-supplied
AbortSignaltherefore silently disarmed the 30-second safety timeout added in #1451 — a hung request would wait forever instead of failing at the deadline.Solution
Compose instead of choose:
AbortSignal.any([callerSignal?, timeout])arms both, so whichever fires first (caller abort or the 30s deadline) aborts the request.Changes
packages/tools/src/shared/forget-memory.ts→ composed signalpackages/tools/src/shared/forget-memory.test.ts(new) → 2 tests: caller-abort honored while the timeout is armed; timeout armed when no caller signal is passedVerification
Fresh from the committed branch:
bunx vitest run src/shared/forget-memory.test.ts→ 2/2 pass; Biome clean on both touched files.Happy to iterate on any of this — feedback and reworks very welcome! 🙏
Environment
fix/forget-memory-signal-compose— all gates re-run fresh at commit9f0c86a0790b