Skip to content

fix(tools): keep the forget-request timeout when a caller passes a signal - #1603

Open
Cintu07 wants to merge 1 commit into
supermemoryai:mainfrom
Cintu07:fix/tools-forget-timeout-with-signal
Open

fix(tools): keep the forget-request timeout when a caller passes a signal#1603
Cintu07 wants to merge 1 commit into
supermemoryai:mainfrom
Cintu07:fix/tools-forget-timeout-with-signal

Conversation

@Cintu07

@Cintu07 Cintu07 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

what breaks

forgetMemoryRequest (packages/tools/src/shared/forget-memory.ts) combined the caller's abort signal and the 30s fetch timeout with ??:

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

so the two are mutually exclusive. Pass a cancellation signal and the request loses its timeout and becomes unbounded again, which reopens the hang #1451 set out to close. A caller that wants both cancellation and a timeout has no way to ask for it.

why it matters

It is latent today, because 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.

the fix

Compose the two with AbortSignal.any instead of choosing between them, so the request aborts on whichever fires first:

signal: options?.signal
    ? AbortSignal.any([options.signal, AbortSignal.timeout(FETCH_TIMEOUT_MS)])
    : AbortSignal.timeout(FETCH_TIMEOUT_MS),

AbortSignal.any is available on the repo's Node 20 engines floor, Bun, and workerd.

verified

Updated the existing signal test in tool-operations.test.ts to assert the composed behavior: a composite signal (not the raw caller signal) that still aborts when the caller aborts. Full file is green:

vitest run src/tool-operations.test.ts  ->  14 passed

Closes #1549

…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
Copilot AI lite review requested due to automatic review settings August 27, 2026 10:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

2 participants