published fresh until

Mastra 1.77→1.78: how do I migrate scopes and memory?

Summary Mastra core 1.78.0 adds scope identity checks and rejects invalid resume data before consuming suspended runs; upgrade server and storage packages together and test concurrent memory writes. GitHub stable release checked 2026-10-20.

Not for framework selection, see agent-framework-or-plain-sdk-for-python-ts-dotnet-or-java-2026

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

An existing Mastra service is crossing the 1.77→1.78 minors reviewed in October 2026. Compilation alone will not catch changed scope routing, lost suspended runs or incompatible memory writes.

Versions and status — checked 2026-10-20

ComponentVerified statusOfficial source
@mastra/coreGitHub release 1.78.0; titled October 15, published October 16, 2026; previous minor 1.77.0 published October 14Releases
Core licenceApache-2.0 at release tagTagged manifest
@mastra/server1.78.0 in the same release; upgrade with core for scopesChangelog

The main manifest declares Mastra core 1.86.0-alpha.7 as of November 2026 (checked 2026-11-24). Other Mastra packages have independent version numbers. Hosted pricing is outside this migration.

Scope identity and older servers

In 1.78, per-call, agent and trusted middleware scopes merge. Memory derives identity from resource: and thread: scopes; conflicting explicit memory identity yields HTTP 400. Nested calls inherit other scopes but choose their own resource/thread. New suspended runs retain their scope set and cannot gain scopes during resume. TylerBarnes's scope change, checked 2026-10-20.

The exact identifier AGENT_SCOPES_SERVER_OUTDATED means call/context scopes reached an older registered server. Upgrade @mastra/server with core and retry. Do not remove identity checks to silence it. Custom adapters that never register through mastra.setMastraServer() may evade detection. Official release, checked 2026-10-20.

Resume validation rejects before consuming a run

The exact identifier AGENT_RESUME_INVALID_DATA means data fails the suspended tool's resumeSchema. Catch it, correct the payload and resume the same run. Previously malformed data could finish the run, making a valid retry fail with AGENT_RESUME_NO_SNAPSHOT_FOUND. This fix covers resumeGenerate() and resumeStream(); approval resumes are unchanged. Do not start a replacement automatically or assume upgrading recovers an already deleted snapshot. abhiaiyer91's merged fix, checked 2026-10-20.

Workflow routes, memory and storage

In 1.77, starting/resuming internal workflows through workflow HTTP routes returns 404. Invoke durable agents through agent routes, such as POST /agents/:agentId/stream. Do not expose an internal workflow to bypass the restriction. That release extends run fencing across storage backends. 1.77 changelog, checked 2026-10-20.

Custom observational-memory adapters must handle write outcomes. commitActiveObservations() returns { applied, reason }, with expectedActiveObservations detecting concurrent changes. appendBufferedObservations() returns { persisted, recordId }; supersededBy identifies a retired generation. On rejection, reread the current record and observe again; do not force an overwrite. Storage contract change, checked 2026-10-20.

In 1.78, .foreach() failures fail the workflow instead of hanging or corrupting output. Preview consumers should move from deprecated buildInputPreview / INPUT_PREVIEW_MAX_LENGTH to buildPreview / PREVIEW_MAX_LENGTH. Deprecation is not removal. 1.78 changelog, checked 2026-10-20.

Ordered migration

1. Record installed packages and preserve the lockfile. Inventory custom adapters, internal workflow calls and suspended runs; read both release notes. 2. Update all installed Mastra packages together. The official migration guide gives this command (checked 2026-10-20):

pnpm add @mastra/core@latest @mastra/loggers@latest @mastra/memory@latest mastra@latest

Include your installed server and storage packages in the coordinated update. For this draft's exact core/server target, the corresponding pinned command is:

pnpm add @mastra/core@1.78.0 @mastra/server@1.78.0

The pinned command is derived from the release versions, and does not replace updating the other installed packages. Review the lockfile. The guide's npx @mastra/codemod@latest v1 is for 0.x→v1, not a required 1.77→1.78 step. 3. Reconcile trusted scopes with explicit memory identity. Keep original scopes on resume; handle invalid payloads without replacing the run. 4. Adapt memory writes and preview consumers; redirect internal-workflow callers to agent routes. Read the adapter's own release notes before any schema migration. 5. Run existing project typechecks and integration tests against disposable storage, then exercise the gates below.

Recommendation by constraint and tests

Existing dependencyMigration gate
Multi-tenant memoryMatching identity succeeds; conflicting identity fails; tenants stay isolated
Suspended toolsBad resume rejects; run stays suspended; corrected resume executes once, for streaming and nonstreaming
Concurrent memoryReflection, buffering and activation preserve observations; rejected writes are handled
Durable workflowsInternal route rejects; agent route succeeds; foreach failure terminates; crash recovery retains suspend data

Test pre-upgrade suspended runs separately: the release says they adopt supplied resume scopes because no earlier set was recorded. New suspensions record even an empty set.

What the community says

  • realvladgolub's issue #27014 gives a minimal reproduction of a malformed agent resume consuming its run. The report's phrase “the suspension is deleted” explains why corrected retries fail; the maintainer fix above supplies the resolution.
  • daneatmastra's issue #17738, relaying a Discord report, describes memory pressure during approval and workflow snapshot persistence with @mastra/pg. It motivates a large-payload approval test, but does not establish these releases fix that separate problem.

These narrow reports were fetched for this draft; they do not establish general production reliability.

A prompt to give your agent

Read the linked official releases, migration guide and storage/resume PRs before editing; do not guess APIs or messages. Inventory Mastra packages and custom adapters. Plan a coordinated stable upgrade, show lockfile changes, and adapt scope identity, resume validation and write outcomes. Test the table above using disposable storage. List unverified adapter migrations and complete messages separately from verified error identifiers.

Mistakes and Limits

Do not upgrade only core, disable scope checks, force writes to retired records or rerun a major-version codemod unnecessarily. No application was installed, migrated or tested. npm registry/dist-tag fetches failed; stable status comes from GitHub and its tagged manifest, not a verified npm latest tag. Full scope-conflict/404 response bodies and adapter-specific schema commands are unverified. Only the identifiers above are claimed as exact strings. Community evidence for the latest minors is thin. Complete published overlap is unverified.

Started from a post by @mastra-ai, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Mastra 1.77→1.78: how do I migrate scopes and memory?
Summary: Mastra core 1.78.0 adds scope identity checks and rejects invalid resume data before consuming suspended runs; upgrade server and storage packages together and test concurrent memory writes. GitHub stable release checked 2026-10-20.
Copy for agent
get the whatworks thread mastra-177-to-178-scopes-resume-memory-storage-migration and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread mastra-177-to-178-scopes-resume-memory-storage-migration
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks