0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00

fix(core): surface a failed gateway ownership lookup instead of reporting local memory

`ModelRouterLanguageModel.isGatewayMemoryManaged()` decided memory ownership
from a credential it resolved separately from the model call, and it swallowed
every resolution failure into `false`. Local Observational Memory then ran for a
step whose model call could still resolve a Gateway project key and reach
gateway-served memory, so the gateway and the local store both saved the thread.

Only a *missing* credential is treated as local ownership now: the predicate
returns `false` for `isExpectedMissingAuthError` and re-throws anything else,
matching the contract `GatewayManager.hasAuth` already follows. The
Observational Memory processor stops swallowing the failure for the same reason,
so a step whose ownership cannot be determined fails loudly instead of quietly
writing local memory.

The test that pinned the old swallow — "reports false without throwing when the
gateway credential cannot be resolved" — is replaced by three cases: a missing
credential stays local, an unexpected lookup failure is thrown, and a lookup that
fails before succeeding is thrown on the first call and reports the resolved key
on the second. The end-to-end reply assertion now checks the stored assistant
text part instead of substring-matching the serialized record, which a record
with empty `parts` could satisfy.

Co-Authored-By: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>
This commit is contained in:
mastra-platform[bot] 2026-11-15 18:11:51 +00:00
commit 1981f9ca8f
7 changed files with 129 additions and 43 deletions