mirror of
https://github.com/mastra-ai/mastra.git
synced 2026-11-17 08:44:46 +00:00
144 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6e8dfcb83f | chore: version - exit prerelease mode | ||
|
|
3bdb4ec5f4 |
chore(deps): update build tools (major) (#29026)
> [!NOTE] > This PR body was truncated due to platform limits. This PR contains the following updates: | Package | Type | Update | Change | Pending | |---|---|---|---|---| | [@vitest/coverage-v8](https://vitest.dev/guide/coverage) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8)) | pnpm.catalog.default | major | [`4.1.12` → `5.0.5`](https://renovatebot.com/diffs/npm/@vitest%2fcoverage-v8/4.1.12/5.0.5) | `5.1.0` | | [@vitest/mocker@>=2.1.0 <4.1.12](https://redirect.github.com/vitest-dev/vitest/tree/main/packages/mocker) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/mocker)) | pnpm-workspace.overrides | major | [`4.1.12` → `5.0.5`](https://renovatebot.com/diffs/npm/@vitest%2fmocker@>=2.1.0 <4.1.12/4.1.12/5.0.5) | `5.1.0` | | [@vitest/ui](https://vitest.dev/guide/ui) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/ui)) | pnpm.catalog.default | major | [`4.1.12` → `5.0.5`](https://renovatebot.com/diffs/npm/@vitest%2fui/4.1.12/5.0.5) | `5.1.0` | | [dotenv](https://redirect.github.com/motdotla/dotenv) | devDependencies | major | [`^17.4.2` → `^18.0.9`](https://renovatebot.com/diffs/npm/dotenv/17.4.2/18.0.9) | | | [dotenv](https://redirect.github.com/motdotla/dotenv) | devDependencies | major | [`17.4.2` → `18.0.9`](https://renovatebot.com/diffs/npm/dotenv/17.4.2/18.0.9) | | | [vitest](https://vitest.dev) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/vitest)) | devDependencies | major | [`^4.1.12` → `^5.0.5`](https://renovatebot.com/diffs/npm/vitest/4.1.12/5.0.5) | `5.1.0` | | [vitest](https://vitest.dev) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/vitest)) | pnpm.catalog.default | major | [`4.1.12` → `5.0.5`](https://renovatebot.com/diffs/npm/vitest/4.1.12/5.0.5) | `5.1.0` | | [vitest](https://vitest.dev) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/vitest)) | devDependencies | major | [`4.1.12` → `5.0.5`](https://renovatebot.com/diffs/npm/vitest/4.1.12/5.0.5) | `5.1.0` | | [vitest@>=2.1.0 <4.1.12](https://vitest.dev) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/vitest)) | pnpm-workspace.overrides | major | [`4.1.12` → `5.0.5`](https://renovatebot.com/diffs/npm/vitest@>=2.1.0 <4.1.12/4.1.12/5.0.5) | `5.1.0` | --- > [!WARNING] > Some dependencies could not be looked up. Check the [Dependency Dashboard](../issues/9505) for more information. --- ### Release Notes <details> <summary>vitest-dev/vitest (@​vitest/coverage-v8)</summary> ### [`v5.0.5`](https://redirect.github.com/vitest-dev/vitest/releases/tag/v5.0.5) [Compare Source](https://redirect.github.com/vitest-dev/vitest/compare/v5.0.4...v5.0.5) ##### 🐞 Bug Fixes - Keep vite default `fs.deny` with api token file - by [@​hi-ogawa](https://redirect.github.com/hi-ogawa), **Hiroshi Ogawa** and **Claude Opus 5.5** in [#​11578](https://redirect.github.com/vitest-dev/vitest/issues/11578) [<samp>(28dc1)</samp>]( |
||
|
|
47a6cd82e5 |
chore(deps): update ai sdk (#29242)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> |
||
|
|
30046969ad |
chore: version packages (alpha) (#29146)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. ⚠️⚠️⚠️⚠️⚠️⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`. ⚠️⚠️⚠️⚠️⚠️⚠️ # Releases ## @mastra/client-js@1.59.0-alpha.1 ### Minor Changes - Added the `aggregateTimeToFirstMeasures` observability capability. Trace and span aggregate requests for `timeToFirstToken.*` or `timeToFirstChunk.*` measures now return `501` against stores that can't compute them, and field discovery omits those measures for such stores. ([#29055](https://github.com/mastra-ai/mastra/pull/29055)) ```typescript const { capabilities } = await mastraClient.getObservabilityCapabilities(); if (capabilities.traceAggregate && capabilities.aggregateTimeToFirstMeasures) { const { rows } = await mastraClient.aggregateTraces({ timeRange: { from: '2026-08-01T00:00:00.000Z', to: '2026-08-02T00:00:00.000Z' }, groupBy: ['entityName'], measures: ['timeToFirstChunk.p95', 'timeToFirstChunk.count'], }); } ``` ### Patch Changes - Updated dependencies [[`8751dd7`]( |
||
|
|
7645fce513 |
chore(deps): update dependency @google-cloud/pubsub to v6 (#29113)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> |
||
|
|
77076a1012 | chore: version - exit prerelease mode | ||
|
|
4f12792ed1 |
chore: version packages (alpha) (#28722)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
f2ad3844f3 |
chore(deps): update opentelemetry (#28581)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
6deb7c0a1e |
chore(security): Vanta 2026-10-28 - qs 6.16.1, @modelcontextprotocol/node 2.1.1 floors (#28716)
Refs mastra-ai/platform#2931 Vanta remediation pass for 2026-10-28. It follows #28325, which has merged. ## 2026-10-28 update Today's live Vanta export added 3 advisory IDs on `mastra-ai/mastra` (GitHub/Dependabot). This PR fixes the two that have a published fix and leaves deepmerge, which has none. | Package | From → To | Finding | Where | How | |---|---|---|---|---| | qs | 6.16.0 → 6.16.1 | CVE-2026-110816 / GHSA-6pq8-jhm2-2vcw (Medium ×4) | root `pnpm-lock.yaml`, 9 `e2e-tests/*` lockfiles, `scripts/gh-issue-triage/package-lock.json` | Raised the existing floors `qs@>=6.7.0 <6.16.0: 6.16.0` → `<6.16.1: 6.16.1` and `'qs@<6.7.0': 6.16.0` → `6.16.1`. Raised the npm override in gh-issue-triage. | | @modelcontextprotocol/node | 2.0.0 → 2.1.1 | GHSA-f897-62hf-6gxq (High ×2; HTTP transports had no body-size or batch-length limit) | root `pnpm-lock.yaml` (published `@mastra/mcp` 1.18.0, used as `mcp-legacy`), `scripts/gh-issue-triage/package-lock.json` | New pnpm override `'@modelcontextprotocol/node@>=2.0.0 <2.1.0': 2.1.1` and a new npm override in gh-issue-triage. I used 2.1.1 rather than 2.1.2 because 2.1.2 needs a `@modelcontextprotocol/server` peer of `^2.4.0`, while `@mastra/mcp` 1.18 resolves server 2.3.1. `packages/mcp` itself already uses node 2.1.2. | - Both versions are older than the 1-day `minimumReleaseAge`: qs 6.16.1 was published 10-14 and node 2.1.1 on 10-02. I did not use qs 6.16.2 (10-27), which is too new. - No floors or overrides were removed; existing ones were only raised. - `pnpm install --frozen-lockfile --lockfile-only` passes at the root. Each nested e2e workspace was regenerated with `pnpm install --lockfile-only`. - Added the empty changeset `.changeset/vanta-2026-10-28-security-floors.md`. No published package changes. - After this change, osv-scanner over all 33 lockfiles reports only the documented leftovers: - zod 3.25.76 (zod v3 compat line on purpose) - ai 4.3.19 / `@ai-sdk/provider-utils` 2.2.8 (vendored v4 line) - `@azure/msal-node` 5.6.0 / 6.0.1 (fix 7.1.0 needs majors in identity and teams) - `@opentelemetry/core` 1.30.1 (needs pubsub 6) - extract-zip 2.0.1 (no patched release) - deepmerge 4.3.1 (CVE-2026-93753 / GHSA-gcqx-w48m-w2h4; no patched release, 4.3.1 is the latest) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 This PR updates dependency rules and package versions to use newer releases, including security fixes for `qs` and `@modelcontextprotocol/node`. It also updates AI SDK dependencies and does not include published package changes. ## Summary - Raise the `qs` override target to `6.16.1` in the root and e2e workspaces and in `scripts/gh-issue-triage`. - Add an `@modelcontextprotocol/node` override at `2.1.1` in the root workspace and `scripts/gh-issue-triage`. - Update AI SDK dependency versions across package manifests and add a changeset describing the provider-utils update. - Add an empty changeset for the security-only dependency updates. <!-- end of auto-generated comment: release notes by coderabbit.ai --> ## Update 2026-10-28 (afternoon) - Merged origin/main (clean). - Bumped the AI SDK v5 compat line from @ai-sdk/provider-utils 3.0.41 to 3.0.42 (patch, published 2026-10-21; it blocks `.internal` hostnames in download URL validation and encodes provider-returned IDs in request paths). This addresses the Aikido /mastra Highs AIKIDO-2026-10990 and AIKIDO-2026-10981: - ai 5.0.277 → 5.0.282, @ai-sdk/gateway 2.0.168 → 2.0.173 (vendored ai_v5) - anthropic 2.0.109 → 2.0.110, google 2.0.103 → 2.0.106, groq 2.0.58 → 2.0.59, openai 2.0.135 → 2.0.137, openai-compatible 1.0.58 → 1.0.59, xai 2.0.99 → 2.0.100 - Nested lockfiles updated: memory/integration-tests and playground/e2e/kitchen-sink. - No new overrides. Changeset: `vanta-2026-10-28-ai-sdk-v5-provider-utils.md`. |
||
|
|
6a191d46dc | chore: version - exit prerelease mode | ||
|
|
2c646b53d0 |
chore: version packages (alpha) (#28399)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. ⚠️⚠️⚠️⚠️⚠️⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`. ⚠️⚠️⚠️⚠️⚠️⚠️ # Releases > The changelog information of each package has been omitted from this message, as the content exceeds the size limit. ## @mastra/factory@0.25.0-alpha.5 ## @mastra/langsmith@1.4.0-alpha.2 ## @mastra/connect@1.2.0-alpha.2 ## @mastra/core@1.80.0-alpha.4 ## @mastra/playground-ui@66.0.0-alpha.4 ## @mastra/acp@0.4.4-alpha.0 ## @mastra/claude@0.3.4-alpha.0 ## @mastra/cursor@0.3.4-alpha.0 ## @mastra/openai@1.1.4-alpha.0 ## @mastra/auth-auth0@1.2.6-alpha.0 ## @mastra/auth-better-auth@1.1.9-alpha.0 ## @mastra/auth-clerk@1.3.2-alpha.0 ## @mastra/auth-cloud@1.2.8-alpha.0 ## @mastra/auth-firebase@1.1.5-alpha.0 ## @mastra/auth-google@0.1.7-alpha.0 ## @mastra/auth-neon@0.3.5-alpha.0 ## @mastra/auth-okta@0.2.6-alpha.0 ## @mastra/auth-studio@1.3.11-alpha.1 ## @mastra/auth-supabase@1.1.6-alpha.0 ## @mastra/auth-workos@1.6.8-alpha.0 ## @mastra/agent-browser@0.5.5-alpha.0 ## @mastra/browser-viewer@0.2.6-alpha.0 ## @mastra/browser-firecrawl@0.2.5-alpha.1 ## @mastra/stagehand@0.3.7-alpha.1 ## @mastra/discord@1.3.2-alpha.0 ## @mastra/slack@1.8.0-alpha.1 ## @mastra/teams@0.1.3-alpha.0 ## @mastra/telegram@0.2.4-alpha.0 ## @mastra/client-js@1.57.0-alpha.4 ## @mastra/react@1.13.0-alpha.4 ## @mastra/isolated-vm@0.1.4-alpha.0 ## @mastra/quickjs@0.1.5-alpha.0 ## @mastra/deployer-cloud@1.80.0-alpha.4 ## @mastra/deployer-cloudflare@1.2.39-alpha.1 ## @mastra/deployer-netlify@1.2.39-alpha.1 ## @mastra/deployer-sandbox@0.3.24-alpha.1 ## @mastra/deployer-vercel@1.2.39-alpha.1 ## @mastra/voyageai@0.4.3-alpha.0 ## @mastra/longmemeval@1.1.39-alpha.4 ## @mastra/livekit@0.5.2-alpha.0 ## @mastra/opencode@0.1.39-alpha.4 ## @mastra/parallel@0.1.4-alpha.0 ## create-factory@0.3.1-alpha.4 ## @mastra/code-sdk@1.15.1-alpha.5 ## mastracode@0.48.1-alpha.4 ## @mastra/arize@1.3.27-alpha.2 ## @mastra/arthur@0.4.27-alpha.2 ## @mastra/braintrust@1.3.24-alpha.2 ## @mastra/datadog@1.4.19-alpha.2 ## @mastra/deepeval@0.1.21-alpha.2 ## @mastra/laminar@1.3.29-alpha.2 ## @mastra/langfuse@1.6.3-alpha.2 ## @mastra/observability@1.21.1-alpha.2 ## @mastra/otel-bridge@1.5.19-alpha.2 ## @mastra/otel-exporter@1.4.10-alpha.2 ## @mastra/posthog@1.4.4-alpha.2 ## @mastra/sentry@1.2.29-alpha.2 ## @mastra/agent-builder@1.1.31-alpha.2 ## @mastra/auth@1.1.5-alpha.0 ## mastra@1.36.0-alpha.4 ## @mastra/codemod@1.1.8-alpha.0 ## create-mastra@1.36.0-alpha.4 ## @mastra/deployer@1.80.0-alpha.4 ## @mastra/editor@0.16.5-alpha.2 ## @mastra/evals@1.10.9-alpha.0 ## @mastra/fastembed@1.3.5-alpha.2 ## @mastra/loggers@1.3.10-alpha.1 ## @mastra/mcp@2.6.0-alpha.1 ## @mastra/mcp-docs-server@1.3.10-alpha.7 ## @mastra/mcp-registry-registry@1.1.7-alpha.0 ## @mastra/memory@1.39.1-alpha.2 ## @mastra/rag@2.7.1-alpha.0 ## @mastra/schema-compat@1.3.17-alpha.0 ## @mastra/server@1.80.0-alpha.4 ## @mastra/google-cloud-pubsub@1.1.5-alpha.1 ## @mastra/redis-streams@0.6.5-alpha.1 ## @mastra/valkey-streams@0.5.7-alpha.1 ## @mastra/elysia@0.1.20-alpha.4 ## @mastra/express@1.5.24-alpha.4 ## @mastra/fastify@1.5.24-alpha.4 ## @mastra/hono@1.7.22-alpha.4 ## @mastra/koa@1.7.24-alpha.4 ## @mastra/nestjs@0.2.39-alpha.4 ## @mastra/next@0.2.38-alpha.4 ## @mastra/server-adapters-test-suite@0.1.4-alpha.2 ## @mastra/tanstack-start@0.2.38-alpha.4 ## @mastra/astra@1.1.3-alpha.0 ## @mastra/azure-ai-search@0.1.2-alpha.1 ## @mastra/chroma@1.1.5-alpha.0 ## @mastra/clickhouse@1.27.0-alpha.1 ## @mastra/cloudflare@1.7.6-alpha.0 ## @mastra/cloudflare-d1@1.4.5-alpha.1 ## @mastra/convex@1.7.6-alpha.0 ## @mastra/couchbase@1.1.4-alpha.1 ## @mastra/dsql@1.5.5-alpha.0 ## @mastra/duckdb@1.16.0-alpha.1 ## @mastra/dynamodb@1.4.5-alpha.1 ## @mastra/elasticsearch@1.4.6-alpha.1 ## @mastra/lance@1.5.2-alpha.1 ## @mastra/libsql@1.27.1-alpha.0 ## @mastra/mongodb@1.24.1-alpha.1 ## @mastra/mssql@1.10.6-alpha.0 ## @mastra/mysql@0.14.1-alpha.0 ## @mastra/opensearch@1.1.4-alpha.1 ## @mastra/oracledb@0.5.5-alpha.0 ## @mastra/pg@1.33.0-alpha.2 ## @mastra/pinecone@1.1.3-alpha.0 ## @mastra/qdrant@1.1.6-alpha.0 ## @mastra/redis@1.4.12-alpha.1 ## @mastra/s3vectors@1.1.5-alpha.0 ## @mastra/spanner@1.10.1-alpha.1 ## @mastra/turbopuffer@1.2.3-alpha.0 ## @mastra/turso@0.1.18-alpha.0 ## @mastra/upstash@1.5.5-alpha.1 ## @mastra/valkey@0.2.8-alpha.1 ## @mastra/vectorize@1.1.4-alpha.0 ## @mastra/weaviate@0.1.4-alpha.0 ## @mastra/voice-aws-nova-sonic@0.2.6-alpha.0 ## @mastra/voice-azure@0.12.3-alpha.0 ## @mastra/voice-cloudflare@0.13.4-alpha.0 ## @mastra/voice-deepgram@0.13.3-alpha.0 ## @mastra/voice-elevenlabs@0.13.3-alpha.0 ## @mastra/voice-gladia@0.13.3-alpha.0 ## @mastra/voice-google@0.14.4-alpha.0 ## @mastra/voice-google-gemini-live@0.14.18-alpha.0 ## @mastra/voice-inworld@0.4.6-alpha.0 ## @mastra/voice-mistral@0.1.3-alpha.0 ## @mastra/voice-modelslab@0.2.3-alpha.0 ## @mastra/voice-murf@0.13.3-alpha.0 ## @mastra/voice-openai@0.13.4-alpha.0 ## @mastra/voice-openai-realtime@0.14.8-alpha.0 ## @mastra/voice-playai@0.13.3-alpha.0 ## @mastra/voice-sarvam@1.1.4-alpha.0 ## @mastra/voice-speechify@0.14.3-alpha.0 ## @mastra/voice-xai-realtime@0.2.17-alpha.0 ## @mastra/inngest@1.10.8-alpha.3 ## @mastra/temporal@0.4.18-alpha.4 ## @mastra/agentcore@0.5.3-alpha.0 ## @mastra/agentfs@0.2.3-alpha.0 ## @mastra/apple-container@0.5.2-alpha.0 ## @mastra/archil@0.3.2-alpha.0 ## @mastra/azure@0.3.3-alpha.1 ## @mastra/blaxel@0.10.2-alpha.0 ## @mastra/cloudflare-sandbox@0.5.4-alpha.0 ## @mastra/daytona@0.11.4-alpha.0 ## @mastra/docker@0.12.1-alpha.0 ## @mastra/e2b@0.15.1-alpha.1 ## @mastra/e2b-desktop@0.1.10-alpha.1 ## @mastra/files-sdk@0.3.3-alpha.0 ## @mastra/gcs@0.3.5-alpha.1 ## @mastra/google-drive@0.2.4-alpha.0 ## @mastra/mesa@0.3.3-alpha.0 ## @mastra/modal@0.7.3-alpha.0 ## @mastra/platform-workspace@1.10.0-alpha.1 ## @mastra/railway@0.10.2-alpha.1 ## @mastra/s3@0.6.5-alpha.1 ## @mastra/sprites@0.1.2-alpha.0 ## @mastra/vercel@1.6.2-alpha.0 ## @internal/playground@1.36.0-alpha.4 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
ce5d4731ee |
chore(deps): update dependencies across the monorepo (#28417)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
dacb190944 |
chore: version packages (alpha) (#28009)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
40a522c142 |
chore(deps): update build tools (#27997) | ||
|
|
fb5c594e52 |
fix: require and declare the Apache-2.0 license in package.json (#28122)
> Opened by @user_01KN4T0VBWE4X5GKHXP2RCP40M ## What `@mastra/inngest` (reported in #28120) was published without a `license` field, so npm reported it as "Unlicensed" to license scanners even though the tarball ships `LICENSE.md` with Apache-2.0. Auditing the repo showed 12 publishable packages in the same state, not just Inngest. This PR: 1. Adds `"license": "Apache-2.0"` to every affected manifest: - `@mastra/inngest` - `@mastra/editor` - `@mastra/google-cloud-pubsub`, `@mastra/redis-streams`, `@mastra/valkey-streams` - `@mastra/cloudflare-d1`, `@mastra/couchbase`, `@mastra/dynamodb`, `@mastra/elasticsearch`, `@mastra/lance`, `@mastra/mongodb`, `@mastra/opensearch` 2. Teaches `.github/scripts/validate-pkg-json.mjs` to validate the field for every package it already checks: missing license or a value other than `Apache-2.0` fails the `Validate package.json files` CI job. 3. Ships one changeset (`patch` for all 12 packages) describing the `package.json` update. The validator's existing scope is unchanged: private packages, the ignore list, and non-published templates/fixtures are still skipped. Fixes #28120 ## Proof ``` $ node .github/scripts/validate-pkg-json.mjs ✅ All checked package.json files passed validation. Total: 160 files ``` Negative test — removing the new `license` field from `workflows/inngest/package.json` and re-running: ``` ❌ /workspace/mastra/workflows/inngest/package.json: missing license field exit=1 ``` Restoring the field returns the validator to `exit=0`, proving the check is what fails rather than an unrelated error. `npx prettier --check` passes on all changed files. ## Unverified - `npm view @mastra/inngest license` only reflects the fix after the next release publishes. ## Risk low — metadata-only manifest changes plus a CI script check. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 This change adds a clear license label to 12 packages. It also updates a check that warns if a checked package is missing that label or uses a different one. ## Summary - Added `"license": "Apache-2.0"` to 12 package manifests. - Updated `.github/scripts/validate-pkg-json.mjs` to reject checked packages when the license field is missing or does not match `Apache-2.0`. The validator’s existing package scope remains unchanged. - Added a changeset that declares patch releases for 13 `@mastra` packages. ## Validation The author reports that the validator passes for 160 files, and that removing the license field from `workflows/inngest/package.json` produces an error and exit code 1. The author also reports that Prettier checks pass on all changed files. Published npm metadata has not been verified; it will reflect this change after a release. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
4c22623ea3 | chore: version - exit prerelease mode | ||
|
|
dbde4bf36a |
chore(deps): update ai sdk (#27728)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> |
||
|
|
9a423dae48 |
refactor(lint): replace ESLint with type-aware oxlint (#27476) | ||
|
|
a15924e709 | chore: version packages | ||
|
|
66da3cafd4 |
Keep pnpm patches applied in apps built with mastra build (#21716)
Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com> Co-authored-by: Mastra Code (anthropic/claude-opus-5) <noreply@mastra.ai> Co-authored-by: Mastra CI <ci@mastra.ai> Co-authored-by: wardpeet <ward@coding-tech.com> |
||
|
|
c19a93b095 | chore: version - exit prerelease mode | ||
|
|
e6de774069 | chore: version packages | ||
|
|
e983f74987 |
chore(*): Update/unify/add READMEs (#22858)
Co-authored-by: Mastra Code (openai/gpt-5.6-sol) <noreply@mastra.ai> |
||
|
|
fc968c8a9b | chore: version packages | ||
|
|
28ce924276 |
chore(*): Remove CHANGELOG.md from npm files (#22737) | ||
|
|
8d2399b638 |
chore(deps): update ai sdk (#20149)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com> |
||
|
|
d271d37f30 |
chore: migrate package builds to tsdown (#19829)
Co-authored-by: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai> |
||
|
|
bdeaef58f0 |
chore: migrate linting to oxlint (#20173)
Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Mastra Code (openai/gpt-5.6-sol) <noreply@mastra.ai> |
||
|
|
3a507cbd42 |
chore: migrate repository formatting to oxfmt (#19807)
Co-authored-by: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai> |
||
|
|
41a5392d9f |
chore(deps): update ai sdk (#19813)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> |
||
|
|
a4620cae04 |
chore(deps): update formatting & linting (#19388)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: wardpeet <ward@coding-tech.com> |
||
|
|
ec857fc79c |
chore(deps): update ai sdk (#19611)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> |
||
|
|
dfaf448ceb | chore: version - exit prerelease mode | ||
|
|
0532405a28 |
chore(deps): update build tools (#18043) | ||
|
|
c6213cf939 | chore: version packages | ||
|
|
5b807a7134 |
chore(deps): update google cloud (#19038)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> |
||
|
|
bd6d2402db |
chore(deps): update ai sdk (#16699)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> |
||
|
|
1556acd04c | chore: version - exit prerelease mode | ||
|
|
e12b17d2ff |
chore: version packages (alpha) (#18345)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. ⚠️⚠️⚠️⚠️⚠️⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`. ⚠️⚠️⚠️⚠️⚠️⚠️ # Releases > The changelog information of each package has been omitted from this message, as the content exceeds the size limit. ## @mastra/core@1.46.0-alpha.4 ## @mastra/mongodb@1.11.0-alpha.1 ## @mastra/client-js@1.27.0-alpha.4 ## @mastra/react@1.1.1-alpha.4 ## @mastra/deployer-cloud@1.46.0-alpha.4 ## @mastra/longmemeval@1.1.1-alpha.4 ## @mastra/opencode@0.1.1-alpha.4 ## mastracode@0.25.0-alpha.4 ## mastra@1.15.1-alpha.4 ## @mastra/deployer@1.46.0-alpha.4 ## @mastra/mcp-docs-server@1.2.1-alpha.5 ## @mastra/playground-ui@36.0.0-alpha.4 ## @mastra/server@1.46.0-alpha.4 ## @mastra/google-cloud-pubsub@1.1.1-alpha.1 ## @mastra/redis-streams@0.2.0-alpha.1 ## @mastra/express@1.4.1-alpha.4 ## @mastra/fastify@1.4.1-alpha.4 ## @mastra/hono@1.5.1-alpha.4 ## @mastra/koa@1.6.1-alpha.4 ## @mastra/nestjs@0.2.1-alpha.4 ## @mastra/next@0.2.0-alpha.4 ## @mastra/tanstack-start@0.2.0-alpha.4 ## @mastra/libsql@1.14.1-alpha.1 ## @mastra/mysql@0.3.0-alpha.1 ## @mastra/pg@1.14.1-alpha.1 ## @mastra/spanner@1.2.1-alpha.1 ## @mastra/temporal@0.2.1-alpha.4 ## create-mastra@1.15.1-alpha.4 ## @internal/playground@1.15.1-alpha.4 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
975c59ae36 |
feat(core): make agentic-loop serialization-safe on the evented engine (#17836)
## Summary
Makes the agentic-loop's evented-engine path structurally
serialization-safe. Step inputs/outputs are guaranteed JSON-safe and
non-serializable runtime state (live class instances, closures,
transport refs, save queues, memory handles) lives in a per-run scratch
space (`RunScope`) that never crosses the wire. A new codec layer at the
`UnixSocketPubSub` boundary preserves rich types (`Date`, `Error`,
`Map`, `Set`, `RegExp`, `URL`, `BigInt`, `undefined`, registered classes
like `DefaultGeneratedFile`) on round-trip across processes.
Before this change, the agentic-loop relied on a convention: keep
non-serializable values out of step I/O and pass them via a `_internal`
bag carried through closures. That convention was easy to break, and any
rich value that reached `UnixSocketPubSub.publish` was either silently
flattened or crashed the publisher.
### Before / after on the wire
This was validated against a hermetic Mastra project linked to dist
tarballs built from both `main` HEAD and this branch. Both runs
published the same payload over a real `UnixSocketPubSub` from a broker
process to a forked client process.
| Payload field on the wire | BEFORE (`main` dist) | AFTER (this branch
dist) |
| ----------------------------- |
--------------------------------------------- |
--------------------------------------- |
| `BigInt` | **`TypeError: Do not know how to serialize a BigInt` —
publisher crashes** | preserved as `bigint` |
| `DefaultGeneratedFile` | same crash + tree-shaken from dist | instance
preserved, `.base64` getter intact |
| `Date` | silently → ISO string on receiver | `Date` instance |
| `RegExp` | silently → `{}` on receiver | `/source/flags` preserved |
| `URL` | silently → string on receiver | `URL` instance |
| `Set` (size 3) | silently → `{}` (size 0) on receiver | `Set` size 3,
entries preserved |
| `Map` (size 2) | silently → `{}` (size 0) on receiver | `Map` size 2,
entries preserved |
| `Error` with custom field | silently → plain object, `.message` lost |
`Error` instance, message + custom fields preserved |
| In-process publish (same proc)| works (in-memory shortcut, no
serialization) | works (same shortcut, codec bypassed) |
Single-process workflows and Studio chat aren't affected either way —
`UnixSocketPubSub.publish` short-circuits same-process publishes through
`#deliverLocal` and never reaches the codec. The breakage was, and the
fix is, scoped to the cross-process wire.
### Approach
**`RunScope` per-run scratch space**
- `RunScope` (`Map<symbol, unknown>`) stores non-serializable runtime
state (live instances, closures, transport refs, memory handles,
background task managers) keyed by `runId`, addressed by typed
`RunScopeKey<T>` symbols
- Refcounted lifecycle: allocated by `__registerInternalWorkflow`,
released by `__unregisterInternalWorkflow`, swept by the existing TTL
sweeper, and kept alive across suspend/resume on the evented engine
- Never persisted to storage, never published over pubsub
- Bridges the wire boundary: step I/O stays JSON-safe; live handles ride
in scope
**Codec at the `UnixSocketPubSub` boundary**
- `serializeFrame` / `readFrames` now wrap / unwrap rich types using
tagged envelopes (`CODEC_TAG = '__m_codec__'`) with a closed
`EnvelopeTag` discriminator
- Supports `Date`, `Error` (incl. `cause` chains and enumerable own
props), `Map`, `Set`, `RegExp` (with source length cap + flag whitelist
as ReDoS defense), `URL`, `BigInt`, `undefined`, and registered classes
via a `ClassCodec` registry
- Cycle-safe via `WeakSet` — repeat references encode as `null` (matches
`JSON.stringify`'s "first visit wins" behavior without throwing)
- In-process `EventEmitterPubSub` and same-process
`UnixSocketPubSub.#deliverLocal` bypass the codec — object references
pass through unchanged for local subscribers
**Workflow migration**
- `prepare-stream`, `agentic-execution`, `agentic-loop` migrated to
read/write via `readScoped` / `writeScoped` helpers
- `StreamInternal` marked `@deprecated` per-field; bootstrap values
hydrated once at loop start via `hydrateRunScopeFromInternal`.
Runtime-write fields (`stepTools`, `stepActiveTools`, `stepWorkspace`,
`_delegationBailed`) are intentionally skipped — they're produced during
execution, not bootstrap input
- Step output schemas are now JSON-safe by construction; all live
handles (memory, save queues, transport refs, tool registries, processor
state) live in `RunScope`
### Implementation details
**New modules**
- `run-scope.ts` — `RunScope` interface, `MapRunScope` implementation,
typed `RunScopeKey<T>` factory
- `loop/run-scope-keys.ts` — 22 typed keys for the agentic loop
(`NOW_KEY`, `GENERATE_ID_KEY`, `STEP_TOOLS_KEY`,
`DRAIN_PENDING_SIGNALS_KEY`, etc.)
- `prepare-stream/run-scope-keys.ts` — 5 typed keys for prepare-stream
(`MESSAGE_LIST_KEY`, `CONVERTED_TOOLS_KEY`, `PROCESSOR_STATES_KEY`,
etc.)
- `loop/run-scope-access.ts` — `getRunScope`, `readScoped`,
`writeScoped` helpers (read prefers scope, falls back to `_internal`;
write mirrors to `_internal` for backward compat)
- `loop/hydrate-run-scope.ts` — bootstraps scope from `_internal` once
at loop start
- `events/codec/{codec,tags,registry,error,registrations}.ts` — codec
primitives + built-in class codecs (`DefaultGeneratedFile`,
`DefaultGeneratedFileWithType`, `DefaultStepResult`)
**Mastra core**
- `Mastra` manages `#runScopes` and `#runScopeRefcounts`
- New internal methods: `__getRunScope(runId)`,
`__createRunScope(runId)`, `__releaseRunScope(runId)`
- TTL sweeper releases scopes when evicting stale internal workflow
registrations
- `__registerInternalWorkflow` / `__unregisterInternalWorkflow` create /
release scope refcounts as part of their existing lifecycle
**Tree-shaking fix**
The class codec registry (`DefaultGeneratedFile`,
`DefaultGeneratedFileWithType`, `DefaultStepResult`) was originally
activated by a side-effect import (`import './registrations'`) from the
codec barrel. With `"sideEffects": false` in
`packages/core/package.json`, the bundler dropped that import, and the
registrations were missing from the published dist —
`DefaultGeneratedFile` instances would lose their prototype on
cross-process publish even with the codec in place. The dist reproducer
from the smoke test confirmed this: `instanceof DefaultGeneratedFile`
was `true` on send and `false` on receive.
Fix: registrations live in a named export (`BUILTIN_CODECS_REGISTERED`)
that `codec.ts` imports and references with `typeof
BUILTIN_CODECS_REGISTERED`, which the bundler retains. Verified by
inspecting `dist/events/index.js` (4 `registerClass` calls present, was
0) and by the cross-process `DefaultGeneratedFile` round-trip test that
loads from dist.
### Test coverage
**Codec round-trip**
- `codec.test.ts` — every envelope type (Date, Error, Map, Set, RegExp,
URL, BigInt, undefined, Class) with cycles, `toJSON`, hostile flags,
oversized source, malformed source fallback, class registry,
registry-collision safety
- `unix-socket-pubsub-codec.test.ts` — same types over a real
same-process broker+client
- `cross-process-codec-roundtrip.test.ts` — same types over a real
`fork()`ed broker+client loaded from dist, including
`DefaultGeneratedFile` (which catches the tree-shaking bug)
**RunScope lifecycle**
- `run-scope.test.ts` — storage semantics, key collision safety,
refcounting, idempotent `__createRunScope`, register/unregister pairing,
TTL eviction
- `run-scope-helpers.test.ts` — hydrate field contract (populated vs
intentionally skipped), `readScoped` scope-then-`_internal` fallback,
`writeScoped` mirror
- `runscope-leak.test.ts` — parallel runs (per-run scope isolation), TTL
sweep on abandoned suspend, many sequential runs (no accumulation), for
both default and evented engines
- `agentic-loop-snapshot-lifecycle.test.ts` — scope release across
suspend/resume/decline/fail, engine-aware (default holds across suspend,
evented releases at suspend boundary)
**Serialization invariants**
- `serialization-invariants.test.ts` — step output schemas exclude
forbidden handle/config keys; representative payloads do not leak
Class/Function envelopes at the codec boundary
- `prepare-stream/run-scope.test.ts` — step output schemas are
JSON-safe; `RunScope` carries non-wire-safe handles; codec boundary
never sees them
- `step-output-type-preservation.test.ts` — full default + evented
engine validation that Date, Error, Map, Set, RegExp, URL, BigInt,
`DefaultGeneratedFile`, `DefaultStepResult`, and cycles preserve types
through workflow snapshot/restore
**Transport ↔ consumer**
- `unix-socket-pubsub-redelivery-budget.test.ts` —
`MAX_LOCAL_REDELIVERIES` >=
`WorkflowEventProcessor.MAX_DELIVERY_ATTEMPTS` so the consumer always
gets its full retry budget
- `redelivery-end-to-end.test.ts` — real WEP + real `UnixSocketPubSub`:
K-1 transient failures then success (pubsub redelivers, WEP eventually
acks, no `workflow.fail`) and K+1 transient failures (WEP trips
`MAX_DELIVERY_ATTEMPTS`, publishes `workflow.fail` exactly once, pubsub
stops)
### Backward compatibility
- `_internal` field on `streamVNext()` options continues to work; values
are hydrated into `RunScope` once at loop start and marked `@deprecated`
- `readScoped` / `writeScoped` mirror writes to `_internal` so legacy
code reading from the bag still observes mutations
- In-process `EventEmitterPubSub` bypasses codec; continues to pass
object references as before
- Same-process `UnixSocketPubSub` publishes (same broker + same client
process) short-circuit through `#deliverLocal` and never touch the codec
- No changes to exported workflow APIs; migration is transparent to
callers
### Documentation
- `packages/core/AGENTS.md` — documents `runScope` contract, lifecycle,
and the JSON-safety constraint on step I/O
- `.changeset/pink-poets-joke.md` — notes resolution of intermittent
"getFullOutput is not a function" and "Workflow not found" errors on
multi-instance deployments
### Validation
- Core typecheck passes
- Core tests: 9807 pass, 115 skipped, 19 todo (1 unrelated pre-existing
flake on `resume-api.test.ts` `cachingPubsub.getHistory` race)
- Smoke-tested locally against a hermetic create-mastra project linked
to dist tarballs from both `main` and this branch:
- **Option A**: single-process evented workflow with codec-typed step
output — passes on both branches (in-memory shortcut, doesn't exercise
codec)
- **Option B**: forked broker + client over `UnixSocketPubSub` with
`DefaultGeneratedFile` + `BigInt` — `main` **crashes** at
`serializeFrame` with `TypeError: Do not know how to serialize a
BigInt`; this branch preserves all 7 type assertions including
`instanceof DefaultGeneratedFile` and `.base64`
- **Option E**: forked broker + client with
`Date`/`RegExp`/`URL`/`Set`/`Map`/`Error` (no BigInt, so `main` doesn't
crash) — `main` silently flattens every value on the receiver; this
branch preserves all of them
- **Option C**: real `gpt-5-mini` agentic chat in Studio with
`MASTRA_EVENTED_EXECUTION=true` invoking a tool that returns the full
codec-soak payload — completes with `SUCCESS`, no
`AGENT_GENERATE_MALFORMED_RESULT`, snapshot persisted, trace recorded
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5
When the agentic loop runs on the evented setup, it may pause/resume and
also send workflow updates between processes. This PR ensures only “safe
data” crosses the wire (so types aren’t corrupted), while “live stuff”
like class instances and runtime handles stays in a per-run in-memory
space.
---
## Overview
This PR makes the agentic-loop evented-engine path serialization-safe
by:
1) introducing a per-run `RunScope` scratch space for runtime-only state
that must never be serialized/published, and
2) adding a codec layer at the `UnixSocketPubSub` boundary so JSON-safe
frames can round-trip rich values across processes.
---
## Key Changes
### Core Infrastructure: per-run `RunScope` scratch space
- Added a `RunScope` abstraction using typed `RunScopeKey<T>` symbol
keys backed by a `Map` for runtime-only values.
- `Mastra` now manages `RunScope` lifecycles per `runId` using
refcounting:
- allocated on internal workflow registration
- released on unregistration
- released by TTL eviction using stored metadata (no fragile key
parsing)
- Added `hydrateRunScopeFromInternal(mastra, runId, internal?)` to
bootstrap selected inputs from the legacy `StreamInternal` `_internal`
bag into `RunScope` when runs start/resume.
- Added typed helpers:
- `readScoped(ctx, key, internalField)` (prefer `RunScope`, fallback to
`_internal`)
- `writeScoped(ctx, key, internalField, value)` (write to `RunScope` and
mirror to `_internal` for legacy behavior)
### Codec at the `UnixSocketPubSub` boundary
- Implemented tagged, JSON-safe `encode`/`decode` for pubsub frames to
preserve:
- `Date`, `Error` (including `cause` chains and enumerable custom
fields), `Map`, `Set`, `RegExp`, `URL`, `BigInt`, and explicit
`undefined`
- registered class instances via a class codec registry
- Hardened codec behavior:
- cycle-safe encoding (recurrence handled to match JSON-style semantics)
- bounded/validated `RegExp` decoding to avoid hostile reconstruction
- malformed/unknown envelopes decode safely as plain data
- Updated `UnixSocketPubSub` to route frames through `encode`/`decode`
wrappers (`serializeFrame` / `readFrames`).
- Kept local/same-process delivery behavior from unnecessarily
rehydrating objects by bypassing codec where appropriate.
- Refactored the local redelivery budget constant to module scope
(`MAX_LOCAL_REDELIVERIES`).
### Tree-shaking fix for built-in codec registrations
- Ensured built-in codec registrations are not dropped by bundlers with
`sideEffects: false` by gating them behind a named export:
- `BUILTIN_CODECS_REGISTERED`
- Codec encoding validates that built-in registrations are present
before use.
---
## Workflow Migration
### `prepare-stream`: move shared state into RunScope keys
- Migrated internal step sharing to typed `RunScope` keys
(`MESSAGE_LIST_KEY`, `CONVERTED_TOOLS_KEY`, `PROCESSOR_STATES_KEY`,
`INITIAL_SIGNAL_ECHOES_KEY`, `LOOP_OPTIONS_KEY`) using
`runScope.get/set`.
- Refactored `PrepareStreamRunScope` to be an alias of the shared
`RunScope` type.
- Marked `StreamInternal` usage/dependencies as deprecated guidance.
### Agentic execution / agentic loop: scoped state via `readScoped` /
`writeScoped`
- Migrated multiple steps to store and read runtime values from
`RunScope` instead of mutating `_internal`, including:
- `llm-execution-step`, `tool-call-step`, `llm-mapping-step`,
`signal-drain-step`, `background-task-check-step`,
`is-task-complete-step`
- Updated agentic loop control flow to consult/update scoped keys (e.g.,
pending signals, messageId generation, delegation-bailed flag) rather
than mutating `_internal`.
- Preserved backward compatibility by mirroring writes to `_internal`
when present and hydrating supported bootstrap inputs into the scope at
loop start.
---
## Deprecation / Compatibility
- `_internal` / `StreamInternal` remains supported, with `@deprecated`
JSDoc steering new logic toward `RunScope`.
- Scoped helpers bridge `RunScope` and `_internal` so existing
expectations continue to work.
---
## Tests Added/Expanded
- Codec boundary tests: comprehensive round-trips and resilience cases
(Date/Error/Map/Set/RegExp/URL/BigInt/undefined, cycles, hostile inputs,
envelope/tag collisions, class registry preservation).
- Unix socket end-to-end tests: codec round-trips over a real
broker↔client connection, including `DefaultGeneratedFile` and nested
mixed payloads.
- Cross-process regression: detects codec/class-registry loss caused by
tree-shaking.
- RunScope invariants: lifecycle, refcounting, register/unregister
pairing, TTL eviction, and isolation/leak-vector behavior.
- Workflow serialization/type preservation:
- serialization invariants for agentic execution/loop schemas (ensuring
only JSON-safe fields are in advertised output schemas)
- end-to-end payload type preservation across default vs evented engines
- invariant test tying UnixSocketPubSub local redelivery budget to
consumer retry attempts.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Mastra Code (anthropic/claude-opus-4-7) <noreply@mastra.ai>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: NikAiyer <nick.aiyer@gmail.com>
|
||
|
|
5f212aa373 |
chore: version packages (alpha) (#18189)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
315cfa1c64 |
fix(@mastra/google-cloud-pubsub): handle concurrent init race on ungrouped topics (#18252)
## Description When a producer (`agent.stream()`) and a consumer (`agent.observe()`) subscribe to the same fresh topic at nearly the same time, the observe attach can throw `Failed to subscribe to topic`. Both calls reach `init()` within Pub/Sub's subscription-creation window and call `createSubscription` for the same name. One wins; the other gets `ALREADY_EXISTS` (gRPC code 6). The old catch block only re-attached to the existing subscription when a `group` was set, so for an ungrouped topic `init()` fell through and returned `undefined`, and `subscribe()` then threw. Re-attaching on `ALREADY_EXISTS` alone isn't enough: the two racing calls still construct two separate subscription objects for one underlying Pub/Sub subscription. The second object is a fresh handle, so the `isOpen` guard in `subscribe()` doesn't apply to it and it opens its own stream, and only one object ends up tracked in `activeSubscriptions` — the other is never closed on `unsubscribe`, leaving an open pull that never acks and gets redelivered. So the fix does two things: - Coalesce concurrent `init()` calls with an in-flight promise keyed on the subscription key, so racing subscribers share a single `createSubscription` and a single subscription object. - On `ALREADY_EXISTS`, attach to the existing subscription regardless of `group`. This still helps for the genuine cases where the subscription already exists from another process or survived a restart. ## Related issue(s) Fixes #18203 ## Type of change - [x] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Code refactoring - [ ] Performance improvement - [ ] Test update ## Checklist - [x] I have linked the related issue(s) in the description above - [ ] I have made corresponding changes to the documentation (if applicable) - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have addressed all Coderabbit comments on this PR ## ELI5 If two things try to set up the same Pub/Sub subscription at the exact same time, one can “win” and the other can mistakenly crash with an error. This PR makes the second one wait/share the first setup, and if it still hits “already exists,” it just connects to the subscription that’s already there. ## Problem A race condition in the Google Cloud Pub/Sub adapter caused concurrent initialization calls to fail when a producer (`agent.stream()`) and consumer (`agent.observe()`) subscribed to the same fresh **ungrouped** topic simultaneously. Both calls could enter `init()` and both attempt `createSubscription` for the same subscription name during Pub/Sub’s subscription-creation window. The “losing” call receives `ALREADY_EXISTS` (gRPC code 6), and the previous logic only re-attached on `ALREADY_EXISTS` when a `group` was set—so for ungrouped topics `init()` could fall through and `subscribe()` threw “Failed to subscribe to topic.” ## Solution The fix adds two complementary behaviors: 1. **Coalesce concurrent `init()` calls**: introduces an in-flight promise map keyed by the subscription key so racing callers share one in-progress `createSubscription` attempt and the resulting subscription object. 2. **Reconnect on `ALREADY_EXISTS` for all topics**: on `ALREADY_EXISTS` (code 6), the adapter now re-attaches to the existing subscription **regardless of whether `group` is set**, improving both the startup race and resilience after restarts. ## Changes - **`pubsub/google-cloud-pubsub/src/index.ts`** - Add `inFlightInit` to coalesce concurrent `init()` calls. - Update `init(topicName: string, group?: string)` to re-attach on `ALREADY_EXISTS` even when ungrouped. - Ensure `inFlightInit` is cleared in a `finally` block and cache the resolved subscription in `activeSubscriptions`. - **`pubsub/google-cloud-pubsub/src/group.test.ts`** - Add concurrent-subscribe test for fresh **ungrouped** topics (verifies both callbacks receive the message). - Add recovery test that pre-creates the expected subscription out-of-band to force the adapter’s `ALREADY_EXISTS` path and verify re-attachment works. - **`.changeset/silly-pubsub-race.md`** - Mark as a **patch** release noting the startup-window race fix for `@mastra/google-cloud-pubsub`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 Imagine two kids trying to grab the same toy at the same time - both reach for it and get confused. This PR fixes a similar problem in Google Cloud's message system where two parts of the code try to start listening to the same topic simultaneously and one ends up failing. The fix makes them take turns politely (they wait for each other) and if one still gets rejected, they just share what the other one got instead of giving up. ## Summary This PR fixes a **startup-window race condition** in the Google Cloud Pub/Sub adapter where concurrent subscribers to the same ungrouped topic fail during simultaneous initialization. ### The Problem When `agent.stream()` (producer) and `agent.observe()` (consumer) subscribe to the same fresh ungrouped topic within GCP's ~9-second subscription-creation window, both call `init()` and attempt to `createSubscription` for the same subscription name. The loser receives an `ALREADY_EXISTS` error (gRPC code 6). The original error-handling only re-attached to existing subscriptions when a `group` was configured; for ungrouped topics, `init()` returned `undefined`, causing `subscribe()` to fail. ### The Solution Two complementary changes ensure concurrent subscribers cooperate: 1. **Concurrent `init()` call coalescing**: A new `inFlightInit` map caches in-flight promises keyed by subscription key. Racing callers reuse the same promise and share the resulting subscription object, eliminating duplicate `createSubscription` attempts. 2. **Re-attach on `ALREADY_EXISTS` for all topics**: The error handler now re-attaches to existing subscriptions regardless of group configuration. This provides resilience whether subscriptions already exist from concurrent processes or survive process restarts. ### Changes - **`.changeset/silly-pubsub-race.md`**: Adds a patch-level changeset documenting the race condition fix for ungrouped topics. - **`pubsub/google-cloud-pubsub/src/group.test.ts`**: Adds two test cases covering issue `#18203`: - Concurrent concurrent `subscribe()` calls on a fresh ungrouped topic (without awaiting between calls), verifying both subscribers receive published messages. - Pre-created subscription scenario where the adapter encounters `ALREADY_EXISTS` and re-attaches successfully. - Includes resource cleanup in try/finally to prevent client leaks. - **`pubsub/google-cloud-pubsub/src/index.ts`**: Refactors `GoogleCloudPubSub.init()` to: - Check the `inFlightInit` map and reuse existing promises for the same subscription key - Clear the in-flight entry in a `finally` block to permit retries on subsequent calls - Attach to existing subscriptions on `ALREADY_EXISTS` (error code 6) for all topics, not just grouped ones - Record successfully resolved subscriptions into `activeSubscriptions[subscriptionKey]` <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Anurag Ojha <aojharaj2004@gmail.com> |
||
|
|
7a8a8243bb | chore: version - exit prerelease mode | ||
|
|
faae1eb9e0 |
chore: version packages (alpha) (#18159)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. ⚠️⚠️⚠️⚠️⚠️⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`. ⚠️⚠️⚠️⚠️⚠️⚠️ # Releases > The changelog information of each package has been omitted from this message, as the content exceeds the size limit. ## @mastra/acp@0.3.0-alpha.0 ## @mastra/claude@0.3.0-alpha.0 ## @mastra/cursor@0.3.0-alpha.0 ## @mastra/openai@1.1.0-alpha.0 ## @mastra/auth-auth0@1.2.0-alpha.0 ## @mastra/auth-better-auth@1.1.0-alpha.0 ## @mastra/auth-clerk@1.2.0-alpha.0 ## @mastra/auth-cloud@1.2.0-alpha.0 ## @mastra/auth-firebase@1.1.0-alpha.0 ## @mastra/auth-neon@0.3.0-alpha.0 ## @mastra/auth-okta@0.1.0-alpha.0 ## @mastra/auth-studio@1.3.0-alpha.0 ## @mastra/auth-supabase@1.1.0-alpha.0 ## @mastra/auth-workos@1.6.0-alpha.0 ## @mastra/agent-browser@0.4.0-alpha.0 ## @mastra/browser-viewer@0.2.0-alpha.0 ## @mastra/browser-firecrawl@0.2.0-alpha.0 ## @mastra/stagehand@0.3.0-alpha.0 ## @mastra/slack@1.4.0-alpha.0 ## @mastra/ai-sdk@1.5.0-alpha.0 ## @mastra/client-js@1.26.0-alpha.0 ## @mastra/react@1.1.0-alpha.0 ## @mastra/deployer-cloud@1.45.0-alpha.0 ## @mastra/deployer-cloudflare@1.2.0-alpha.0 ## @mastra/deployer-netlify@1.2.0-alpha.0 ## @mastra/deployer-vercel@1.2.0-alpha.0 ## @mastra/voyageai@0.2.0-alpha.0 ## @mastra/longmemeval@1.1.0-alpha.0 ## @mastra/brightdata@0.3.0-alpha.0 ## @mastra/opencode@0.1.0-alpha.0 ## @mastra/perplexity@0.2.0-alpha.0 ## @mastra/tavily@1.1.0-alpha.0 ## mastracode@0.24.0-alpha.0 ## @mastra/arize@1.3.0-alpha.0 ## @mastra/arthur@0.4.0-alpha.0 ## @mastra/braintrust@1.2.0-alpha.0 ## @mastra/datadog@1.3.0-alpha.0 ## @mastra/laminar@1.3.0-alpha.0 ## @mastra/langfuse@1.4.0-alpha.0 ## @mastra/langsmith@1.3.0-alpha.0 ## @mastra/observability@1.15.0-alpha.0 ## @mastra/otel-bridge@1.3.0-alpha.0 ## @mastra/otel-exporter@1.3.0-alpha.0 ## @mastra/posthog@1.1.0-alpha.0 ## @mastra/sentry@1.2.0-alpha.0 ## @mastra/agent-builder@1.1.0-alpha.0 ## @mastra/auth@1.1.0-alpha.0 ## mastra@1.15.0-alpha.0 ## @mastra/codemod@1.1.0-alpha.0 ## @mastra/core@1.45.0-alpha.0 ## create-mastra@1.15.0-alpha.0 ## @mastra/deployer@1.45.0-alpha.0 ## @mastra/editor@0.13.0-alpha.0 ## @mastra/evals@1.4.0-alpha.0 ## @mastra/fastembed@1.2.0-alpha.0 ## @mastra/loggers@1.2.0-alpha.0 ## @mastra/mcp@1.11.0-alpha.0 ## @mastra/mcp-docs-server@1.2.0-alpha.0 ## @mastra/mcp-registry-registry@1.1.0-alpha.0 ## @mastra/memory@1.21.0-alpha.0 ## @mastra/playground-ui@35.0.0-alpha.0 ## @mastra/rag@2.3.0-alpha.0 ## @mastra/schema-compat@1.3.0-alpha.0 ## @mastra/server@1.45.0-alpha.0 ## @mastra/google-cloud-pubsub@1.1.0-alpha.0 ## @mastra/redis-streams@0.1.0-alpha.0 ## @mastra/express@1.4.0-alpha.0 ## @mastra/fastify@1.4.0-alpha.0 ## @mastra/hono@1.5.0-alpha.0 ## @mastra/koa@1.6.0-alpha.0 ## @mastra/nestjs@0.2.0-alpha.0 ## @mastra/github-signals@0.2.0-alpha.0 ## @mastra/astra@1.1.0-alpha.0 ## @mastra/chroma@1.1.0-alpha.0 ## @mastra/clickhouse@1.11.0-alpha.0 ## @mastra/cloudflare@1.5.0-alpha.0 ## @mastra/cloudflare-d1@1.1.0-alpha.0 ## @mastra/convex@1.3.0-alpha.0 ## @mastra/couchbase@1.1.0-alpha.0 ## @mastra/dsql@1.1.0-alpha.0 ## @mastra/duckdb@1.5.0-alpha.0 ## @mastra/dynamodb@1.1.0-alpha.0 ## @mastra/elasticsearch@1.3.0-alpha.0 ## @mastra/lance@1.1.0-alpha.0 ## @mastra/libsql@1.14.0-alpha.0 ## @mastra/mongodb@1.10.0-alpha.0 ## @mastra/mssql@1.4.0-alpha.0 ## @mastra/mysql@0.2.0-alpha.0 ## @mastra/opensearch@1.1.0-alpha.0 ## @mastra/pg@1.14.0-alpha.0 ## @mastra/pinecone@1.1.0-alpha.0 ## @mastra/qdrant@1.1.0-alpha.0 ## @mastra/redis@1.2.0-alpha.0 ## @mastra/s3vectors@1.1.0-alpha.0 ## @mastra/spanner@1.2.0-alpha.0 ## @mastra/turbopuffer@1.1.0-alpha.0 ## @mastra/upstash@1.2.0-alpha.0 ## @mastra/vectorize@1.1.0-alpha.0 ## @mastra/voice-aws-nova-sonic@0.2.0-alpha.0 ## @mastra/voice-azure@0.12.0-alpha.0 ## @mastra/voice-cloudflare@0.13.0-alpha.0 ## @mastra/voice-deepgram@0.13.0-alpha.0 ## @mastra/voice-elevenlabs@0.13.0-alpha.0 ## @mastra/voice-gladia@0.13.0-alpha.0 ## @mastra/voice-google@0.13.0-alpha.0 ## @mastra/voice-google-gemini-live@0.13.0-alpha.0 ## @mastra/voice-inworld@0.4.0-alpha.0 ## @mastra/voice-modelslab@0.2.0-alpha.0 ## @mastra/voice-murf@0.13.0-alpha.0 ## @mastra/voice-openai@0.13.0-alpha.0 ## @mastra/voice-openai-realtime@0.13.0-alpha.0 ## @mastra/voice-playai@0.13.0-alpha.0 ## @mastra/voice-sarvam@1.1.0-alpha.0 ## @mastra/voice-speechify@0.13.0-alpha.0 ## @mastra/voice-xai-realtime@0.2.0-alpha.0 ## @mastra/inngest@1.6.0-alpha.0 ## @mastra/temporal@0.2.0-alpha.0 ## @mastra/agentcore@0.3.0-alpha.0 ## @mastra/agentfs@0.2.0-alpha.0 ## @mastra/azure@0.3.0-alpha.0 ## @mastra/blaxel@0.5.0-alpha.0 ## @mastra/daytona@0.5.0-alpha.0 ## @mastra/docker@0.4.0-alpha.0 ## @mastra/e2b@0.4.0-alpha.0 ## @mastra/files-sdk@0.3.0-alpha.0 ## @mastra/gcs@0.3.0-alpha.0 ## @mastra/google-drive@0.2.0-alpha.0 ## @mastra/modal@0.3.0-alpha.0 ## @mastra/railway@0.2.0-alpha.0 ## @mastra/s3@0.6.0-alpha.0 ## @mastra/vercel@1.1.0-alpha.0 ## @observability/test-utils@0.1.0-alpha.0 ## @internal/core@0.1.0-alpha.0 ## @internal/playground@1.15.0-alpha.0 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
17f01b5d9d | chore: version - exit prerelease mode | ||
|
|
ad3243ab43 |
chore: version packages (alpha) (#18057)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com> |
||
|
|
a27d561d37 |
chore(deps): update build tools (#17657) | ||
|
|
331559f184 | chore: version - exit prerelease mode | ||
|
|
c9f884b652 |
chore: version packages (alpha) (#17666)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
bd55b73209 |
chore(deps): update inngest (#17850)
This PR contains the following updates: | Package | Type | Update | Change | Pending | |---|---|---|---|---| | [inngest](https://redirect.github.com/inngest/inngest-js) ([source](https://redirect.github.com/inngest/inngest-js/tree/HEAD/packages/inngest)) | dependencies | minor | [`^4.2.2` -> `^4.5.0`](https://renovatebot.com/diffs/npm/inngest/4.3.0/4.5.0) | `4.5.1` | | [inngest](https://redirect.github.com/inngest/inngest-js) ([source](https://redirect.github.com/inngest/inngest-js/tree/HEAD/packages/inngest)) | dependencies | minor | [`^3.52.6` -> `^3.54.2`](https://renovatebot.com/diffs/npm/inngest/4.3.0/3.54.2) | | | [inngest-cli](https://redirect.github.com/inngest/inngest) | devDependencies | minor | [`^1.17.5` -> `^1.26.0`](https://renovatebot.com/diffs/npm/inngest-cli/1.19.2/1.26.0) | `1.27.0` | --- ### Release Notes <details> <summary>inngest/inngest-js (inngest)</summary> ### [`v4.5.0`](https://redirect.github.com/inngest/inngest-js/blob/HEAD/packages/inngest/CHANGELOG.md#450) [Compare Source](https://redirect.github.com/inngest/inngest-js/compare/inngest@4.4.0...inngest@4.5.0) ##### Minor Changes - [#​1522](https://redirect.github.com/inngest/inngest-js/pull/1522) [`ebeb4516`]( |