`forgetMemoryRequest` drops its 30s timeout whenever a caller passes a signal
Severity: Low (latent — defeats the fix from #1451)
File: packages/tools/src/shared/forget-memory.ts:35
Description
#1451 ("fix(tools): bound memory forget requests") added a 30-second abort so
a hung DELETE /v4/memories can't wedge the tool call. The two signals are
combined with ??, so they're mutually exclusive:
signal: options?.signal ?? AbortSignal.timeout(FETCH_TIMEOUT_MS),Pass a cancellation signal and the request becomes unbounded again — exactly the condition the commit set out to remove. A caller who wants both cancellation and a timeout has no way to express it through this API.
No production call site passes options today (ai-sdk.ts:332 and
openai/tools.ts:490 both omit it), so this is latent rather than live. It
becomes a real hang the first time someone wires up cancellation.
Suggested fix
Compose the two instead of choosing between them:
signal: options?.signal
? AbortSignal.any([options.signal, AbortSignal.timeout(FETCH_TIMEOUT_MS)])
: AbortSignal.timeout(FETCH_TIMEOUT_MS),AbortSignal.any is available in Node 20+ (the repo's engines floor), Bun,
and workerd. packages/tools/src/tool-operations.test.ts already exercises the
signal path, so a case asserting the timeout still fires with a caller signal
present is a one-line addition.
Source: supermemoryai/supermemory