Skip to content

fix(tools): compose caller abort signal with the forget-memory timeout - #1588

Open
Sravanjangam wants to merge 1 commit into
supermemoryai:mainfrom
Sravanjangam:fix/forget-memory-signal-compose
Open

fix(tools): compose caller abort signal with the forget-memory timeout#1588
Sravanjangam wants to merge 1 commit into
supermemoryai:mainfrom
Sravanjangam:fix/forget-memory-signal-compose

Conversation

@Sravanjangam

@Sravanjangam Sravanjangam commented Aug 22, 2026

Copy link
Copy Markdown

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

forgetMemoryRequest selected between signals with ??:

signal: options?.signal ?? AbortSignal.timeout(FETCH_TIMEOUT_MS)

Passing a caller-supplied AbortSignal therefore 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 signal
  • packages/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 passed

Verification

Fresh from the committed branch: bunx vitest run src/shared/forget-memory.test.ts2/2 pass; Biome clean on both touched files.


Happy to iterate on any of this — feedback and reworks very welcome! 🙏

Environment

  • macOS 26.1 (arm64) · bun 1.4.0 · node v26.7.0
  • vitest 3.2.4 (workspace-pinned) · Biome lint clean
  • Branch fix/forget-memory-signal-compose — all gates re-run fresh at commit 9f0c86a0790b

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

forgetMemoryRequest drops its 30s timeout whenever a caller passes a signal

1 participant