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.60.0-alpha.12
### Minor Changes
- Allow `querySpans()` to sort by `model` or `provider`.
([#30096](https://github.com/mastra-ai/mastra/pull/30096))
```ts
orderBy: [{ field: 'model', direction: 'asc' }];
```
### Patch Changes
- The generated route types for scores now include the `SCORER` and
`PROCESSOR` entity types, matching the entity types experiments can
emit. ([#30145](https://github.com/mastra-ai/mastra/pull/30145))
- Add span-local error counts.
([#30088](https://github.com/mastra-ai/mastra/pull/30088))
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
## @mastra/factory@0.28.0-alpha.14
### Minor Changes
- A card's sandbox now stops as soon as the card is done with that
context, instead of idling until the provider times it out.
([#29981](https://github.com/mastra-ai/mastra/pull/29981))
- When a card moves out of the last phase of a context into a phase that
runs in another one, Factory stops that context's sandbox. Triage →
Planning stops the triage sandbox; Planning → Building keeps the shared
`work` sandbox running. A run still in flight on the session keeps its
sandbox until it ends.
- When a card finishes, Factory stops every sandbox it holds, from any
Factory process, by identity through the configured sandbox provider.
Before, only the process that had opened a sandbox stopped it.
- A card that comes back to a context resumes the same sandbox with its
files.
Stopping never fails the move. Sandboxes are stopped, not destroyed;
deleting a session still destroys its sandbox.
- Added two read routes that answer what the new session page shows
without sending a project's cards.
([#30097](https://github.com/mastra-ai/mastra/pull/30097))
`GET /web/factory/projects/:id/work-items/starters` counts the cards
behind each starter on the project's default board, such as the cards
whose run failed, the pull requests awaiting review and the cards not
yet triaged.
`GET /web/factory/projects/:id/work-items/activity?since=<instant>`
returns how many cards the project has, and when cards were created and
completed since that instant. `since` is required and must be an ISO
date-time such as `2026-06-01T00:00:00.000Z`. The answer carries an
`ETag`, so asking again for the same `since` with `If-None-Match`
returns a 304 with no body when nothing changed.
### Patch Changes
- Fixed environment templates that could stop rebuilding for good. When
a build start was never recorded and the sandbox provider can't list its
builds (Mastra Platform), every later Build now, schedule and push run
used to skip with `unresolved` forever. Factory now treats that start as
failed 30 minutes after its lease lapsed and the next trigger builds.
([#30148](https://github.com/mastra-ai/mastra/pull/30148))
Saving a change to a template input (setup commands, the working
directory, settings, environment repositories, source-control
connections or Build variables) now rebuilds the template once the
project has one, so new sandboxes stop rerunning setup on every boot.
Saves that change nothing don't build, and a change saved during any
build, scheduled ones included, is built when that build ends.
- Factory sessions and MCP clients can now read the Factory's audit
trail with `factory_list_audit_events`: who did what to which work item,
run, branch or setting, and when. Filter by actor (`me`, a user id, or
an agent, optionally with the agent runs a person started), namespace or
exact actions, work item and time range, and page back with a cursor.
The tool only returns this Factory's events and never returns request
context (IP address, user agent), actor emails or event metadata beyond
who started an agent run. It leaves out events from or about other
people's private sessions.
([#30165](https://github.com/mastra-ai/mastra/pull/30165))
- Added a "Join the issue's card instead" switch to intake routes in the
Factory UI. A route for pull requests that close an issue can now put
the pull request on that issue's card instead of giving it a card of its
own; until now only the route Factory seeds could do this. The switch
shows on new and saved routes whose conditions include "Source kind is
Pull request" and "Pull request closes an issue is Yes".
([#30197](https://github.com/mastra-ai/mastra/pull/30197))
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/code-sdk@1.19.0-alpha.14
- @mastra/mcp@2.9.0-alpha.4
## @mastra/observability@1.24.0-alpha.7
### Minor Changes
- Add span-local error counts.
([#30088](https://github.com/mastra-ai/mastra/pull/30088))
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
## @mastra/core@1.83.0-alpha.12
### Minor Changes
- Add model and provider as span query sort fields.
([#30096](https://github.com/mastra-ai/mastra/pull/30096))
```ts
orderBy: [{ field: 'model', direction: 'asc' }];
```
- Add span-local error counts.
([#30088](https://github.com/mastra-ai/mastra/pull/30088))
### Patch Changes
- Name the agent in the missing-storage error thrown by `Memory`. When
an agent's memory never received storage because the agent was never
attached to a Mastra instance, accessing `memory.storage` now fails with
`[Agent:<name>] Memory requires a storage provider to function. ...`, so
it is clear which agent is misconfigured. The registration and
standalone-storage guidance added in #29972 is unchanged, and agents
that inherit storage from their Mastra or configure it directly on
`Memory` are unaffected.
([#30164](https://github.com/mastra-ai/mastra/pull/30164))
- Experiments with a scorer or processor target now save their scores,
and workflow step scorers in experiments now save their step scores.
Previously these scores were silently discarded.
([#30145](https://github.com/mastra-ai/mastra/pull/30145))
## @mastra/mcp-apps-components@0.1.0-alpha.7
### Minor Changes
- Dashboards authored in chat now accept the same widgets as the
dashboard editor: KPIs that combine values (ratio, difference, max,
fallback), read trace, span or score aggregates (for example p95 span
duration) and use duration, percent or score formats; line charts of
scores; six more chart colors (blue, orange, pink, yellow, red, purple);
and optional KPI icon and detail, series color and table empty message.
([#30192](https://github.com/mastra-ai/mastra/pull/30192))
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
## @mastra/playground-ui@69.0.0-alpha.14
### Minor Changes
- Widened what dashboard widgets can show:
([#30192](https://github.com/mastra-ai/mastra/pull/30192))
- KPIs can combine values with `ratio`, `minus`, `max` and `coalesce`,
read trace and span aggregates (for example `duration.p95`) and score
aggregates, and are formatted as `duration`, `percent` or `score`.
Combined values are compared with the previous window.
- Charts accept six more colors: `blue`, `orange`, `pink`, `yellow`,
`red` and `purple`.
- KPI `icon` and `detail`, series `color` and table `emptyMessage` are
optional. Series without a color pick one from a palette, and tables
without an empty message show "No data".
### Patch Changes
- Fixed hover highlights on cards and other surfaces stopping short of
the edge. The highlight now covers the whole surface and follows its
rounded corners exactly, including the sidebar credits card and
clickable cards. Hover highlights on these surfaces now switch instantly
instead of fading.
([#30047](https://github.com/mastra-ai/mastra/pull/30047))
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`987566e`](987566e882),
[`72abae6`](72abae68eb),
[`987566e`](987566e882),
[`f071044`](f0710446e0)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/client-js@1.60.0-alpha.12
- @mastra/react@1.15.0-alpha.12
## @mastra/server@1.83.0-alpha.12
### Minor Changes
- Support model and provider sorting in span queries.
([#30096](https://github.com/mastra-ai/mastra/pull/30096))
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
## @mastra/clickhouse@1.30.0-alpha.4
### Minor Changes
- Sort span queries by model or provider in ascending or descending
order. ([#30096](https://github.com/mastra-ai/mastra/pull/30096))
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
## @mastra/duckdb@1.19.0-alpha.5
### Minor Changes
- Sort span queries by model or provider in ascending or descending
order. ([#30096](https://github.com/mastra-ai/mastra/pull/30096))
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
## @mastra/pg@1.36.0-alpha.6
### Minor Changes
- Sort span queries by model or provider in ascending or descending
order. ([#30096](https://github.com/mastra-ai/mastra/pull/30096))
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
## @mastra/react@1.15.0-alpha.12
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`987566e`](987566e882),
[`72abae6`](72abae68eb),
[`987566e`](987566e882),
[`f071044`](f0710446e0)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/client-js@1.60.0-alpha.12
## @mastra/deployer-cloud@1.83.0-alpha.12
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/deployer@1.83.0-alpha.12
## @mastra/longmemeval@1.1.42-alpha.12
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/libsql@1.30.0-alpha.3
## @mastra/opencode@0.1.42-alpha.12
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/libsql@1.30.0-alpha.3
## create-factory@0.4.3-alpha.14
### Patch Changes
- Updated dependencies
[[`1fbc69a`](1fbc69aa9a),
[`4e378c3`](4e378c3e26),
[`1fbc69a`](1fbc69aa9a)]:
- mastra@1.39.0-alpha.14
## @mastra/code-sdk@1.19.0-alpha.14
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`72abae6`](72abae68eb),
[`f071044`](f0710446e0),
[`f071044`](f0710446e0),
[`987566e`](987566e882),
[`72abae6`](72abae68eb),
[`987566e`](987566e882),
[`f071044`](f0710446e0),
[`f071044`](f0710446e0)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/observability@1.24.0-alpha.7
- @mastra/duckdb@1.19.0-alpha.5
- @mastra/client-js@1.60.0-alpha.12
- @mastra/pg@1.36.0-alpha.6
- @mastra/mcp@2.9.0-alpha.4
- @mastra/libsql@1.30.0-alpha.3
## mastracode@0.50.0-alpha.13
### Patch Changes
- Fix `/settings` crashing when mouse preferences are missing from saved
settings by defaulting to Off.
([#30184](https://github.com/mastra-ai/mastra/pull/30184))
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`72abae6`](72abae68eb),
[`f071044`](f0710446e0),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882),
[`f071044`](f0710446e0)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/observability@1.24.0-alpha.7
- @mastra/duckdb@1.19.0-alpha.5
- @mastra/pg@1.36.0-alpha.6
- @mastra/code-sdk@1.19.0-alpha.14
- @mastra/mcp@2.9.0-alpha.4
- @mastra/libsql@1.30.0-alpha.3
## @mastra/arize@1.3.30-alpha.7
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/otel-exporter@1.5.2-alpha.7
## @mastra/arthur@0.4.30-alpha.7
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/otel-exporter@1.5.2-alpha.7
## @mastra/braintrust@1.3.27-alpha.7
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`72abae6`](72abae68eb),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/observability@1.24.0-alpha.7
## @mastra/datadog@1.4.22-alpha.7
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`72abae6`](72abae68eb),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/observability@1.24.0-alpha.7
## @mastra/deepeval@0.1.24-alpha.7
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`72abae6`](72abae68eb),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/observability@1.24.0-alpha.7
## @mastra/laminar@1.3.32-alpha.7
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`72abae6`](72abae68eb),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/observability@1.24.0-alpha.7
## @mastra/langfuse@1.6.6-alpha.7
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`72abae6`](72abae68eb),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/observability@1.24.0-alpha.7
- @mastra/otel-exporter@1.5.2-alpha.7
## @mastra/langsmith@1.4.3-alpha.7
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`72abae6`](72abae68eb),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/observability@1.24.0-alpha.7
## @mastra/otel-bridge@1.5.22-alpha.7
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`72abae6`](72abae68eb),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/observability@1.24.0-alpha.7
- @mastra/otel-exporter@1.5.2-alpha.7
## @mastra/otel-exporter@1.5.2-alpha.7
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`72abae6`](72abae68eb),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/observability@1.24.0-alpha.7
## @mastra/posthog@1.4.7-alpha.7
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`72abae6`](72abae68eb),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/observability@1.24.0-alpha.7
## @mastra/sentry@1.2.32-alpha.7
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`72abae6`](72abae68eb),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/observability@1.24.0-alpha.7
- @mastra/otel-exporter@1.5.2-alpha.7
## mastra@1.39.0-alpha.14
### Patch Changes
- Added `mastra api factory work-item starters` and `mastra api factory
work-item activity`. The first counts the cards behind each new-session
starter on a project's default board. The second lists when a project's
cards were created and completed since an instant:
([#30097](https://github.com/mastra-ai/mastra/pull/30097))
```bash
mastra api factory work-item starters <project-id>
mastra api factory work-item activity <project-id>
'{"since":"2026-06-01T00:00:00.000Z"}'
```
- Added a "Join the issue's card instead" switch to intake routes in the
Factory UI. A route for pull requests that close an issue can now put
the pull request on that issue's card instead of giving it a card of its
own; until now only the route Factory seeds could do this. The switch
shows on new and saved routes whose conditions include "Source kind is
Pull request" and "Pull request closes an issue is Yes".
([#30197](https://github.com/mastra-ai/mastra/pull/30197))
- Improved the Factory new session page on large boards. Its starters
and its activity band now load the counts and dates they show instead of
downloading every card of the project. They show the same content as
before. ([#30097](https://github.com/mastra-ai/mastra/pull/30097))
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/deployer@1.83.0-alpha.12
## @mastra/deployer@1.83.0-alpha.12
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/server@1.83.0-alpha.12
## @mastra/mcp-docs-server@1.3.13-alpha.16
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
## @mastra/elysia@0.1.23-alpha.12
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/server@1.83.0-alpha.12
## @mastra/express@1.5.27-alpha.12
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/server@1.83.0-alpha.12
## @mastra/fastify@1.5.27-alpha.12
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/server@1.83.0-alpha.12
## @mastra/hono@1.7.25-alpha.12
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/server@1.83.0-alpha.12
## @mastra/koa@1.7.27-alpha.12
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/server@1.83.0-alpha.12
## @mastra/nestjs@0.3.0-alpha.12
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/server@1.83.0-alpha.12
## @mastra/next@0.2.41-alpha.12
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/server@1.83.0-alpha.12
- @mastra/hono@1.7.25-alpha.12
## @mastra/tanstack-start@0.2.41-alpha.12
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/server@1.83.0-alpha.12
- @mastra/hono@1.7.25-alpha.12
## @mastra/voice-openai-realtime@0.14.9-alpha.2
### Patch Changes
- Use gpt-realtime-2.1-mini by default for OpenAI Realtime voice
connections instead of the retired
gpt-4o-mini-realtime-preview-2024-12-17 model.
([#30183](https://github.com/mastra-ai/mastra/pull/30183))
## @mastra/inngest@1.11.2-alpha.8
### Patch Changes
- Support span-local error counts in Inngest workflows.
([#30088](https://github.com/mastra-ai/mastra/pull/30088))
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
## @mastra/temporal@0.6.0-alpha.12
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`72abae6`](72abae68eb),
[`987566e`](987566e882)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/deployer@1.83.0-alpha.12
## create-mastra@1.39.0-alpha.14
## @internal/playground@1.39.0-alpha.14
### Patch Changes
- Updated dependencies
[[`56f654f`](56f654fc0d),
[`f071044`](f0710446e0),
[`987566e`](987566e882),
[`72abae6`](72abae68eb),
[`f9088d8`](f9088d8510),
[`987566e`](987566e882),
[`f071044`](f0710446e0),
[`43d1e9c`](43d1e9c16d)]:
- @mastra/core@1.83.0-alpha.12
- @mastra/client-js@1.60.0-alpha.12
- @mastra/playground-ui@69.0.0-alpha.14
- @mastra/react@1.15.0-alpha.12
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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/slack@1.9.0-alpha.0
## @mastra/factory@0.28.0-alpha.3
## @mastra/code-sdk@1.19.0-alpha.3
## mastracode@0.50.0-alpha.3
## @mastra/observability@1.24.0-alpha.2
## @mastra/core@1.83.0-alpha.3
## @mastra/mcp-apps-components@0.1.0-alpha.3
## @mastra/playground-ui@69.0.0-alpha.4
## @mastra/server@1.83.0-alpha.3
## @mastra/server-adapters-test-suite@0.3.0-alpha.1
## @mastra/platform-workspace@1.13.0-alpha.0
## @mastra/auth-better-auth@1.1.11-alpha.1
## @mastra/client-js@1.60.0-alpha.3
## @mastra/react@1.15.0-alpha.3
## @mastra/deployer-cloud@1.83.0-alpha.3
## @mastra/longmemeval@1.1.42-alpha.3
## @mastra/opencode@0.1.42-alpha.3
## create-factory@0.4.3-alpha.3
## @mastra/arize@1.3.30-alpha.2
## @mastra/arthur@0.4.30-alpha.2
## @mastra/braintrust@1.3.27-alpha.2
## @mastra/datadog@1.4.22-alpha.2
## @mastra/deepeval@0.1.24-alpha.2
## @mastra/laminar@1.3.32-alpha.2
## @mastra/langfuse@1.6.6-alpha.2
## @mastra/langsmith@1.4.3-alpha.2
## @mastra/otel-bridge@1.5.22-alpha.2
## @mastra/otel-exporter@1.5.2-alpha.2
## @mastra/posthog@1.4.7-alpha.2
## @mastra/sentry@1.2.32-alpha.2
## @mastra/agent-builder@1.2.1-alpha.1
## mastra@1.39.0-alpha.3
## @mastra/connect@1.3.2-alpha.2
## @mastra/deployer@1.83.0-alpha.3
## @mastra/editor@0.17.1-alpha.2
## @mastra/fastembed@1.3.7-alpha.0
## @mastra/mcp-docs-server@1.3.13-alpha.6
## @mastra/memory@1.41.1-alpha.1
## @mastra/elysia@0.1.23-alpha.3
## @mastra/express@1.5.27-alpha.3
## @mastra/fastify@1.5.27-alpha.3
## @mastra/hono@1.7.25-alpha.3
## @mastra/koa@1.7.27-alpha.3
## @mastra/nestjs@0.3.0-alpha.3
## @mastra/next@0.2.41-alpha.3
## @mastra/tanstack-start@0.2.41-alpha.3
## @mastra/convex@1.8.1-alpha.0
## @mastra/pg@1.36.0-alpha.2
## @mastra/inngest@1.11.2-alpha.2
## @mastra/temporal@0.6.0-alpha.3
## create-mastra@1.39.0-alpha.3
## @internal/playground@1.39.0-alpha.3
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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/client-js@1.60.0-alpha.0
## @mastra/react@1.15.0-alpha.0
## @mastra/factory@0.28.0-alpha.0
## @mastra/code-sdk@1.19.0-alpha.0
## mastra@1.39.0-alpha.0
## @mastra/core@1.83.0-alpha.0
## @mastra/mcp@2.9.0-alpha.0
## @mastra/mcp-apps-components@0.1.0-alpha.0
## @mastra/playground-ui@69.0.0-alpha.0
## @mastra/server@1.83.0-alpha.0
## @mastra/nestjs@0.3.0-alpha.0
## @mastra/clickhouse@1.30.0-alpha.0
## @mastra/duckdb@1.19.0-alpha.0
## @mastra/libsql@1.30.0-alpha.0
## @mastra/pg@1.36.0-alpha.0
## @mastra/temporal@0.6.0-alpha.0
## @mastra/auth-better-auth@1.1.11-alpha.0
## @mastra/deployer-cloud@1.83.0-alpha.0
## @mastra/deployer-cloudflare@1.2.42-alpha.0
## @mastra/deployer-netlify@1.2.42-alpha.0
## @mastra/deployer-sandbox@0.3.27-alpha.0
## @mastra/deployer-vercel@1.2.42-alpha.0
## @mastra/longmemeval@1.1.42-alpha.0
## @mastra/opencode@0.1.42-alpha.0
## create-factory@0.4.3-alpha.0
## mastracode@0.49.1-alpha.0
## @mastra/arize@1.3.30-alpha.0
## @mastra/arthur@0.4.30-alpha.0
## @mastra/braintrust@1.3.27-alpha.0
## @mastra/datadog@1.4.22-alpha.0
## @mastra/deepeval@0.1.24-alpha.0
## @mastra/laminar@1.3.32-alpha.0
## @mastra/langfuse@1.6.6-alpha.0
## @mastra/langsmith@1.4.3-alpha.0
## @mastra/observability@1.23.2-alpha.0
## @mastra/otel-bridge@1.5.22-alpha.0
## @mastra/otel-exporter@1.5.2-alpha.0
## @mastra/posthog@1.4.7-alpha.0
## @mastra/sentry@1.2.32-alpha.0
## @mastra/agent-builder@1.2.1-alpha.0
## @mastra/connect@1.3.2-alpha.0
## create-mastra@1.39.0-alpha.0
## @mastra/deployer@1.83.0-alpha.0
## @mastra/editor@0.17.1-alpha.0
## @mastra/mcp-docs-server@1.3.13-alpha.0
## @mastra/memory@1.41.1-alpha.0
## @mastra/rag@2.7.3-alpha.0
## @mastra/redis-streams@0.8.1-alpha.0
## @mastra/elysia@0.1.23-alpha.0
## @mastra/express@1.5.27-alpha.0
## @mastra/fastify@1.5.27-alpha.0
## @mastra/hono@1.7.25-alpha.0
## @mastra/koa@1.7.27-alpha.0
## @mastra/next@0.2.41-alpha.0
## @mastra/tanstack-start@0.2.41-alpha.0
## @mastra/spanner@1.11.2-alpha.0
## @mastra/turso@0.1.21-alpha.0
## @mastra/inngest@1.11.2-alpha.0
## @mastra/gcs@0.3.6-alpha.0
## @internal/playground@1.39.0-alpha.0
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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/client-js@1.59.0-alpha.2
## @mastra/factory@0.27.0-alpha.2
## @mastra/code-sdk@1.18.0-alpha.2
## mastra@1.38.0-alpha.2
## @mastra/core@1.82.0-alpha.2
## @mastra/editor@0.17.0-alpha.2
## @mastra/server@1.82.0-alpha.2
## @mastra/clickhouse@1.29.0-alpha.1
## @mastra/duckdb@1.18.0-alpha.1
## @mastra/pg@1.35.0-alpha.2
## @mastra/platform-workspace@1.12.0-alpha.1
## @mastra/react@1.14.1-alpha.2
## @mastra/deployer-cloud@1.82.0-alpha.2
## @mastra/deployer-sandbox@0.3.26-alpha.1
## @mastra/longmemeval@1.1.41-alpha.2
## @mastra/opencode@0.1.41-alpha.2
## @mastra/parallel@0.1.5-alpha.0
## create-factory@0.4.2-alpha.2
## mastracode@0.49.0-alpha.2
## @mastra/arize@1.3.29-alpha.1
## @mastra/arthur@0.4.29-alpha.1
## @mastra/braintrust@1.3.26-alpha.1
## @mastra/datadog@1.4.21-alpha.1
## @mastra/deepeval@0.1.23-alpha.1
## @mastra/laminar@1.3.31-alpha.1
## @mastra/langfuse@1.6.5-alpha.1
## @mastra/langsmith@1.4.2-alpha.1
## @mastra/observability@1.23.1-alpha.1
## @mastra/otel-bridge@1.5.21-alpha.1
## @mastra/otel-exporter@1.5.1-alpha.1
## @mastra/posthog@1.4.6-alpha.1
## @mastra/sentry@1.2.31-alpha.2
## @mastra/agent-builder@1.1.33-alpha.2
## @mastra/deployer@1.82.0-alpha.2
## @mastra/mcp@2.8.0-alpha.1
## @mastra/mcp-docs-server@1.3.12-alpha.3
## @mastra/memory@1.41.0-alpha.2
## @mastra/playground-ui@68.0.0-alpha.2
## @mastra/rag@2.7.2-alpha.0
## @mastra/elysia@0.1.22-alpha.2
## @mastra/express@1.5.26-alpha.2
## @mastra/fastify@1.5.26-alpha.2
## @mastra/hono@1.7.24-alpha.2
## @mastra/koa@1.7.26-alpha.2
## @mastra/nestjs@0.2.41-alpha.2
## @mastra/next@0.2.40-alpha.2
## @mastra/tanstack-start@0.2.40-alpha.2
## @mastra/dsql@1.5.6-alpha.0
## @mastra/libsql@1.29.0-alpha.1
## @mastra/mongodb@1.26.0-alpha.1
## @mastra/mssql@1.11.1-alpha.0
## @mastra/mysql@0.16.0-alpha.2
## @mastra/oracledb@0.5.6-alpha.0
## @mastra/spanner@1.11.1-alpha.0
## @mastra/turso@0.1.20-alpha.1
## @mastra/voice-google@0.14.5-alpha.0
## @mastra/inngest@1.11.1-alpha.1
## @mastra/temporal@0.5.0-alpha.2
## @mastra/e2b@0.16.1-alpha.1
## create-mastra@1.38.0-alpha.2
## @internal/playground@1.38.0-alpha.2
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Description
Fills the `timeToFirstTokenMs` span column that #28389 added empty, and
lets trace, span and thread queries return, filter and sort by it. Time
to first token is the time from the start of the model call (the
`model_inference` span) to the first streamed chunk. Unlike
`timeToFirstChunkMs`, it leaves out the work Mastra does before calling
the model.
- The tracker measures the value once, on the `model_inference` span,
when its first chunk arrives, and copies that number up the agent's own
chain (`model_step`, `model_generation`, `agent_run`) as a
`timeToFirstTokenMs` attribute, first write wins, the same way
`completionStartTime` is copied. Each step takes its own inference's
value; the generation and agent run take the first step's.
- Span export reads the attribute. Storage fills the column from it and
drops the key from the attributes JSON. The Platform collector and the
store row mappers already carry the column, so no DDL changes.
- Durable agents (core and `@mastra/inngest`) carry the number through
loop state beside `completionStartTime`, so a fresh tracker on another
worker ends the generation and agent run with both.
- Core contract, ClickHouse, Postgres and DuckDB return, filter and sort
the field. Trace rows use the root span's value. Thread rows use the
first trace's root when it is an agent run. Empty values sort last.
Stores declare `trace-query-time-to-first-token` and `-sort`; the server
returns 501 when a store lacks them.
- A fallback model attempt opens its own `model_inference` span, named
after the model it calls, so its value and label are its own, and a
failed attempt's span ends with its error. Braintrust and LangSmith keep
the attribute out of span metadata.
- Client types regenerated, `useTraceQuery` keeps new traces in order
under the new sort, docs and changesets added. No Studio changes.
- Also fixes two gaps that already affected `timeToFirstChunkMs`:
durable abort and tripwire exits now keep the clocks on the ended spans,
and span aggregation gates the timing field instead of failing inside
the store.
- After a failed model call, in-process agents count the retry wait and
durable agents do not. One test marked expected-to-fail pins that
difference.
Rebased on `main` after #28389 merged.
## Related Issue(s)
N/A (OBS-722 follow-up)
## Type of Change
- [ ] Bug fix (non-breaking change that fixes an issue)
- [x] 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 made corresponding changes to the documentation (if
applicable)
- [x] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have addressed all Coderabbit comments on this PR
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
This change measures how long a model takes to send its first piece of a
response. Supported storage systems can return, filter, and sort by this
time, which helps teams find slow responses.
## Summary
- Records `timeToFirstTokenMs` from the start of a model inference to
its first streamed chunk. The value is added to inference spans and
propagated to related model-step, generation, and agent-run spans.
- Gives each fallback model attempt its own inference span and timing
value. Carries timing across durable agent steps, including resumed runs
and abort or tripwire exits.
- Adds `timeToFirstTokenMs` to trace, span, and thread query results and
predicates. Trace values use the root span. Thread values use the first
trace’s root agent span.
- Adds sorting by this field for trace and span queries in ClickHouse,
PostgreSQL, and DuckDB. Missing values sort last. The server returns
`501` when a store does not support a requested predicate or sort.
- Updates client types, `useTraceQuery`, documentation, storage
capability declarations, and changesets. Braintrust and LangSmith
exporters exclude the field from span metadata.
- Adds and updates tests across tracing, durable workflows, query
handling, and storage conformance. Test execution results were not
provided.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Description
Scores sent with `mastra.observability.addScore()` never reached
LangSmith unless the score named a span id and the same exporter
instance had built that span recently. Trace-level scores were always
dropped, and span-level scores were dropped from another replica, after
a restart, or once the in-memory map had evicted the span. This PR
derives LangSmith run ids from Mastra ids so feedback can be routed from
anywhere.
- Every run id is the UUID v5 of its Mastra span id, roots included
(`langsmithRunIdFor()` is exported for linking from your own UI)
- Span-level scores need no lookup and no local state: the run id is
derived from the span id
- Trace-level scores (`traceId` only) go to the trace's first root run:
remembered in-process, otherwise found in LangSmith by the
`mastra_trace_id` metadata stored on every run, retrying for up to 10s
while a freshly posted run is ingested
- `createFeedback` now passes the id of the project the run was sent to
(`withLangsmithMetadata({ projectName })` overrides included), which
LangSmith marks as required and already rejects on SmithDB-only
deployments
- Docs: scores section on the LangSmith pages, `runIdCacheMaxEntries`
and `langsmithRunIdFor` in the reference
Verified against real LangSmith with the reporter's repro
(https://github.com/denchiklut/mastra-langsmith `pnpm scores`): before,
both cases 0 feedback items; after, both cases 1 feedback item. Also
verified three runs sharing one trace id across two exporter instances
keep three distinct root runs, a trace-level score from a third instance
lands on the earliest root, and scores on a trace routed to another
project carry that project's id.
Notes: the LangSmith SDK prints a one-time warning that it prefers UUID
v7 for custom run ids (v7 needs the span start time, which a score does
not carry). Runs exported before this version keep their old ids and
cannot receive scores from another process, same as before. LangSmith
run queries are project-scoped, so a trace routed to another project
with `withLangsmithMetadata({ projectName })` can take a trace-level
score only from the process that exported it.
## Related Issue(s)
Fixes#28381
## 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)
- [x] Documentation update
- [ ] Code refactoring
- [ ] Performance improvement
- [ ] Test update
## Checklist
- [x] 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
- [ ] I have addressed all Coderabbit comments on this PR
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
This change gives each Mastra span a predictable LangSmith run ID.
Scores can then find the right run even if they come from another
process, and scores for a whole trace can target its earliest root run.
## Changes
- Generate UUID v5 LangSmith run IDs from Mastra span IDs, including
root spans.
- Route span-level scores to the run ID derived from the span ID.
- Route trace-level scores to the earliest root run. Use a local cache
when possible; otherwise query LangSmith and retry while the run becomes
available.
- Include the resolved LangSmith project ID when creating feedback,
including for roots routed to a project override.
- Add and document `langsmithRunIdFor()` and the `runIdCacheMaxEntries`
setting.
- Document score routing and the link between Mastra spans and LangSmith
runs.
If the exporter cannot find a run or submit feedback, it logs the issue;
it does not report failures to the `addScore()` caller. Runs exported
before this change retain their previous IDs, so deterministic
cross-process span scoring does not apply to them. If a trace’s project
is unknown to the exporter, project routing may use the default project
ID.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Description
Multi-turn conversations on one Mastra memory thread showed up in
LangSmith as unrelated root runs, and the project's Threads tab stayed
empty. LangSmith only groups runs into a Thread by `session_id` /
`thread_id` metadata, and the exporter passed Mastra's `threadId`
through unchanged.
- `buildRunTreePayload` now sets `session_id` from
`withLangsmithMetadata({ sessionId })`, then `metadata.sessionId`, then
`metadata.threadId`
- Child runs take the session of their parent run, so every run of the
trace carries it (LangSmith needs this for thread filters and token
counts), and a delegated sub-agent or Observational Memory run, which
runs on a derived thread, stays in the conversation's Thread
- `threadId` is still forwarded as before
- Docs: new "Conversation threads" section on the LangSmith integration
page and reference note on `sessionId`
## Related Issue(s)
Fixes#28380
## 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 made corresponding changes to the documentation (if
applicable)
- [x] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have addressed all Coderabbit comments on this PR
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
This change helps LangSmith group runs from the same Mastra memory
conversation into one thread. It uses the conversation’s session or
thread ID, so users do not need to configure thread grouping manually.
## Summary
- The exporter adds LangSmith’s `metadata.session_id` while preserving
the existing `threadId` metadata.
- For a root run, the exporter uses `withLangsmithMetadata({ sessionId
})` first, then span metadata `sessionId`, then `threadId`.
- For a child run, the exporter uses an explicit LangSmith session ID if
present. Otherwise, it inherits its parent’s `session_id` before
checking its own `sessionId` or `threadId`.
- The LangSmith documentation explains thread grouping and shows how
session IDs are selected.
## Tests
Added tests cover thread ID mapping, session ID precedence, child-run
inheritance, delegated sub-agent runs, and missing or non-string session
IDs. Test execution results were not provided.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Description
Two LangSmith data-loss paths. The `TrackingExporter` hard-cap gap that
feeds one of them moved to #26916 at review request.
- **`manualFlushMode: true` made `flush()` a no-op.**
`LangSmithExporterConfig` extends the SDK `ClientConfig`, and LangSmith
recommends manual flush mode for serverless. In that mode
`client.awaitPendingTraceBatches()` only prints a warning and returns,
so nothing ever drained the queue. The exporter now calls
`client.flush()` when the client is in manual flush mode (read from the
client instance, falling back to the exporter config) and
`awaitPendingTraceBatches()` otherwise. In auto mode
`awaitPendingTraceBatches()` already joins batches that are being sent,
so that path is unchanged. The SDK's manual `flush()` empties its queue
before it uploads, so manual-mode flushes are chained: an overlapping
`flush()` or `shutdown()` resolves only after the earlier upload
finishes.
- **Aborts created by `shutdown()` were never sent.**
`TrackingExporter.shutdown()` ends and patches still-open spans, but the
bus-level flush ran before those updates were queued and
`_postShutdown()` only cleared a map. Runs stayed "pending" in LangSmith
with no end time or error. `_postShutdown()` now flushes the client
before clearing state, and clears the state even if that flush rejects.
- Tests: manual-mode flush waits for `client.flush()`, an overlapping
manual `flush()` / `shutdown()` waits for the earlier upload, shutdown
sends the abort updates before resolving, the run-id map is cleared when
the final flush fails, and a real `langsmith` `Client` (not the mock)
picks `flush()` in manual mode and `awaitPendingTraceBatches()`
otherwise. Seven fail on `main`; the auto-mode tests are guards for
unchanged behavior.
- Docs: `flush()` and `shutdown()` on the LangSmith exporter reference
page describe the manual-mode and shutdown behavior.
Verified against the real LangSmith API (`langsmith` SDK 0.8.9, real
`openai/gpt-5-nano` agent), process exits right after `shutdown()`, runs
read back by id:
| scenario | before (`@mastra/langsmith` 1.3.24) | after |
| --- | --- | --- |
| `manualFlushMode: true`, flush then exit | **0/7 runs** in LangSmith,
three "you must call `await client.flush()`" warnings | **7/7 runs**,
all with end time |
| shutdown while a run is in flight | 5/5 runs created, but **4 left
"running"** with no end time or error | 5/5 runs, **all ended, 4 marked
with the shutdown error** |
| `manualFlushMode: true`, second `flush()` / `shutdown()` while an
upload is in flight (SDK client, 300 ms held upload) | second call
resolved with **0/1 uploads done** | second call resolves with **1/1
uploads done** |
Part F of #26501. The other exporters are separate PRs.
## Related Issue(s)
Part F of #26501.
## 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)
- [x] Documentation update
- [ ] Code refactoring
- [ ] Performance improvement
- [x] Test update
## Checklist
- [x] 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
- [ ] I have addressed all Coderabbit comments on this PR
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5
LangSmith could miss sending trace updates when the exporter flushed
manually or stopped while spans were still open. This change makes those
updates wait for the send to finish and documents the behavior.
## Changes
- In manual flush mode, the exporter calls `client.flush()` and waits
for it to complete. Overlapping flush and shutdown calls wait for the
earlier flush.
- In other modes, the exporter continues to call
`awaitPendingTraceBatches()`.
- During shutdown, the exporter sends updates for open spans that it
aborts. It clears the run-ID map even if the final flush fails.
- Tests cover flush-mode selection, overlapping calls, failed flushes,
and shutdown behavior.
- The LangSmith exporter documentation describes manual-mode flushing
and shutdown updates.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Description
The LangSmith exporter sent a run update (`patchRun`) on every span
update and again on span end. LangSmith accepts a single update per run,
so the final update was rejected with 409 on some hosts and silently
dropped on api.smith.langchain.com. Traces kept partial outputs and a
wrong end time.
- Move `patchRun()` back inside the `isEnd` branch of
`handleSpanUpdateOrEnd` in `observability/langsmith/src/tracing.ts`.
This restores the behavior from before the exporter refactor in #11870.
- Span updates now only mutate the local `RunTree`; the single patch
sent on end carries the final inputs, outputs, metadata, events and end
time.
- Event and abort paths were already single-patch and are unchanged.
- Add a unit test: update then end calls `patchRun` once with the final
output.
- Add a patch changeset for `@mastra/langsmith`.
Verified against the real LangSmith server. A span updated with
`{"text":"partial"}` then ended with `{"text":"FINAL"}` stored `partial`
before the fix and `FINAL` after. A real agent run with a tool that
updates its own span mid-flight went from two patches for that run
(final output lost) to one patch (final output stored).
## Related Issue(s)
Fixes#26763
## 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
- [ ] 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
- [ ] I have addressed all Coderabbit comments on this PR
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5
The exporter used to send an update every time a span changed, then send
another when the span finished. This change keeps updates locally and
sends one final update when the span ends, so LangSmith receives the
completed result.
## Changes
- `handleSpanUpdateOrEnd` now calls `patchRun()` only when a span ends.
Span updates still modify the local `RunTree`.
- Added a test that checks an update does not call `patchRun()` and that
span end sends one patch with the final output.
- Added a patch changeset for `@mastra/langsmith`.
## Verification
The supplied changes include a unit test. No test-run results were
provided.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->