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.
Severity: Low (latent — defeats the fix from #1451)
File:
packages/tools/src/shared/forget-memory.ts:35Description
#1451("fix(tools): bound memory forget requests") added a 30-second abort soa hung
DELETE /v4/memoriescan't wedge the tool call. The two signals arecombined with
??, so they're mutually exclusive: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
optionstoday (ai-sdk.ts:332andopenai/tools.ts:490both omit it), so this is latent rather than live. Itbecomes a real hang the first time someone wires up cancellation.
Suggested fix
Compose the two instead of choosing between them:
AbortSignal.anyis available in Node 20+ (the repo'senginesfloor), Bun,and workerd.
packages/tools/src/tool-operations.test.tsalready exercises thesignal path, so a case asserting the timeout still fires with a caller signal
present is a one-line addition.