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

2,979 commits

Author SHA1 Message Date
Ward Peeters
da04116579
feat(factory): let a person's reply wake a card's session while automated runs hold every slot (#30307)
## What

When a trusted collaborator comments on or reviews a card's GitHub pull
request or issue, Factory wakes the card's session even while automated
runs hold every run slot. Before, those replies were
`sendMessage`/`signalActivity` decisions that counted against the single
automated cap (`dispatcher.maxInFlight`, default 10), so a reply could
sit behind multi-hour triage runs.

## How

- **Provenance.** GitHub rule actors gain `human: true` when the webhook
`sender.type` is `User`. Bots, and Factory's synthetic reconciler events
(no `sender.type`), get `human: false`.
- **Classification** (`isInteractiveDecision`, `rules/dispatcher.ts`): a
decision is a reply only if it's `sendMessage` or `signalActivity`,
would wake the session (`idleBehavior` isn't `persist`), has an empty
causal chain (no rule passed it along, e.g. not a transition's message),
and its actor is a GitHub human who is trusted and not Factory.
Everything else stays automated. GitLab, Linear, Jira and incident.io
activity stays automated because those sources give no reliable
bot/human signal.
- **Lane.** Each process keeps a reserve of reply slots
(`dispatcher.maxInteractiveInFlight` /
`MASTRACODE_DISPATCH_MAX_INTERACTIVE_IN_FLIGHT`, default `2`, `0`
allowed). Claim order per tick: pending manual starts → replies (reserve
first, then borrowing free automated slots) → automated runs. The claim
filter now receives the row's `actor` and `causalChain` as well as the
decision payload, so no schema change.
- **Honest bounds.** The caps limit dispatcher slot occupancy, not total
running agents: `signalActivity` frees its slot once the session accepts
it, and UI/Slack messages plus approval notices to following sessions go
to the session directly and never wait for a slot. The README says so.
- **Run-queue API (additive).** Entries gain `lane`; the response gains
`queuedByLane`, and `slots` gains `interactive: { inUse, cap }`.
Existing fields keep their meaning. `position` now counts within a lane.
The board's queue menu lists waiting replies first, with a reply-slot
footer.

## Testing

- Dispatcher (LibSQL + throwaway Postgres): with automated cap 1 held by
a hanging run, a trusted person's PR reply (`sendMessage`) and issue
comment (`signalActivity`) are claimed and delivered. Automated runs,
bot replies, untrusted replies, Factory-authored replies, actors with no
`human` flag, rule-passed messages and `persist` activity all stay
pending. Other cases: the reserve caps at its size, replies borrow a
free automated slot ahead of automated runs, and the default reserve is
2. Red proof: disabling the classification fails 3 of the 4 lane tests.
- GitHub rules: `issue_comment` and `pull_request_review` from a User →
`human: true`; from a Bot or without `sender.type` → `human: false`.
- Approval notice to a following session commits nothing to the run
queue.
- MSW: queue menu groups replies apart from automated runs and shows
both slot footers.
- Gates: factory `check`, oxlint and oxfmt clean. Factory suites on
LibSQL: 942 passed. factory-ui typecheck and lint clean; unit tests 696
passed. The full MSW suite has 21 failures, the same as on main
(AppStartup, OMSection, MemorySettings, NewSessionStarters,
ThreadPageTeammateSession, TranscriptMessageMeta). `mastracode/web`
index.test.ts has 2 failures that are also on main. Postgres runs of the
full dispatcher suite at `--maxWorkers=3` show the timing flakes main
already has; every test that failed passes on its own.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

**ELI5:** When a trusted person replies to a GitHub issue or pull
request, that reply gets its own reserved run slots. It no longer waits
behind routine automated runs.

## Overview

This change adds an interactive lane to the Factory decision dispatcher.
Trusted GitHub human replies can wake a card's session while automated
runs hold the automated slots. The run-queue API changes are additive.

## Classification

`isInteractiveDecision` in `mastracode/factory/src/rules/dispatcher.ts`
marks a decision as interactive only when all of these hold:

- The decision is `sendMessage` or `signalActivity`.
- The decision wakes the session.
- The causal chain is empty.
- The decision does not persist.
- The actor is a trusted GitHub human.
- The actor is not Factory-authored.

All other decisions use the automated lane. This includes bot actors,
untrusted actors, Factory events, and activity from GitLab, Linear,
Jira, and incident.io.

## GitHub actor changes

- `mastracode/factory/src/rules/types.ts` adds optional `human?:
boolean` to the GitHub variant of `FactoryRuleActor`.
- `mastracode/factory/src/integrations/github/rules.ts` sets `human` to
`true` only when the webhook sender type is exactly `User`.
- Trust lookup and its failure handling are unchanged. A lookup error
still marks the actor untrusted.

## Dispatcher behavior

- The default interactive reserve is 2 slots per process.
- `dispatcher.maxInteractiveInFlight` in
`mastracode/factory/src/factory.ts` and
`MASTRACODE_DISPATCH_MAX_INTERACTIVE_IN_FLIGHT` in
`mastracode/web/src/mastra/index.ts` set the reserve.
- A value of `0` disables the reserve. Invalid values use the default of
2.
- Each tick claims in this order: pending manual starts, then
interactive decisions, then automated deferred runs.
- Interactive decisions can use free automated slots.
- `runSlots()` returns overall `inUse` and `cap`, plus `interactive: {
inUse, cap }`.
- The caps limit dispatcher-held slots. They do not limit all running
agents.
- Pull-request activity releases its slot when the session accepts it.
- Direct session messages and approval notices do not wait for a slot.

## Storage

- `FactoryDeferredDecisionClaimInput.decisionFilter` receives a second
argument, `provenance`.
- The new `FactoryDecisionProvenance` type contains `actor` and
`causalChain`.
- No schema change is made. Invalid stored actor JSON parses to `null`.
Invalid causal-chain JSON parses to an empty array.

## Run-queue API (additive)

- `runQueueResponseSchema` in
`mastracode/factory/src/routes/contracts.ts` adds:
  - `slots.interactive: { inUse, cap }`
  - `queuedByLane: { automated, interactive }`
- Each queue entry has a `lane` field with the value `automated` or
`interactive`.
- `position` counts within a lane.
- The listing limit of 50 entries is unchanged. Waiting replies are
listed before automated runs.
- The `runSlots` types in `routes/surface.ts` and `routes/work-items.ts`
include the interactive pool.

## Board UI

- `RunQueueIndicator.tsx` lists waiting replies before automated runs.
- Each nonempty group has a label.
- The menu shows reply-slot usage next to overall slot usage.
- The tooltip fallback reads "Runs waiting for a run slot."
- `msw-server.ts` and `BoardPageRunQueue.msw.test.tsx` add lane fixtures
and a test for a waiting reply.

## Documentation and release notes

- `mastracode/factory/README.md`,
`docs/src/mastra-code/configuration.mdx`, and two changesets describe
the reserve, its default, the `0` behavior, the queue fields, and the
board ordering.
- The `mastra` changeset is a patch. The `@mastra/factory` changeset is
a minor release.

## Tests

Added or updated tests cover:

- GitHub actor `human` classification for issue comments and PR reviews,
for `User`, `Bot`, and missing sender types.
- Dispatcher reserve use, interactive cap overflow, borrowing of free
automated slots, and exclusions. Exclusions include automated, bot,
untrusted, Factory-authored, untyped, causally moved, and persisted
messages.
- The default interactive cap of 2.
- The polling-loop claim count, which changes from two to three per
tick.
- Factory config forwarding in
`mastracode/web/src/mastra/index.test.ts`, which now expects
`maxInteractiveInFlight: 0` when the environment variable is `0`.
- Clearing `MASTRACODE_DISPATCH_MAX_INTERACTIVE_IN_FLIGHT` in
sandbox-provider tests.
- No deferred decisions recorded after approval-notification delivery,
in `approval-answer-resume.test.ts`.

## Validation (author-reported)

The PR objectives report the following results. They were not checked
against completed CI checks on the current head.

- Dispatcher tests were run on LibSQL and throwaway Postgres. Full
Postgres dispatcher runs at `--maxWorkers=3` showed timing flakes. The
author reports that each failing test passes when run alone.
- Factory suites on LibSQL report 942 passing tests.
- Factory `check`, oxlint, and oxfmt are reported clean.
- factory-ui unit tests report 696 passing tests.
- The author reports 21 full MSW suite failures and 2 `mastracode/web`
`index.test.ts` failures. The author states these also occur on `main`.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-16 16:12:18 +01:00
Rhys Balevicius
92f3c5ba4f
fix(cli): keep the key id of a Gateway v2 key from create-mastra (#30457) 2026-11-16 15:20:00 +01:00
dane-ai-mastra[bot]
a5859ee2b9
chore: version packages (alpha) (#30430)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-16 14:09:31 +01:00
Ward Peeters
8759d3ab63
test: keep real network calls out of unit test projects (#30498)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-16 13:15:22 +01:00
Ward Peeters
6c647e6fae
refactor(factory): stop creating columns and tables nothing reads (#30495)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-16 11:21:12 +01:00
dane-ai-mastra[bot]
15dc07c51d
chore: version packages (alpha) (#30394)
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/core@1.84.0-alpha.2

### Minor Changes

- Added run metadata to background process callbacks.
([#30161](https://github.com/mastra-ai/mastra/pull/30161))

`backgroundProcesses` callbacks on `execute_command` now receive, when
available, the `agentId`, `threadId`, `resourceId`, and `runId` of the
call that started the process, so hosts can route exit notices to the
right conversation. `onExit` also receives `killedByAbort`, which is
`true` when the abort signal fired (the run's signal by default) and
killed the process.

  ```ts
  backgroundProcesses: {
    onExit: ({ pid, exitCode, threadId, killedByAbort }) => {
if (!killedByAbort) notifyThread(threadId, `Process ${pid} exited with
code ${exitCode}`);
    },
  },
  ```

`truncateOutput` and `DEFAULT_TAIL_LINES` are now exported from
`@mastra/core/workspace`, so hosts can trim process output the same way
`execute_command` does.

### Patch Changes

- Fixed retries in `dountil` and `dowhile` loops on the evented engine.
Each iteration of a loop body now starts at `retryCount` 0 and gets the
step's full `retries`, as on the default engine. Before, the count
carried over from earlier iterations, so a body that failed once in a
later iteration could run out of retries and fail the run.
([#30383](https://github.com/mastra-ai/mastra/pull/30383))

If your step code reads `retryCount` inside a loop body, it now gets the
attempt within the current iteration. The loop condition receives the
iteration number as `iterationCount`. To use it inside the body, pass it
through the step's output or workflow state.

- Fixed durable agent runs failing with
`DURABLE_AGENT_EXECUTION_UNVERIFIED` when an ownership check took longer
than the lease TTL (15 seconds by default) while the same process still
held the run. These runs used to fail and lose their saved snapshots.
They now keep running, and a step stops only when an ownership check
fails, the claim can't be renewed before it expires, or another
execution takes over the run.
([#30386](https://github.com/mastra-ai/mastra/pull/30386))

- Fixed workflow recovery restarting a run that is still executing,
which ran its steps twice. `startAsync()` now takes the run's lease
before it saves the first snapshot, so it resolves after the lease is
taken and rejects if taking it fails. Runs of workflows whose
`shouldPersistSnapshot` saves `waiting` but not `running` now hold a
lease too, so recovery no longer restarts them while they execute or
sleep. ([#30384](https://github.com/mastra-ai/mastra/pull/30384))

- `processToolResult` now sees and can rewrite a tool's `toModelOutput`
result. Previously, when a tool mapped its result with `toModelOutput`
(for example a file viewer returning images), output processors only saw
and changed the raw result, and the mapped output, images included,
still reached the next model call and stored history unchanged.
([#30401](https://github.com/mastra-ai/mastra/pull/30401))

The hook now receives `modelOutput`. To replace it, commit a
`result`-state part that carries the new value in
`providerMetadata.mastra.modelOutput`:

  ```ts
processToolResult({ messageList, toolCallId, toolName, args, result,
modelOutput }) {
    messageList.updateToolInvocation({
      type: 'tool-invocation',
toolInvocation: { state: 'result', toolCallId, toolName, args, result },
providerMetadata: { mastra: { modelOutput: shrinkImages(modelOutput) }
},
    });
  }
  ```

A processor that replaces only `result`, or edits it in place, now has
the new value mapped through `toModelOutput` again, so the model reads
the mapping of the processed result rather than of the original. With
several processors, each one receives the `modelOutput` the processor
before it committed, so a later processor can't bring back an image an
earlier one removed. This applies to both regular and durable agents. In
durable agents, a `processToolResult` that throws now also keeps the
unprocessed mapped output from the model, not only the raw result.
## @mastra/client-js@1.60.1-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
## @mastra/react@1.15.1-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/client-js@1.60.1-alpha.2
## @mastra/deployer-cloud@1.84.0-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/deployer@1.84.0-alpha.2
## @mastra/longmemeval@1.1.43-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`9eae968`](9eae9680d2),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/memory@1.41.2-alpha.1
## @mastra/opencode@0.1.43-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`9eae968`](9eae9680d2),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/memory@1.41.2-alpha.1
## @mastra/factory@0.29.0-alpha.2

### Patch Changes

- Recognize Detail findings as linked work items so intake cards retain
their external source and rule identity.
([#30410](https://github.com/mastra-ai/mastra/pull/30410))

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/code-sdk@1.19.1-alpha.2
## create-factory@0.4.4-alpha.2

### Patch Changes

- Updated dependencies:
  - mastra@1.39.1-alpha.2
## @mastra/code-sdk@1.19.1-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`9eae968`](9eae9680d2),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/memory@1.41.2-alpha.1
  - @mastra/client-js@1.60.1-alpha.2
## mastracode@0.50.1-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`9eae968`](9eae9680d2),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/memory@1.41.2-alpha.1
  - @mastra/code-sdk@1.19.1-alpha.2
## @mastra/agent-builder@1.2.2-alpha.1

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`9eae968`](9eae9680d2),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/memory@1.41.2-alpha.1
## mastra@1.39.1-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/deployer@1.84.0-alpha.2
## @mastra/deployer@1.84.0-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/server@1.84.0-alpha.2
## @mastra/editor@0.17.2-alpha.1

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`9eae968`](9eae9680d2),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/memory@1.41.2-alpha.1
## @mastra/mcp-docs-server@1.3.14-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
## @mastra/memory@1.41.2-alpha.1

### Patch Changes

- Observational Memory does half as much work per step in long tool
runs. Token counting no longer serializes every plain JSON tool result a
second time just to check it for images, so each step serializes the
earlier tool results twice instead of four times. Token counts are
unchanged. ([#30400](https://github.com/mastra-ai/mastra/pull/30400))

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
## @mastra/playground-ui@69.1.0-alpha.2

### Patch Changes

- Connect providers that use OAuth client credentials (`OAUTH2_CC`) or
no authentication (`NONE`) without leaving Studio. Client-credential
providers ask for a client ID and secret in the connect dialog;
providers with no authentication connect immediately instead of opening
an OAuth popup.
([#30336](https://github.com/mastra-ai/mastra/pull/30336))

Providers whose catalog lists only connection settings (for example a
subdomain) now also ask for their API key, username and password, or
client ID and secret. Previously the dialog showed only the settings,
and the connection failed.

The headless connect helpers in `@mastra/playground-ui/domains/connect`
now return a fully resolved `HeadlessAuthField` and support conditional
fields (`visibleWhen`), so other apps can import them instead of keeping
their own copy.

  ```ts
  import {
    headlessAuthFieldKey,
    headlessAuthFields,
    isHeadlessAuthFieldVisible,
    splitHeadlessAuthValues,
    startHeadlessAuth,
  } from '@mastra/playground-ui/domains/connect';

// Every field comes back fully resolved: label, target, required, and
so on are always set.
  const fields = headlessAuthFields(provider);

// Render only the fields whose `visibleWhen` condition matches the
current values.
const visible = fields.filter(field =>
isHeadlessAuthFieldVisible(fields, field, values));
const missingRequired = visible.some(field => field.required &&
!values[headlessAuthFieldKey(field)]);

  // On submit, values for hidden fields are dropped.
const { credentials, params } = splitHeadlessAuthValues(fields, values);
  await startHeadlessAuth({
    sessionToken,
    integrationId: provider.id,
    authType: provider.authType,
    credentials,
    params,
  }).result;
  ```

- Updated dependencies
[[`7277766`](7277766d6c),
[`9eae968`](9eae9680d2),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/memory@1.41.2-alpha.1
  - @mastra/client-js@1.60.1-alpha.2
  - @mastra/ai-sdk@1.12.0
  - @mastra/react@1.15.1-alpha.2
## @mastra/server@1.84.0-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
## @mastra/elysia@0.1.24-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/server@1.84.0-alpha.2
## @mastra/express@1.5.28-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/server@1.84.0-alpha.2
## @mastra/fastify@1.5.28-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/server@1.84.0-alpha.2
## @mastra/hono@1.7.26-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/server@1.84.0-alpha.2
## @mastra/koa@1.7.28-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/server@1.84.0-alpha.2
## @mastra/nestjs@0.3.1-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/server@1.84.0-alpha.2
## @mastra/next@0.2.42-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/hono@1.7.26-alpha.2
  - @mastra/server@1.84.0-alpha.2
## @mastra/tanstack-start@0.2.42-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/hono@1.7.26-alpha.2
  - @mastra/server@1.84.0-alpha.2
## @mastra/temporal@0.6.1-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/deployer@1.84.0-alpha.2
## create-mastra@1.39.1-alpha.2


## @internal/playground@1.39.1-alpha.2

### Patch Changes

- Updated dependencies
[[`7277766`](7277766d6c),
[`2f4a9ed`](2f4a9ed771),
[`951a18b`](951a18b085),
[`f4458ee`](f4458eea7f),
[`a3b4ef9`](a3b4ef9ecd),
[`547600d`](547600d004)]:
  - @mastra/core@1.84.0-alpha.2
  - @mastra/playground-ui@69.1.0-alpha.2
  - @mastra/client-js@1.60.1-alpha.2
  - @mastra/react@1.15.1-alpha.2

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-14 10:23:58 -08:00
dane-ai-mastra[bot]
1c52fdd034
chore: version packages (alpha) (#30261)
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.29.0-alpha.1


## @mastra/core@1.84.0-alpha.1


## @mastra/playground-ui@69.1.0-alpha.1


## @mastra/client-js@1.60.1-alpha.1


## @mastra/react@1.15.1-alpha.1


## @mastra/deployer-cloud@1.84.0-alpha.1


## @mastra/longmemeval@1.1.43-alpha.1


## @mastra/opencode@0.1.43-alpha.1


## create-factory@0.4.4-alpha.1


## @mastra/code-sdk@1.19.1-alpha.1


## mastracode@0.50.1-alpha.1


## @mastra/arize@1.3.31-alpha.0


## @mastra/arthur@0.4.31-alpha.0


## @mastra/braintrust@1.3.28-alpha.0


## @mastra/datadog@1.4.23-alpha.0


## @mastra/deepeval@0.1.25-alpha.0


## @mastra/laminar@1.3.33-alpha.0


## @mastra/langfuse@1.6.7-alpha.0


## @mastra/langsmith@1.4.4-alpha.0


## @mastra/observability@1.24.1-alpha.0


## @mastra/otel-bridge@1.5.23-alpha.0


## @mastra/otel-exporter@1.5.3-alpha.0


## @mastra/posthog@1.4.8-alpha.0


## @mastra/sentry@1.2.33-alpha.0


## @mastra/agent-builder@1.2.2-alpha.0


## mastra@1.39.1-alpha.1


## @mastra/connect@1.4.1-alpha.0


## @mastra/deployer@1.84.0-alpha.1


## @mastra/editor@0.17.2-alpha.0


## @mastra/mcp-docs-server@1.3.14-alpha.1


## @mastra/memory@1.41.2-alpha.0


## @mastra/server@1.84.0-alpha.1


## @mastra/google-cloud-pubsub@1.1.8-alpha.0


## @mastra/redis-streams@0.8.2-alpha.0


## @mastra/valkey-streams@0.6.3-alpha.0


## @mastra/elysia@0.1.24-alpha.1


## @mastra/express@1.5.28-alpha.1


## @mastra/fastify@1.5.28-alpha.1


## @mastra/hono@1.7.26-alpha.1


## @mastra/koa@1.7.28-alpha.1


## @mastra/nestjs@0.3.1-alpha.1


## @mastra/next@0.2.42-alpha.1


## @mastra/tanstack-start@0.2.42-alpha.1


## @mastra/clickhouse@1.30.1-alpha.0


## @mastra/cloudflare@1.8.1-alpha.0


## @mastra/cloudflare-d1@1.5.1-alpha.0


## @mastra/convex@1.9.1-alpha.0


## @mastra/dsql@1.5.8-alpha.0


## @mastra/dynamodb@1.5.2-alpha.0


## @mastra/libsql@1.30.1-alpha.0


## @mastra/mongodb@1.27.1-alpha.0


## @mastra/mssql@1.11.2-alpha.0


## @mastra/mysql@0.17.1-alpha.0


## @mastra/oracledb@0.5.7-alpha.0


## @mastra/pg@1.36.1-alpha.0


## @mastra/redis@1.4.14-alpha.0


## @mastra/spanner@1.12.1-alpha.0


## @mastra/turso@0.1.22-alpha.0


## @mastra/upstash@1.6.2-alpha.0


## @mastra/valkey@0.2.10-alpha.0


## @mastra/temporal@0.6.1-alpha.1


## @mastra/daytona@0.11.6-alpha.0


## create-mastra@1.39.1-alpha.1


## @internal/playground@1.39.1-alpha.1

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-13 19:58:20 -08:00
Tyler Barnes
2087fdccb8
fix(server): limit built-in MCP memory tools to reads and add working-memory inspection (#30245)
## Summary

The built-in MCP server (added in #29931, built-in MCP memory tools)
gives connected MCP clients a set of memory tools. Two of them did more
than an outside client should: `save_messages` wrote raw messages
straight into a thread, and `search_memory` ran a broad semantic-recall
search. There was also no way to read an agent's working memory through
MCP.

This PR narrows the built-in MCP memory toolset to inspection:

- **Removed `save_messages` and `search_memory` from the built-in MCP
toolset.** Their HTTP endpoints are unchanged; only MCP exposure is
removed.
- **Added read-only `get_working_memory`** for a thread or a resource.
It never writes stored state and works in read-only mode.
- With a thread (the request's reserved context thread takes precedence
over a `threadId` argument), it uses the existing thread working-memory
route and its ownership checks.
- Without a thread, it uses a new `GET /memory/working-memory` route
that reads resource-scoped working memory for the caller's effective
resource. When fine-grained authorization (FGA) is configured, the route
requires an authenticated user and checks `memory:read` on that
resource; a grant on a single thread does not authorize the whole
resource.
- Regenerated client route types and CLI route metadata for the new
route.

## Test plan

- New regression tests with real `Memory` + `InMemoryStore`, `Agent` and
`Mastra`, through the MCP catalogue and route handlers: tool list,
thread and resource reads, FGA allow/deny, missing user, spoofed
resource, thread grant vs resource grant, Studio/server FGA provider
selection, reserved context thread precedence, and no storage mutation.
- These tests fail on the code before the fix (8 failed / 25 passed) and
pass after.
- Focused MCP/memory/FGA-provider suites: 140/140.
- Full server suite: 128 files, 3,552 passed, 3 skipped, 1 todo.
- `pnpm build:server`, server TypeScript, lint, formatting, and
`generate:permissions` / `check:permissions` pass.
- Live loopback MCP SDK client check of `tools/list` and `tools/call`:
removed tools are absent, caller identity is enforced, nothing is
written.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## ELI5

This change makes the built-in MCP memory tools read-only. It removes
the tools that save messages or search memory. It adds one tool that
reads working memory for a thread or a resource.

## Summary

This change limits the built-in MCP memory toolset to inspection. It
removes the `save_messages` and `search_memory` tools from MCP. Their
HTTP endpoints remain unchanged. It adds a read-only
`get_working_memory` MCP tool.

### Behavior

- **Thread reads:** The tool uses the reserved context thread ID when
one exists. Otherwise, it uses the `threadId` argument. Thread reads use
the existing thread working-memory route. The existing ownership checks
apply.
- **Resource reads:** When no thread ID is available, the tool calls the
new route `GET /memory/working-memory`. The route reads working memory
for the effective resource ID. When the tool call omits the resource ID,
the tool uses the value from the request context.
- **Fine-grained authorization (FGA):** When an FGA provider is
configured, the resource route requires an authenticated user and
`memory:read` permission on the effective resource. The FGA check passes
request context. A grant on one thread does not authorize resource-wide
access.
- **Memory unavailable:** The resource route returns null working memory
when memory is unavailable.
- **Thread-scoped requests on the resource route:** The resource route
rejects thread-scoped working memory.

### Changed files

- `packages/server/src/server/handlers/memory.ts`: Adds MCP metadata to
`GET_WORKING_MEMORY_ROUTE`. Adds `GET_RESOURCE_WORKING_MEMORY_ROUTE`.
Removes MCP tool metadata from `SAVE_MESSAGES_ROUTE` and
`SEARCH_MEMORY_ROUTE`.
- `packages/server/src/server/mcp/toolsets/memory.ts`: Adds
working-memory retrieval for threads and resources. Removes the search
and message-saving operations.
- `packages/server/src/server/server-adapter/routes/memory.ts`: Adds the
new route to the exported `MEMORY_ROUTES`.
- `packages/server/src/server/server-adapter/routes/fga-manifest.ts`:
Registers `/memory/working-memory` as a resource route. The resource ID
comes from the request context, or from the `resourceId` parameter.
- `packages/server/src/server/server-adapter/index.test.ts`: Adds FGA
tests for the resource working-memory endpoint.
- `packages/server/src/server/mcp/toolsets.test.ts`: Adds tests for FGA
provider selection, fail-closed behavior, resource and thread
permissions, reserved-context precedence, and read-only inspection.
Updates the expected tool list.
-
`server-adapters/server-adapters-test-suite/src/builtin-mcp-parity-test-suite.ts`:
Removes `save_messages` and `search_memory` from the expected tool list.
-
`server-adapters/server-adapters-test-suite/src/builtin-mcp-toolsets-test-suite.ts`:
Adds `get_working_memory` to the parity and read-only cases. Asserts
that `save_messages` is not offered to a non-owner and that the HTTP
write returns 403.
- `server-adapters/server-adapters-test-suite/src/route-test-utils.ts`:
Sets a default `resourceId` for `GET /memory/working-memory`.
- `.changeset/red-pets-throw.md`: Declares patch releases for
`@mastra/client-js`, `@mastra/server`, and `mastra`.

The PR also regenerates client route types and CLI route metadata.

The diff changes 12 files, with 558 lines added and 57 removed.

### Public API

- New route: `GET_RESOURCE_WORKING_MEMORY_ROUTE` at `GET
/memory/working-memory`.
- Changed export: `MEMORY_ROUTES` includes the new route.
- MCP tool surface: `save_messages` and `search_memory` are removed from
MCP. `get_working_memory` is added. The HTTP endpoints for the removed
tools are unchanged.

### Verification

The author reports these results. This summary did not run them:

- 140 of 140 focused MCP, memory, and FGA-provider tests pass.
- 128 server test files pass, with 3,552 tests passed, 3 skipped, and 1
todo.
- Server build, TypeScript, lint, formatting, and permission-generation
checks pass.
- A live loopback MCP SDK check of `tools/list` and `tools/call` passes.
- The author reports that the new regression tests failed before the
change (8 failed, 25 passed) and pass after it.

CI status on the current head: not available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com>
2026-11-13 15:06:31 -07:00
mastra-platform[bot]
558b8b997c
Simplify mastra factory dev startup output (#30344)
> Opened by @DSchau

## What

The first `mastra factory dev` boot of a hello-world Factory printed
about 20 lines before the ready banner: 8 `[factory:timing]` phase
lines, 3 "Platform X integration initialized" lines with JSON, and 6
poller/reconcile "started" lines. Together they read as if every
integration was loading, even with nothing connected.

Under `mastra factory dev`, startup now looks like this:

```
◇ Starting Mastra dev server...

 mastra  1.39.0 ready in 24050 ms

│ Factory UI: http://localhost:4111
│ API:        http://localhost:4111/api
│ Deploy:     mastra deploy

◯ watching for file changes...
◇ Intake: GitHub connected · Jira, Linear, GitLab, incident.io available
```

## Changes

- **Boot timing**: `timedPhase` and the `boot` total are off when
`MASTRA_FACTORY_DEV=true`, unless `FACTORY_TIMING` or the new
`MASTRA_FACTORY_DEBUG` is set. Deployed Factories still log them by
default.
- **Intake summary**: integrations get an optional
`hasActiveConnections()`. Jira, GitLab and incident.io already had one.
GitHub now checks for usable installations and Linear for connected
workspaces. After finalize, factory dev prints a single
connected/available line labelled "Intake" to match the Factory UI. The
checks run in parallel and don't block boot, and a failed check shows as
"status unknown".
- **Init logs**: the "integration initialized" lines go through
`logPlatformBootInfo`, which only prints when boot diagnostics are on.
- **Worker logs**: the five poller/reconcile "started" logs moved from
info to debug.
- **CLI**:
- `mastra factory dev --debug` passes `MASTRA_FACTORY_DEBUG=true` to the
server, which brings back the timings and init details.
- In factory mode the banner labels the root URL "Factory UI" instead of
"Studio".

## Caveat

The worker "started" logs go through the project's Mastra logger, which
is INFO by default in dev. `--debug` doesn't change that logger's level,
so those lines only come back if the project configures a debug-level
logger.

## Test plan

- [x] `timing.test.ts` checks that boot timing is on by default, quiet
under factory dev, and back on with debug
- [x] `startup-summary.test.ts` covers four cases: connected/available,
none connected, failed check and no checkable integrations
- [x] `dev.test.ts` checks that `MASTRA_FACTORY_DEBUG` is set only with
`--debug`
- [x] `dev-logger.test.ts` checks the Factory UI banner and that the
Studio banner is unchanged
- [x] Factory platform/worker/sandbox suites: 462 passed
- [x] `tsc --noEmit` passes for factory and cli


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

**ELI5:** When you start a local Factory project, the terminal used to
print many timing and setup messages. Those messages made it look like
integrations were connected when they were not. Now the terminal shows
only a short list of which integrations are connected. Detailed messages
appear when you turn on debug mode.

## Overview

This change reduces startup output for local `mastra factory dev`.
Deployed Factories still log boot timing. The change also adds one
integration connection summary at startup. The factory-mode banner now
labels the root URL "Factory UI" instead of "Studio."

## Changes by area

**Boot diagnostics gating**
- `mastracode/factory/src/timing.ts` adds `bootDiagnosticsEnabled`.
Diagnostics are enabled when any of these is true:
  - `FACTORY_TIMING` is `1`, `true`, or `yes`.
  - `MASTRA_FACTORY_DEV` is not `true`. This is the deployed case.
  - `MASTRA_FACTORY_DEBUG` is `1` or `true`.
- `timedPhase` runs its callback without logging when diagnostics are
disabled. The function signature is unchanged.
- `mastracode/factory/src/factory.ts` logs boot timing in `finalize()`
only when diagnostics are enabled and a start time exists.
- `mastracode/factory/src/integrations/github/sandbox.ts` gates
command-attempt timing on diagnostics in addition to the existing phase
check.

**Log level changes**
- The worker "started" messages move from info to debug in:
  - `github/reconcile-worker.ts`
  - `issue-reconcile-worker.ts`
  - `platform/github/event-worker.ts`
  - `platform/gitlab/event-worker.ts`
  - `platform/linear/event-worker.ts`
- These messages appear only when the project logger runs at debug
level. The `--debug` flag does not change the logger level.

**Platform boot logging**
- `platform/api-client.ts` adds `logPlatformBootInfo`. It writes an
info-level log only when diagnostics are enabled.
- The GitHub, Jira, and Linear platform integrations use
`logPlatformBootInfo` for initialization messages.

**Connection checks and integration summary**
- `integrations/base.ts` adds an optional `hasActiveConnections():
Promise<boolean>` to `FactoryIntegration`.
- `platform/github/integration.ts` implements `hasActiveConnections()`.
It returns `true` when at least one installation is usable and not
suspended.
- `platform/linear/integration.ts` implements `hasActiveConnections()`.
It returns `true` when at least one connected Linear workspace is
listed.
- Jira, GitLab, and incident.io already had connection checks. This
change does not modify them.
- `integrations/startup-summary.ts` is new. It adds:
- `describeIntegrations()`. It checks only integrations with
`hasActiveConnections`, runs the checks concurrently, and sorts each
result into connected, available, or status unknown. A check that throws
is reported as status unknown. It returns `undefined` when no
integration can report connections.
- `logIntegrationSummary()`. It logs the summary only when
`describeIntegrations()` returns a value.
- `factory.ts` calls `logIntegrationSummary` in `finalize()` only when
`MASTRA_FACTORY_DEV` is `true`.
- A follow-up commit renames the summary label to "Intake" to match
Factory UI terms.

**CLI**
- `packages/cli/src/commands/dev/dev.ts` adds `debug` to `StartOptions`.
When both `factory` and `debug` are set, the child server receives
`MASTRA_FACTORY_DEBUG=true`. The ready logger also receives the
`factory` flag.
- `packages/cli/src/utils/dev-logger.ts` adds an optional `factory`
parameter to `DevLogger.ready`. In factory mode, the root URL is labeled
"Factory UI:" and the Studio entry is omitted. The API and Deploy
entries remain. Rows align to the widest label.

**Changeset**
- `.changeset/quiet-factory-boot.md` adds patch releases for
`@mastra/factory` and `mastra`. It describes the new startup output and
the `--debug` behavior.

## Tests

The new or updated tests cover:
- `timing.test.ts`: default, factory-dev, and debug timing behavior.
- `startup-summary.test.ts`: four connection-summary cases. These are
connected and available providers, no connected provider, a failed check
reported as unknown, and no report when no integration can report
connections.
- `dev.test.ts`: `MASTRA_FACTORY_DEBUG` behavior in factory mode.
- `dev-logger.test.ts`: Factory UI and Studio banners.

The author reports these results. This summary does not verify them:
- Factory platform, worker, and sandbox suites: 462 passed.
- `tsc --noEmit` passes for factory and CLI.

## Scope

21 files changed. 232 lines added and 19 removed.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: mastra-platform[bot] <mastra-platform[bot]@users.noreply.github.com>
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-13 18:48:05 +00:00
mastra-platform[bot]
d40ecd5f0d
test(cli): keep flush on mocked analytics client (#30315) 2026-11-13 17:13:55 +01:00
Ward Peeters
673c45a861
feat(factory): lower the default run cap to 10 and show the run queue on the board (#30295)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-13 13:31:58 +01:00
dane-ai-mastra[bot]
34dbbd363e
chore: version packages (alpha) (#30241)
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/factory@0.29.0-alpha.0

### Minor Changes

- Intake rules can now set a description on the cards they create, so
cards from integrations show the item's details instead of an empty
description. ([#30253](https://github.com/mastra-ai/mastra/pull/30253))

  ```ts
  return {
    type: 'upsertLinkedWorkItem',
    board: context.intake.board,
    source: 'github-dependabot-alert',
    sourceKey: alert.id,
    title: alert.title,
    description: alert.description,
    url: alert.url,
    stage: context.intake.initialPhase,
    // ...
  };
  ```

- Added Vanta vulnerabilities as a Factory intake source through
MastraConnect. Once you connect Vanta and enable it in intake settings,
each active vulnerability becomes a card labeled `security` with its
severity, package, and remediation date in the description.
([#30255](https://github.com/mastra-ai/mastra/pull/30255))

- Intake integrations are now off until you turn them on. A newly
connected integration no longer starts pulling items onto your boards
until you enable it in the intake settings.
([#30251](https://github.com/mastra-ai/mastra/pull/30251))

- Added two reads that serve a Factory board without sending every card.
`GET /web/factory/projects/:id/boards/:boardKey/phases` returns, for
each phase of the board, how many cards it holds and the first of them
in the order asked, after the search and filters given. `GET
/web/factory/projects/:id/work-items/filter-options` returns the labels
and people the board can be filtered by. `item=<card id>` also answers
for one card and its place in each phase, however deep it lies, without
listing the phase down to it. Each card is named with a `version` of its
body, which `?workItemId=` also sends, so a reader keeps the bodies it
holds and reads only the ones that changed.
([#30177](https://github.com/mastra-ai/mastra/pull/30177))

  ```ts
const res = await
fetch(`/web/factory/projects/${projectId}/boards/work/phases?label=bug&limit=10&cards=true`);
const { phases, matchingTotal, boardTotal, workItems } = await
res.json();
// phases: [{ phase: "intake", total: 42, cards: [{ id, version }, …] },
…]
  ```

- Added Dependabot alerts as a Factory intake source. Turn on **Sync
alerts** under GitHub in intake settings and pick repositories, or `PUT
/web/intake/config` with `{ "dependabot": { "enabled": true,
"sourceIds": ["owner/repo"] } }`. Open alerts in those repositories
become cards labeled `security` with the advisory details as the
description, and they close automatically when the alert is fixed or
dismissed. ([#30254](https://github.com/mastra-ai/mastra/pull/30254))

- Changing an intake route now warns you when cards already on your
boards match a different board, and offers to move those untouched cards
to the start of their new board.
([#30252](https://github.com/mastra-ai/mastra/pull/30252))

### Patch Changes

- Fixed who owns the sessions a Factory card runs in, and who can
approve what they wait on.
([#30146](https://github.com/mastra-ai/mastra/pull/30146))

  **Who owns a card's phase session**

- In a Factory that runs card work on the organization's model keys (the
`factory` and `hybrid` credential settings), every new phase session now
belongs to the Factory itself and uses the organization's keys and the
Factory's default model. That holds whoever moved the card: a person, an
agent, a webhook or a rule. Before, it ran as whoever connected the
repository, or as the person who approved the move.
- The person who moved or approved the card stays on record as the one
who did it. When they move a card from their own session, that session
follows the card, so it hears when the phase waits on someone and can
answer from there.
- If the organization has neither a model key nor a provider of its own,
the run stops with a clear "add an organization key or provider" message
and is not tried again on its own. Add one, then press Retry on the
card.
- In a Factory on personal credentials there are no organization keys,
so a phase runs as the person who moved or approved the card (or whose
session's agent moved it), and otherwise as the person who created the
Factory.

  Sessions that already exist keep their owner.

  **Approving a waiting tool call**

- The person who asked for the work, and anyone whose session follows
the card, can approve or decline any tool call the phase session is
waiting on, a plan or any other tool that asks first. They can do it
from their own session in the sidebar, with `factory_answer_approval`,
or over HTTP:

    ```http
    POST /web/user-sessions/:sessionId/parked-approval
    { "decision": "approve" }
    ```

Add `toolCallId` when the session waits on more than one approval.
Questions that need a typed answer are still answered in the session.

- A session following the card is told when the phase session waits on a
yes or no, for a plan or any other tool, with the call to answer it. In
the chat that notice now has Approve and Decline buttons and a link to
open the waiting session; a notice about a question that needs a typed
answer has the link only.
- Nobody is asked to approve what a phase approves itself: when a
phase's `exitTool` has `autoApprove` and the card matches
`autoApproveWhen`, the run carries on without a notice. This now works
for any exit tool that pauses for a yes or no, not only `submit_plan`.
- When two people answer the same call at once, one answer is used and
the other is told the call was already answered.
- The run then carries on as the phase session's owner. Before, it
carried on as whoever answered, and could fail with "the request has no
authenticated user".
- Following moves with a session: after a hand-over, the session's new
owner can answer and the old one cannot.

  **Sidebar**

A card's phase sessions now show under the session that asked for the
work when child sessions are revealed, marked "run by Factory" when the
Factory owns them, and that session shows "waiting on you", with Approve
and Decline in its menu, while one of them waits on the viewer.

- Mastra Code's Knowledge scopes now use canonical addresses, matching
`@mastra/core`'s one-segment scope values. Factory sessions hold their
org and project ids encoded (`org:acme%3Aeu` for org `acme:eu`), and the
`/knowledge` inspector and Factory Knowledge routes read the same
addresses the code agent writes, instead of encoding host scopes a
second time. ([#30019](https://github.com/mastra-ai/mastra/pull/30019))

- Sandboxes in a Factory with more than ten repositories can now reach
all of them with `git` and `gh`. The Factory mints each sandbox token
for at most ten repositories, so the sandbox now gets one token per
group of ten (`GH_TOKEN`, `GH_TOKEN_2`, …). Each checkout's git
credential helper uses the token that covers it, `github_refresh_token`
refreshes every group, and the environment note tells the agent which
variable to use for `gh` in each repository, for example
`GH_TOKEN=$GH_TOKEN_2 gh pr list -R owner/repo`. Before, a Factory over
ten repositories fell back to a token for the session repository only.
([#30121](https://github.com/mastra-ai/mastra/pull/30121))

- Fixed GitHub pull request cards losing their labels, so intake routes
that match on labels (for example `security`) now route pull requests
too. ([#30250](https://github.com/mastra-ai/mastra/pull/30250))

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`175b4b5`](175b4b5194),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/code-sdk@1.19.1-alpha.0
## @mastra/core@1.84.0-alpha.0

### Minor Changes

- **Breaking (Knowledge alpha):** a `$param` in a Knowledge scope
pattern now matches exactly one segment, so scope values can no longer
contain a raw `:`. Before, the last param took the rest of the address,
so `org:acme:viewer` counted as an `org:$orgId` scope and its holder got
that pattern's `self` rights there.
([#30019](https://github.com/mastra-ai/mastra/pull/30019))

- Agent `scopes` are canonical addresses. An id containing `:`, `/`, `#`
or `%` must be encoded with the new `encodeKnowledgeScopeId`. The raw
form (e.g. `org🅰️b` against `org:$orgId`) fails with "does not match a
declared scope type", and `%` is always read as an escape, so each scope
has one spelling.
- Memory ids are bound encoded: resource `slack:U123` becomes
`resource:slack%3AU123`.
- Patterns of one type with different segment counts no longer overlap,
so `org:$orgId` and `org:$orgId:viewer` can be declared side by side.
- `decodeKnowledgeScopeId` reads an id back from one segment of an
address.

  ```ts
  import { encodeKnowledgeScopeId } from '@mastra/core/knowledge';

const scope = `org:${encodeKnowledgeScopeId('auth0|a:b')}`; //
'org:auth0|a%3Ab', pass this in Agent scopes
  ```

  No data is rewritten:

- **Ids with a colon in the last segment get new addresses.** Before,
the last segment kept a raw `:` (`resource:slack:U123`); now it is
encoded (`resource:slack%3AU123`), so a run reaches a new, empty scope,
and pages, pins and notes stored under the old address stay there
unreached. Nothing moves them.
- **Every other id keeps its address if you pass it through
`encodeKnowledgeScopeId`.** `/`, `#` and `%` were already encoded the
same way, so `org:${encodeKnowledgeScopeId('a/b')}` reaches rows stored
from the raw `org:a/b`. Passing the old raw string unchanged does not:
`org:a/b` is refused, and a raw scope that happened to contain an escape
(`org:a%3Ab`, once stored as `org:a%253Ab`) now means the id `a:b`.
- **Stale rows get nothing from their new match.** A stored scope row
whose address now matches a different declaration than the one it was
created under (e.g. `org:acme:viewer` created under `org:$orgId`, once
`org:$orgId:viewer` is declared) gets none of the new declaration's
access. It is never a `belongsTo` parent, and using it as a scope of the
new declaration fails with an error. Prefix grants of the declaration it
was created under still let their holders read it, as before, without a
role on it.

### Patch Changes

- Fixed web search on models served through the Mastra gateway. An agent
using `webSearchTool` with a model such as `mastra/openai/gpt-6.1-sol`
failed every turn with `unknown tool type "openai:web_search"`, and on
Anthropic and Google models the tool was dropped without an error. These
models now use the gateway's web search.
([#30239](https://github.com/mastra-ai/mastra/pull/30239))

Other provider-native tools on gateway models now fail with a clear
error. Previously the gateway rejected them with a 400 or ignored them,
leaving the model without the tool.

- Fixed a run waiting on a tool approval losing its saved state when the
thread lease expired. This happened when the lease backend (such as
Redis) was down for too long. Before, the run's snapshot was deleted, so
the approval could not be resumed. Now the run resumes normally once the
backend is back. If another run took the thread first, a resume in the
same process is refused and the run keeps waiting.
([#27734](https://github.com/mastra-ai/mastra/pull/27734))
## @mastra/client-js@1.60.1-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
## @mastra/react@1.15.1-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/client-js@1.60.1-alpha.0
## @mastra/deployer-cloud@1.84.0-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/deployer@1.84.0-alpha.0
## @mastra/deployer-cloudflare@1.2.43-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/deployer@1.84.0-alpha.0
## @mastra/deployer-netlify@1.2.43-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/deployer@1.84.0-alpha.0
## @mastra/deployer-sandbox@0.3.28-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/deployer@1.84.0-alpha.0
## @mastra/deployer-vercel@1.2.43-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/deployer@1.84.0-alpha.0
## @mastra/longmemeval@1.1.43-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
## @mastra/opencode@0.1.43-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
## create-factory@0.4.4-alpha.0

### Patch Changes

- `create-factory` no longer asks where your Factory project should run.
New projects are created in the US region by default. To create the
project in the EU instead, pass `--region eu`:
([#30249](https://github.com/mastra-ai/mastra/pull/30249))

  ```bash
  npx create-factory@latest my-mastra-factory --region eu
  ```

- Updated dependencies
[[`4a3920c`](4a3920c7bf),
[`f75eb1a`](f75eb1a197),
[`338ec03`](338ec03925),
[`28e243f`](28e243f638)]:
  - mastra@1.39.1-alpha.0
## @mastra/code-sdk@1.19.1-alpha.0

### Patch Changes

- Mastra Code's Knowledge scopes now use canonical addresses, matching
`@mastra/core`'s one-segment scope values. Factory sessions hold their
org and project ids encoded (`org:acme%3Aeu` for org `acme:eu`), and the
`/knowledge` inspector and Factory Knowledge routes read the same
addresses the code agent writes, instead of encoding host scopes a
second time. ([#30019](https://github.com/mastra-ai/mastra/pull/30019))

- Updated dependencies
[[`be818ec`](be818ecb53),
[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/github-signals@0.5.3-alpha.0
  - @mastra/core@1.84.0-alpha.0
  - @mastra/client-js@1.60.1-alpha.0
## mastracode@0.50.1-alpha.0

### Patch Changes

- Updated dependencies
[[`be818ec`](be818ecb53),
[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`175b4b5`](175b4b5194),
[`9abbec6`](9abbec671c)]:
  - @mastra/github-signals@0.5.3-alpha.0
  - @mastra/core@1.84.0-alpha.0
  - @mastra/code-sdk@1.19.1-alpha.0
## mastra@1.39.1-alpha.0

### Patch Changes

- Added `factory intake-route reroute-preview` and `factory intake-route
reroute` to `mastra api`, for listing and moving untouched cards whose
intake route now points at a different board.
([#30252](https://github.com/mastra-ai/mastra/pull/30252))

  ```sh
  mastra api factory intake-route reroute-preview <factoryProjectId>
  mastra api factory intake-route reroute <factoryProjectId>
  ```

- Improved the Factory board on large projects. The board now loads the
first cards of each phase, then more as you scroll. It no longer
downloads every card of the project.
([#30191](https://github.com/mastra-ai/mastra/pull/30191))

Search, filters and sorting now run on the server. Search matches cards
that contain every word typed, in any order. It also finds a card by its
number or source id.

- Fixed the checkmark on a finished Factory onboarding step sitting 12px
right of the step numbers below it.
([#30248](https://github.com/mastra-ai/mastra/pull/30248))

- Added `mastra api factory board phases` and `mastra api factory
work-item filter-options`, which read the first cards under each phase
of a Factory board and the labels and people it can be filtered by.
([#30177](https://github.com/mastra-ai/mastra/pull/30177))

  ```bash
mastra api factory board phases <project-id> work
'{"label":["bug"],"limit":10}'
  mastra api factory work-item filter-options <project-id>
  ```

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/deployer@1.84.0-alpha.0
## @mastra/deployer@1.84.0-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/server@1.84.0-alpha.0
## @mastra/mcp-docs-server@1.3.14-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
## @mastra/playground-ui@69.0.1-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/client-js@1.60.1-alpha.0
  - @mastra/react@1.15.1-alpha.0
## @mastra/server@1.84.0-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
## @mastra/elysia@0.1.24-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/server@1.84.0-alpha.0
## @mastra/express@1.5.28-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/server@1.84.0-alpha.0
## @mastra/fastify@1.5.28-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/server@1.84.0-alpha.0
## @mastra/hono@1.7.26-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/server@1.84.0-alpha.0
## @mastra/koa@1.7.28-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/server@1.84.0-alpha.0
## @mastra/nestjs@0.3.1-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/server@1.84.0-alpha.0
## @mastra/next@0.2.42-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/hono@1.7.26-alpha.0
  - @mastra/server@1.84.0-alpha.0
## @mastra/tanstack-start@0.2.42-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/hono@1.7.26-alpha.0
  - @mastra/server@1.84.0-alpha.0
## @mastra/github-signals@0.5.3-alpha.0

### Patch Changes

- Fixed delivery of authorized review comments and inline findings even
when bot summaries change or check status is unknown. Limit comment
bursts to ten findings and a counted overflow notice per poll.
([#30246](https://github.com/mastra-ai/mastra/pull/30246))

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
## @mastra/temporal@0.6.1-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/deployer@1.84.0-alpha.0
## create-mastra@1.39.1-alpha.0


## @internal/playground@1.39.1-alpha.0

### Patch Changes

- Updated dependencies
[[`175b4b5`](175b4b5194),
[`5266060`](5266060ccd),
[`9abbec6`](9abbec671c)]:
  - @mastra/core@1.84.0-alpha.0
  - @mastra/client-js@1.60.1-alpha.0
  - @mastra/react@1.15.1-alpha.0
  - @mastra/playground-ui@69.0.1-alpha.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-12 16:45:14 -08:00
Abhi Aiyer
4a3920c7bf
feat(factory): offer to move untouched cards when intake routes change (#30252)
## Summary
Intake routes only place a card when it's first created. Adding or
editing a route (for example creating a Security board and routing
`security`-labeled items to it) left existing matching cards on their
old board.

Saving an intake route now previews which **untouched** cards (still in
their board's first phase, with no sessions started) would be routed
elsewhere under the new rules. The route editor shows a warning with the
count and a **Move** action that relocates those cards to the start of
their destination board.

- `GET /web/factory/projects/:id/intake-routes/reroute` previews the
moves
- `POST /web/factory/projects/:id/intake-routes/reroute` applies them

## Test plan
- [x] `vitest run src/routes/intake-routes.test.ts
src/routes/contracts.test.ts`
- [x] `tsc --noEmit` for `mastracode/factory` and
`mastracode/factory-ui`
- [x] Locally, adding a `Labels has security → Security` route offered
to move 447 untouched cards, and Move relocated them

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

**ELI5:** When a team changes where new work should go, cards that have
not started yet can be moved to the right board. The app first shows how
many cards would move. An admin can then move them with one click.

## Summary

This change adds a preview and apply flow for intake-route changes.
After a route save succeeds, the settings UI requests a preview of
untouched cards that the new routes would place on another board. If the
preview reports moves, the UI shows a persistent warning with per-board
counts and a **Move** action. Selecting **Move** applies the reroute.
The apply result reports moved cards and skipped cards.

The change also adds `mastra api` CLI commands for the same preview and
apply routes.

## Behavior

- A card is untouched when all of these are true:
  - It has exactly one stage.
  - That stage is the first phase (`initialPhase`) of its current board.
  - It has no sessions.
- A card is planned for a move only when:
  - It is untouched.
  - The current routes resolve it to a different board.
- A planned card moves to the first phase (`initialPhase`) of its
destination board.
- Apply processes moves one at a time with `moveCardToBoard`. It returns
`moved` and `skipped` counts. A card is skipped when it changed after
the preview.
- Apply requires an organization admin. A member receives 403.
- Apply writes a `rerouted` audit event (`intake_route` action). The
event records the result and the summarized moves.
- Stale previews do not show a warning. A preview failure shows no
warning. A newer preview replaces an older result. A preview with zero
moves dismisses an existing warning.
- After a successful apply, the Move toast reports moved and skipped
counts. The UI then invalidates queries. Apply failures show the
route-save error message.

## Changes by area

- **Backend planning and apply**
(`mastracode/factory/src/boards/reroute.ts`, new file):
  - `planReroute` builds the move list.
  - `summarizeReroute` groups moves by source and destination board.
  - `applyReroute` executes the moves and returns `moved` and `skipped`.
- **Routes** (`mastracode/factory/src/routes/intake-routes.ts`):
- `IntakeRouteRoutesDeps` adds `workItems: Pick<WorkItemsStorage,
'listShared' | 'update' | 'supersedeDecisionsForWorkItem'>`.
  - A `GET` preview endpoint returns a total and a per-board move list.
- A `POST` apply endpoint requires an organization admin. It emits the
audit event.
- **Contracts** (`mastracode/factory/src/routes/contracts.ts`): Adds
response schemas and two contracts at
`/web/factory/projects/:id/intake-routes/reroute`, one for `GET` and one
for `POST`.
- **Audit** (`mastracode/factory/src/storage/domains/audit/actions.ts`):
Adds `rerouted` to `AUDIT_ACTIONS.intake_route`.
- **Wiring** (`mastracode/factory/src/routes/surface.ts`): Passes
`deps.domains.workItems` to `IntakeRouteRoutes`.
- **Client API** (`mastracode/factory-ui/src/hooks/useIntakeRoutes.ts`):
Adds the `RerouteMove` type and the `previewReroute` and `applyReroute`
functions.
- **Settings UI**
(`mastracode/factory-ui/src/ui/domains/settings/components/IntakeRoutesSection.tsx`):
  - After a successful route save, the UI runs a preview.
  - The UI shows the warning and the **Move** action as described above.
- **CLI** (`packages/cli/src/commands/api/index.ts`;
`packages/cli/src/commands/api/descriptors.test.ts`):
  - Adds `intake-route reroute-preview` and `intake-route reroute`.
  - The apply command has a 120,000 ms default timeout for large boards.
  - The descriptor test expects the two new route descriptors.
- **Changesets**:
- `.changeset/thick-spies-wonder.md` declares a minor release for
`@mastra/factory`.
- `.changeset/brave-routes-reroute.md` declares a patch release for
`mastra` and documents the two CLI commands.
- **Tests** (`mastracode/factory/src/routes/intake-routes.test.ts`):
Registers `domains.workItems` with `IntakeRouteRoutes`. The new reroute
test checks these cases:
  - The preview starts empty.
- The preview reports one move from `work` to `docs` for a matching
card.
  - A member receives 403.
- An admin reroute moves only the untouched matching card in the
`intake` phase to the first phase of the destination board.
  - Other cards remain unchanged.
  - The preview is empty after the reroute.
  - The audit event records one move and zero skipped cards.

## Validation

Not available. This review did not run the tests, type checks, or CI on
the current head. The PR description reports that `vitest run
src/routes/intake-routes.test.ts src/routes/contracts.test.ts` and `tsc
--noEmit` passed. Those results are author-reported and not completed
checks on the current head.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-12 16:32:18 -08:00
Damien Schneider
28e243f638
feat(factory): read a board by phase, searched and filtered on the server (#30177)
**─────── TLDR ───────**
> A Factory board can now be read one page of each phase at a time,
searched and filtered on the server, instead of downloading every card
of the project.

The board page downloads the whole project to draw a few dozen cards per
phase, then searches, filters, orders and counts them in the browser.
These two reads do that work on the server: one names the first cards of
each phase and counts the rest, the other lists what the filter menus
offer. Nothing calls them yet; the board page moves onto them in the
next PR.

### Behavior changed

`GET …/boards/:boardKey/phases`
&nbsp;&nbsp;├─ **new** — per phase, `total` and its first 50 cards as `{
id, version }`
&nbsp;&nbsp;├─ **new** — `q`, `label`, `source` or a people filter keep
the matching cards only
&nbsp;&nbsp;└─ **new** — `cards=true` also sends the body of every named
card, each with its `version`

the same read with `window=<phase>:<count>`
&nbsp;&nbsp;├─ **new** — lists that phase deeper, the others stay at
`limit`
&nbsp;&nbsp;└─ **new** — a window for a phase the board no longer has is
ignored

the same read with `item=<card id>`
&nbsp;&nbsp;├─ **new** — names the card, its position in each phase, and
its body
&nbsp;&nbsp;└─ **new** — no phase is listed deeper for it, however old
the card

the same read sent again with `If-None-Match`
&nbsp;&nbsp;└─ **new** — 304 unless a named card's body, an order or a
total changed

`GET …/work-items/filter-options`
&nbsp;&nbsp;└─ **new** — labels, the people sources name, the Factory
users who acted

The whole-board list, its `since` read, the starters and the agent tools
answer as before, except that `?workItemId=` now sends each card's
`version` too. `since` loses its last reader when the next PR merges,
and a follow-up removes it.

### Shape changed

| | | |
|---|---|---|
| **+** | `boardPhases(list, board, view, userId, version)` | pure, so
the browser's tests can run it as the server |
| **+** | `cardFacts(card)` | what search and filters read, once per
card version |
| **+** | `sendRevalidated` · `sendJson` · `namedBody` | the list
route's ETag and gzip answer, now shared |
| **~** | `workItemNumber` | moved to `work-items/card-number.ts`, 7
importers |
| **~** | `sourceFacts` | merged into `sourceMetadata`: one reading of a
card's source |
| **~** | `searchWords` · `hasEveryWord` | moved out of `routes/`,
importable by the browser |

- `mastracode/factory/src/work-items/`
  - └─ `board-phases.ts` — place, order, filter, count
  - └─ `board-filter-options.ts`
- └─ `card-facts.ts` · `card-people.ts` · `card-source-filters.ts` ·
`card-labels.ts`
- └─ `card-search-text.ts` · `search-words.ts` · `card-number.ts` ·
`list-related-cards.ts` — moved here
- `mastracode/factory/src/routes/`
  - └─ `contracts.ts` — both contracts
  - └─ `work-items.ts` — both handlers

what the next PR builds on
&nbsp;&nbsp;&nbsp;&nbsp;`GET …/boards/:boardKey/phases` · `GET
…/work-items/filter-options` · `mastra api factory board phases` ·
`mastra api factory work-item filter-options`

### Decisions

- **a version per card, not a time cursor** — `version` is a hash of the
body sent, so a reader rereads by id whatever differs; `changedAt`
missed two kinds of change.
- **`q` needs every word** — the rule the agents' search already
follows; the board's phrase match goes with the next PR.
- **filters read the stored card** — `worked` is its creator, movers and
session starters, and a live intake candidate's labels and people are
not seen until the next sync.

The two changes `changedAt` missed: a source sync landing in the same
millisecond as another write, and a Review card shown as a Work card
once the Review board closes, which writes nothing to it. Related cards
are capped too: each named card brings the first `limit` of its related
cards, and `relatedTotal` counts them all.

### Gain

Gzipped bytes, measured in-process on a synthetic board with 3 KB of
description per card:

| read | 2,500 cards | 10,000 cards |
|---|---|---|
| whole board, as today | 2,859,778 | 11,440,412 |
| phases with `cards=true` | 414,278 | 414,070 |
| phases, each later read | 8,930 | 8,921 |
| phases, nothing shown changed | 0 (304) | 0 (304) |
| one changed card by id | 1,736 | 1,767 |

The table predates `version`. A hash compresses worse than a timestamp:
on a second harness, 300 names went from 3.3 KB to 7.8 KB gzipped, so
expect the "each later read" row about 4.5 KB higher. A link to the
oldest Done card of 10,000 used to send 8,250 bodies; it now sends the
first page plus one. A 304 with `cards=true` over 300 cards takes 0.23
ms, because it hashes the names and never serializes the bodies.

After one card changes, the server rebuilds the phase index in 2.3 ms at
2,500 cards and 5.2 ms at 10,000, where serializing and gzipping the
whole board takes 188 ms and 747 ms. A search's first read takes 13 ms
and 23 ms. Unchanged: the server keeps the project's cards in memory
and, after each change, reads what changed and re-sorts the list. That
refresh takes 61 ms and 254 ms in this harness, on in-memory storage;
paging in SQL is a later step.

### Not verified

- [ ] both reads against Postgres on a real project — measured on
in-memory storage only
- [ ] `source=pull-request` for an issue card with a pull request
attached, through the route — only the rule is unit-tested
- [ ] the Gain table with `version` in the names — the first harness was
not rerun
- [ ] why `attention › tracks read and archived failure occurrences
across retries` fails some runs on Postgres — 3 of 6 at the previous
head too, not touched here

---

> ██████████████████ **tests** `+1147` — 45% of the additions
> ███████████████ **source** `+940 −109`
> ███████ **generated** `+418` — CLI route metadata
> █ **changeset** `+21`
> █ **docs** `+2`

---------

Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local>
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-12 13:33:10 -08:00
dane-ai-mastra[bot]
d60ba71be0 chore: version - exit prerelease mode 2026-11-12 21:12:29 +00:00
dane-ai-mastra[bot]
5c87442ed7
chore: version packages (alpha) (#30203)
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/auth-auth0@1.3.0-alpha.0


## @mastra/auth-clerk@1.4.0-alpha.0


## @mastra/auth-okta@0.3.0-alpha.0


## @mastra/auth-supabase@1.2.0-alpha.0


## @mastra/client-js@1.60.0-alpha.13


## @mastra/auth@1.2.0-alpha.0


## @mastra/core@1.83.0-alpha.13


## @mastra/playground-ui@69.0.0-alpha.15


## @mastra/rag@2.8.0-alpha.3


## @mastra/server@1.83.0-alpha.13


## @mastra/server-adapters-test-suite@0.3.0-alpha.5


## @mastra/auth-better-auth@1.1.11-alpha.2


## @mastra/auth-cloud@1.2.9-alpha.0


## @mastra/auth-neon@0.3.6-alpha.1


## @mastra/auth-workos@1.6.9-alpha.0


## @mastra/discord@1.3.4-alpha.0


## @mastra/react@1.15.0-alpha.13


## @mastra/deployer-cloud@1.83.0-alpha.13


## @mastra/deployer-cloudflare@1.2.42-alpha.3


## @mastra/deployer-netlify@1.2.42-alpha.1


## @mastra/deployer-sandbox@0.3.27-alpha.1


## @mastra/deployer-vercel@1.2.42-alpha.1


## @mastra/longmemeval@1.1.42-alpha.13


## @mastra/opencode@0.1.42-alpha.13


## @mastra/factory@0.28.0-alpha.15


## create-factory@0.4.3-alpha.15


## @mastra/code-sdk@1.19.0-alpha.15


## mastracode@0.50.0-alpha.14


## @mastra/agent-builder@1.2.1-alpha.5


## mastra@1.39.0-alpha.15


## @mastra/connect@1.4.0-alpha.6


## @mastra/deployer@1.83.0-alpha.13


## @mastra/editor@0.17.1-alpha.7


## @mastra/mcp@2.9.0-alpha.5


## @mastra/mcp-docs-server@1.3.13-alpha.17


## @mastra/memory@1.41.1-alpha.5


## @mastra/schema-compat@1.4.0-alpha.2


## @mastra/elysia@0.1.23-alpha.13


## @mastra/express@1.5.27-alpha.13


## @mastra/fastify@1.5.27-alpha.13


## @mastra/hono@1.7.25-alpha.13


## @mastra/koa@1.7.27-alpha.13


## @mastra/nestjs@0.3.0-alpha.13


## @mastra/next@0.2.41-alpha.13


## @mastra/tanstack-start@0.2.41-alpha.13


## @mastra/voice-google-gemini-live@0.14.19-alpha.2


## @mastra/voice-openai-realtime@0.14.9-alpha.3


## @mastra/voice-xai-realtime@0.2.18-alpha.2


## @mastra/inngest@1.11.2-alpha.9


## @mastra/temporal@0.6.0-alpha.13


## create-mastra@1.39.0-alpha.15


## @internal/playground@1.39.0-alpha.15

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-12 12:07:03 -08:00
Daniel Lew
18168d518c
feat(playground): show the built-in MCP server in Studio (#29932)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-12 13:40:02 -05:00
arctic-char
c0d3bfdc43
feat: pass the authenticated user to DynamicArgument callbacks (#28612)
Dynamic agent config callbacks now get the authenticated end user as an
optional `user` argument, so you can personalize an agent without
digging auth keys out of `requestContext` yourself. It works in any
`DynamicArgument` callback: instructions, model, tools, memory,
workspace, processors, scorers, and so on.

```ts
import { Agent } from '@mastra/core/agent';

const supportAgent = new Agent({
  id: 'support-agent',
  instructions: ({ user }) =>
    user ? `You are helping ${user.name ?? user.id}.` : 'You are a helpful assistant.',
  model: ({ user }) => (user?.role === 'admin' ? 'openai/gpt-5' : 'openai/gpt-5-mini'),
  tools: ({ user }) => (user ? { accountTool, ...(user.role === 'admin' ? { adminTool } : {}) } : {}),
  memory: ({ user }) => (user ? userMemory : undefined),
});
```

`user` always has the same `MastraUser` shape, no matter which auth
provider you use, and it's `undefined` for unauthenticated requests:

```ts
import type { MastraUser } from '@mastra/core/types';

// { id: string; name?: string; email?: string; avatarUrl?: string; role?: string }
```

The server auth middleware builds it through a new overridable
`toMastraUser()` on `MastraAuthProvider`. The default handles common
shapes (`id`/`sub`/`userId`, `name`, `email`, `avatarUrl`/`picture`,
`role`), and JWT, Cloud, Supabase, Neon and Better Auth ship overrides
for their user objects. Custom providers can map their own shape:

```ts
import { MastraAuthProvider } from '@mastra/core/server';
import type { MastraUser } from '@mastra/core/types';

class MyAuth extends MastraAuthProvider<MyUser> {
  async authenticateToken(token: string) { /* ... */ }
  async authorizeUser(user: MyUser) { return true; }

  toMastraUser(user: MyUser): MastraUser {
    return { id: user.accountId, name: user.profile.displayName, role: user.permissions.primaryRole };
  }
}
```

Inline auth configs can pass `toMastraUser` too. If the provider user
has no role and an RBAC provider is configured, the primary RBAC role
fills it in, so `user.role` also works with WorkOS, Okta, Google and
Neon. The raw provider user is still available when you need
provider-specific fields, and the new context key is reserved, so
clients can't spoof it through the request body:

```ts
instructions: ({ requestContext }) => {
  const rawUser = requestContext.get('mastra__user'); // provider-specific object, unchanged
  // ...
},
```

Dynamic `vectorStore` resolvers on RAG tools get `user` as well:

```ts
createVectorQueryTool({
  indexName: 'docs',
  model: embedder,
  vectorStore: ({ user }) => (user ? tenantStores.get(user.id)! : sharedStore),
});
```

Inside core, every place that invoked a `DynamicArgument` callback
inline now goes through a single `resolveDynamicArgument` helper, which
reads the user from `requestContext` at call time. This is non-breaking:
callbacks get an extra optional field, providers get a method with a
working default. Requests served through an `MCPServer` don't get `user`
yet, since MCP builds its own request context; that's documented.

Tested with unit tests for the helper, normalization and each provider
override, middleware tests (inline config, provider role, RBAC role,
CompositeAuth ordering, unauthenticated), regression tests for the
migrated call sites, and an end-to-end test where an agent behind a fake
auth provider gets personalized instructions. Core, server, rag and the
touched auth packages typecheck clean, and their suites pass.



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## ELI5
When a signed-in user makes a request, configuration callbacks can now
use a standard set of details about that user. When a workflow resumes,
it uses the new request’s user details instead of restoring them from
the earlier run.

## Summary
- Added optional `user` data to `DynamicArgument` callbacks and RAG
vector-store resolvers. Callbacks can also use `getRequestUser()` to
read the normalized user from request context.
- Added the `MastraUser` type and `toMastraUser()` normalization hooks
for auth providers and inline auth configs. The server stores the
normalized user in a reserved request-context key and uses the primary
RBAC role when the user has no role.
- Updated core dynamic configuration paths to use the shared resolver.
Added user support to agent scopes and migrated A2A memory resolution.
- Added `withoutLiveRequestKeys()` to remove live authentication and
authorization data from saved context during workflow resume, restart,
and time travel. Saved non-authentication context, such as tenant data,
remains available.
- Added documentation and changesets. Raised relevant `@mastra/core`
peer dependency minimums to 1.81.0. MCPServer requests do not receive
the normalized `user`.

## Validation
The author reports passing typechecks and test suites across core,
server, RAG, and several auth packages. The author also reports three
failing Inngest tests and earlier failures in evented workflow and
scheduler tests, which reportedly fail the same way on comparison
sources. These results are author-reported and have not been
independently verified.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-12 10:55:12 -05:00
mastra-platform[bot]
e1a20364af
Fix OpenAPI request schemas for defaulted and transformed fields (#30187)
## Summary
- Generate request path, query, and body JSON Schemas from input types
while retaining output types for responses.
- Pass input/output mode through the Zod v4 adapter to represent
defaults and transformations accurately.
- Add regressions for OpenAPI documents, API schema manifests, and Zod
v4 conversion, plus patch changesets for both packages.

## Test plan
- `pnpm exec vitest run` in `packages/schema-compat` (1089 passed, 9
skipped)
- `pnpm exec vitest run` in `packages/server` (3406 passed, 3 skipped, 1
todo)
- `pnpm exec tsc --noEmit -p tsconfig.json` in both packages
- `pnpm exec oxlint --type-aware` on modified files; `pnpm exec prettier
--check` on modified files

Fixes #30050

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

**ELI5:** Mastra builds an API document that tells client programs what
data to send. Before this change, the document described the cleaned-up
data the server produces, not the data the client sends. This change
makes the document describe what clients send for requests, and keeps
the cleaned-up form for responses.

## Summary

This pull request changes how OpenAPI documents describe request and
response schemas for Zod schemas. It addresses issue `#30050`.

### Problem

The OpenAPI conversion used the Zod output side for all schemas. Request
data needs the input side. This caused two errors:

- Fields with `.default()` appeared as required in request bodies.
- Parameters with `.transform()` appeared as `{}` in path and query
schemas.

On Zod versions before 4.2, and through the 3.25 v4 compatibility layer,
the `@mastra/schema-compat` Zod v4 adapter also dropped the input/output
mode.

### Changes

- **`packages/server/src/server/server-adapter/openapi-utils.ts`:**
`schemaToJsonSchema` accepts an optional `io` argument (`'input' |
'output'`, default `'output'`) and passes it to
`standardSchemaToJSONSchema`. Path parameters, query parameters, and
request bodies use `'input'`. Response schemas keep the default
`'output'`.
-
**`packages/server/src/server/server-adapter/api-schema-manifest.ts`:**
`convertSchema` accepts a direction and passes it to
`schemaToJsonSchema`. The manifest builder converts response schemas as
output. It converts path, query, and body schemas as input.
- **`packages/schema-compat/src/standard-schema/adapters/zod-v4.ts`:**
`convertToJsonSchema` accepts a direction and passes it to Zod's
`toJSONSchema` options. The `input` converter uses `'input'`. The
`output` converter uses `'output'`.
- **Generated CLI schemas:**
`packages/cli/src/commands/api/feedback-score-schemas.generated.ts` and
`route-metadata.generated.ts` are regenerated to match the OpenAPI
request-schema change.
- **Changeset:** Adds patch releases for `@mastra/schema-compat` and
`@mastra/server`.

### Tests

- `openapi-utils.test.ts`: Adds a test for a `createRoute` POST route.
It checks that transformed path and query inputs use string schemas,
that the defaulted query parameter is optional, and that only
non-defaulted body and response fields are required.
- `api-schema-manifest.test.ts`: Adds a test that checks property
schemas and required fields for path, query, body, and response schemas
with defaults and transforms.
- `zod-v4.test.ts`: Changes the input/output comparison. It now checks
that properties and required fields match for a schema without defaults
or transforms. It adds a test for a defaulted, transformed field through
the routed adapter.

### Scope

- 9 files changed, 155 lines added, 62 lines removed (from `git diff
--stat` against the merge base).
- Two of the nine files are generated CLI schema files.
- No exported declarations changed except the `schemaToJsonSchema`
signature, which gained an optional parameter.

### Verification

The PR objectives report these local checks by the author:
`schema-compat` and `server` Vitest runs, `tsc --noEmit` in both
packages, and `oxlint` and `prettier --check` on modified files. These
results come from the PR description. CI results on the current head are
not available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: mastra-platform[bot] <mastra-platform[bot]@users.noreply.github.com>
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-12 06:33:48 -08:00
dane-ai-mastra[bot]
05a6931471
chore: version packages (alpha) (#30172)
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>
2026-11-12 14:42:02 +01:00
Damien Schneider
1fbc69aa9a
feat(factory): count the new session page's starters and activity on the server (#30097)
**─────── TLDR ───────**
> The new session page now gets its starter counts and activity dates
from two small server reads instead of downloading every card of the
project.

To show a handful of numbers, the page read the whole board: 1,505 KB
gzipped on the 8,078-card board measured in #28915. The rules that
decide which cards a starter counts now run on the server, and the
browser keeps the wording and the layout.

Since #30099 a tab that already holds the board only reads the cards
that moved. What this PR removes is the first download, and the board
the tab had to keep to count on it.

Fifth step of removing whole-board reads, after #30080, #30083, #30087
and #30081 (⌘K). The board page comes next.

### Behavior changed

opening a new session page
&nbsp;&nbsp;├─ **was** — every card of the project downloaded, then
counted in the browser
&nbsp;&nbsp;└─ **now** — two reads: the starter counts, and the instants
of the period

a card changes while the page is open
&nbsp;&nbsp;├─ **was** — the cards that moved, merged into the board the
tab kept
&nbsp;&nbsp;└─ **now** — the two reads asked again; the instants come
back only when one was added or removed, a `304` otherwise

choosing "This month" in the activity band
&nbsp;&nbsp;├─ **was** — recounted at once on the board the tab kept
&nbsp;&nbsp;└─ **now** — one more read; the band stays up on the week's
instants until it answers

the live session counts in the activity band
&nbsp;&nbsp;├─ **was** — read off the whole board
&nbsp;&nbsp;└─ **now** — read off the sidebar's cards holding a session,
already loaded

a pull request card whose source reports no state
&nbsp;&nbsp;├─ **was** — finished only in a phase named `done` or
`canceled`
&nbsp;&nbsp;└─ **now** — finished in any terminal phase of the default
board

the page served by a Factory server without the two routes
&nbsp;&nbsp;└─ **new** — starters and activity band stay hidden, the
rest of the page works; feed frames do not ask the two routes again

### Shape changed

| | | |
|---|---|---|
| **+** | `routes/work-item-starters.ts` | the starter rules, moved here
from the browser; they read the cards as storage holds them |
| **+** | `routes/work-item-activity.ts` | the instants one period needs
|
| **+** | `hashedBody()` in `routes/board-snapshot.ts` | a computed
answer and the `ETag` naming it |
| **~** | `starterPrompts.ts` | words the counts, no longer reads cards
|
| **+** | `queryKeys.boardFacts(id)` | answers computed from the board,
refreshed with it |
| **+** | `activityDepth(period)` | one home for "Today reads the week's
answer" |
| **−** | draft page in `pageLoadsBoard` | it no longer reads the board
|
| **−** | `doneAt` in `boardItems.ts` | its only caller moved to the
server |

what callers can now ask
&nbsp;&nbsp;&nbsp;&nbsp;`GET …/work-items/starters` · `GET
…/work-items/activity?since=<instant>` (answers `304` to
`If-None-Match`) · `mastra api factory work-item starters` · `mastra api
factory work-item activity`

### Decisions

- **counted on the server, not from a smaller card list** — the page
needs eight numbers, not cards; a new starter now takes a server rule
plus its wording
- **instants, not buckets** — the browser buckets in the viewer's time
zone and Today reuses the week's answer; bucket on the server if the
list ever weighs
- **no whole-board fallback on an older server** — the two blocks hide
until the server is deployed; one `catch` away if you disagree
- **counted on stored cards, not on their wire copy** — copying every
card per request was three quarters of the read's time; the rules merge
the work item's facts with the card's where they read them
- **recounted on every request, no memo per board** — a memo would have
to expire with the clock (stale pull requests), the board registry and
the decisions; the count costs 1 to 5 ms
- **`ETag` on the instants, none on the counts** — the counts weigh
about 150 bytes; the page asks the instants from the top of the hour so
the address repeats and the browser can revalidate
- **the other depth stands in while a period loads** — two observers,
one enabled; a placeholder would set the band's clock to zero

### Gain

Opening the page on 2,500 cards with ~2 KB descriptions: the whole
board, 1.2 MB gzipped, becomes about 150 bytes of counts plus 27 bytes
per card created or completed in the period. That is 1.9 KB when the
cards were filed over 400 days, 67.9 KB when all 2,500 fall in the week
(sent uncompressed: instants gzip about 3.5×).

Once the page is open, this branch does not beat `main`, it costs a
little more. One refresh of one open tab, at most every 5 s:

| one refresh of an open tab | 2,500 cards | 10,000 cards |
|---|---|---|
| `main`, nothing changed | 0.5 ms · 124 B | 1.4 ms · 122 B |
| here, nothing changed | 2.4 ms · 154 B | 7.7 ms · 156 B |
| `main`, one card filed | 860 B | 868 B |
| here, one card filed | 2,030 B | 5,921 B |

"here" adds up the three reads the page makes: cards holding a session
(`304`), starters, instants. Cards filed over 400 days, medians of 10
rounds in the in-memory route harness. When every card falls in the week
the two counts take 0.98 + 1.15 ms at 2,500 cards and 4.27 + 4.60 ms at
10,000. Counting on stored cards took the starters function from 1.11 to
0.29 ms at 2,500 cards and from 4.61 to 1.15 ms at 10,000.

### Watch

> [!WARNING]
> The starter rules moved from the browser to the server together with
their scenario tests. <mark>A porting mistake would show as a wrong
number on a starter button</mark> and nowhere else, so compare a few
buttons with the board after deploy.

on merge: nothing to do. `main` with #30153 is merged into this branch
and the CLI route metadata check passes.

### Not verified

- [ ] against a real board or Postgres — the timings come from the
in-memory route harness
- [ ] the `304` in the signed-in app — the route is tested, and headless
Chromium revalidated a stand-in answer with the same headers, but the
real page was not watched against a real server

---

> ████████████████████ **tests** `+1077 −431` — 58% of the additions
> ███████████ **source** `+572 −222`
> ███ **generated** `+177`
> █ **changeset** `+24`
> █ **docs** `+2`

---------

Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local>
2026-11-11 21:49:28 -08:00
dane-ai-mastra[bot]
d97d3c5fd8
chore: version packages (alpha) (#30167)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-11 21:44:40 -08:00
Damien Schneider
2742d51576
fix(cli): pass filters and lists to Factory list commands (#30153)
**─────── TLDR ───────**
> `mastra api factory work-item list` now accepts its filters, and a
list of values given to a Factory command reaches the server in the form
it reads.

Copilot found this on #30081 after it merged. That PR's changeset says
`mastra api` can pass the list route's new filters (`started`, `q`,
`limit`, `source`). It could not: the command was registered without
input, so the JSON was dropped and the whole board came back. This makes
that sentence true before it ships.

### Behavior changed

`mastra api factory work-item list <project-id>
'{"started":"false","q":"login flow"}'`
&nbsp;&nbsp;├─ **was** — the JSON input dropped without a word, every
card of the project listed
&nbsp;&nbsp;└─ **now** — the filters are sent

a list in the input of a Factory command, such as
`{"kind":["automation-failed","agent-waiting"]}` on `attention list`
&nbsp;&nbsp;├─ **was** — sent as one JSON string: answered 400, or read
as one literal value that matches nothing
&nbsp;&nbsp;└─ **now** — one query parameter per value, the form Factory
routes read

### Shape changed

| | | |
|---|---|---|
| **~** | `factory work-item list` | takes optional JSON input, like
`attention list` and `decision list` |
| **~** | `buildUrl(…, route)` | fifth parameter is `{ apiPrefix,
repeatLists }`, no longer the prefix alone |

### Decisions

- **only on Factory routes** — Mastra API routes parse object-typed
query values from JSON, and a single-element `tags` on `trace list`,
`log list`, `score list` and `feedback list` only parses in that form;
repeating values there would break them
- **an empty list and a list of objects keep the JSON form** — an empty
list sent as no parameter at all would turn `{"source":[]}` into a
request for the whole board

### Watch

> [!WARNING]
> <mark>A script that already passed a list to a Factory command now
sends a different query string.</mark> The old form was answered 400 or
matched nothing, so no call that worked changes.

on merge: nothing to do.

### Not verified

- [ ] against a running Factory server — the tests assert the URL the
CLI requests, not the server's answer
- [ ] list filters on Mastra API commands (`datasetIds`, `scorerId`,
`feedbackType`, `level`) — reading their schemas suggests some are
refused in the JSON form the CLI sends today; not run, and not touched
here

---

> ██████████████████ **tests** `+101 −6` — 77% of the additions
> ████ **source** `+24 −4`
> █ **changeset** `+7`

---------

Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local>
2026-11-11 21:13:18 -08:00
dane-ai-mastra[bot]
a4258a989c
chore: version packages (alpha) (#30127)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-11 21:12:19 -08:00
Damien Schneider
6937417bd4
fix(factory): ⌘K reads the clicked card by its id, and three search fixes (#30154)
**─────── TLDR ───────**
> ⌘K now reads the card you click by its id before starting it, and
three smaller search bugs are fixed.

Copilot reviewed #30081 after it merged and left six findings. Four are
about the palette and are fixed here, one commit each. The CLI one is
#30153, and the sixth was declined on the PR.

### Behavior changed

clicking a listed card the search would no longer return, because a more
recently updated card took its place among the 20
&nbsp;&nbsp;├─ **was** — "This card no longer exists", nothing started
&nbsp;&nbsp;└─ **now** — the card is read by its id and its session
starts

Retry after the board cards failed to load, when the intake has no
candidate
&nbsp;&nbsp;├─ **was** — the failure notice stayed up for good
&nbsp;&nbsp;└─ **now** — only the reads that failed are asked again, and
the notice goes

typing a source label such as "review" with more than 20 intake items
&nbsp;&nbsp;├─ **was** — the item matching by its label could miss the
20 looked up, and its row never showed
&nbsp;&nbsp;└─ **now** — the 20 are ranked on the same text the rows are
filtered on

typing the number of a card that has no key and no GitHub source
&nbsp;&nbsp;├─ **was** — the server found the card, the palette then hid
its row
&nbsp;&nbsp;└─ **now** — the row shows

the list route asked for `?workItemId=<id>`
&nbsp;&nbsp;└─ **new** — the cards with those ids and no other; an id no
card has is left out, and a board cursor (`since`) sent with it is
ignored, as on the other narrowed lists

### Shape changed

| | | |
|---|---|---|
| **+** | `workItemId` on `workItemListQuerySchema` | repeatable, 100
ids at most, refused with any other filter |
| **+** | `cardsWithIds` | beside `cardsFiledFrom` in
`work-item-selection.ts` |
| **~** | `useBoardRuns({ refetchItems })` | now given the id of the
card clicked |
| **~** | `useGlobalSearchWorkItems.refetch` | one card by its id, no
longer both lists |
| **+** | `candidateSearchValue` | one home for the text a candidate row
is filtered and ranked on |
| **+** | `searchedNumber` | the number the server's search reads,
mirrored for the row |

what callers can now ask
&nbsp;&nbsp;&nbsp;&nbsp;`GET …/work-items?workItemId=<id>` · `mastra api
factory work-item list` can pass it once #30153 is in

### Decisions

- **a filter on the list route, not `GET /work-items/:id`** — a server
older than the filter ignores it and sends the whole board, which still
holds the card; a new route would answer 404 there and read as "deleted"
- **not the listed copy as a fallback** — starting a run on an id the
server no longer has creates the card again (`prepareRunStart`), so a
deleted card would come back; the fresh read decides, and a deleted card
still gets the toast
- **the board page keeps refetching its list on a click** — it moves to
the same read with the board page's own PR

### Gain

A click in ⌘K asks for one card instead of two lists.

### Watch

> [!WARNING]
> <mark>Until a server with `workItemId` is deployed, each click on a
card in ⌘K downloads the whole board.</mark> It still finds the card
there, so the click works, only slower.

on merge: `main` with #30099 is merged in and the CLI route metadata
regenerated. #30097 regenerates the same file, so whichever merges
second runs `pnpm --filter @mastra/factory
generate:api-cli-route-metadata` again.

### Not verified

- [ ] against a deployed Factory or Postgres — the route tests run on
the in-memory harness, the palette tests against stubbed routes
- [ ] in a real browser — the palette tests run in jsdom

---

> ██████████████████ **tests** `+273 −5` — 65% of the additions
> ███████ **source** `+110 −25`
> █ **generated** `+18 −2`
> █ **changeset** `+16`
> █ **docs** `+2 −2`

---------

Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local>
2026-11-11 20:30:15 -08:00
dane-ai-mastra[bot]
055a8c3b82 chore: version packages 2026-11-12 04:17:40 +00:00
Damien Schneider
b9610409ab
perf(factory): send an open board only the cards that changed (#30099)
Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local>
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-11 18:27:47 -08:00
Anurag Ojha
7c40bc84b6
fix(react): load the Studio review queue page by page (#29291)
Co-authored-by: mastra-platform[bot] <mastra-platform[bot]@users.noreply.github.com>
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-11 17:06:48 -08:00
Damien Schneider
ddf1c08cf6
perf(factory): ⌘K asks the server for matching cards instead of downloading the board (#30081)
Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local>
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-11 16:40:22 -08:00
dane-ai-mastra[bot]
9e82af0237
chore: version packages (alpha) (#30074)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-11 14:21:14 -08:00
Damien Schneider
cd30020f7a
feat(factory): read the sidebar's cards with ?scope=sessions (#30087)
**─────── TLDR ───────**
> Away from a board, the Factory sidebar now reads only the cards
holding a session, through a new `?scope=sessions`, so a session page no
longer downloads the whole board.

Step 2 of taking the full-board read out of the UI. After #30080 the
sidebar was the last thing on a session page still downloading the
board: it uses the cards to mark each session row with its card's source
and to say which sessions wait on a person. The list route now takes
`scope=sessions` and answers with every card holding a session plus the
cards related to them, in the same shape, and the sidebar reads that.

On a page that loads the board anyway (the board pages, and the
new-session draft, whose starters and activity read it) the sidebar
keeps sharing that one read, as it does on main. The board used to
arrive on every page through the sidebar's route loader; it now starts
from the loaders of those pages. ⌘K still reads the whole board when it
opens. Those are the next PRs.

### Behavior changed

a session page, Rules, a new session
&nbsp;&nbsp;├─ **was** — the sidebar downloads the whole board to mark
its sessions
&nbsp;&nbsp;└─ **now** — it asks for the cards holding a session; the
board is not requested

going from one of those pages to a board
&nbsp;&nbsp;├─ **was** — the board is already loaded, cards show at once
&nbsp;&nbsp;└─ **now** — the board loads when its page opens; the
sidebar keeps its marks meanwhile

going from a board back to one of those pages
&nbsp;&nbsp;├─ **was** — no request
&nbsp;&nbsp;└─ **now** — the sidebar asks for the cards holding a
session, marked from the board until they answer

`GET …/work-items?scope=sessions`
&nbsp;&nbsp;└─ **new** — cards holding any session and their related
cards, in board order

`scope` with any other value, or sent together with `sessionId`
&nbsp;&nbsp;└─ **new** — 400 `invalid_scope`, never the whole board

a board page, a new-session draft
&nbsp;&nbsp;└─ **unchanged** — one board read, shared by the page and
the sidebar

⌘K
&nbsp;&nbsp;└─ **unchanged** — still reads the whole board

### Shape changed

| | | |
|---|---|---|
| **+** | `allSessionCards(board)` | picks the scope's cards, kept once
per board version |
| **~** | `sessionCards` | shares `withRelatedCards` with it, same
result |
| **~** | `scopedSnapshot` | serialized once per card list; its ETag
still names the body |
| **~** | `listWorkItems(…, only)` | fourth argument takes `{ sessionId
}` or `{ scope }` |
| **~** | `boardQueryOptions(…, scope)` | third argument `'sessions'`
narrows the board to the scope |
| **+** | `pageLoadsBoard(pathname)` | names the pages that load the
board themselves |
| **+** | `useSidebarWorkItemsQuery` | the board on those pages, the
scope elsewhere |
| **+** | `prefetchDraft` | the draft's loader: the composer's queries
plus the board |

what the reviewer now lives with
&nbsp;&nbsp;&nbsp;&nbsp;`?scope=sessions` on `workItemList` ·
`workItemListQuerySchema.scope` · error `invalid_scope` ·
`queryKeys.workItemsWithSessions(projectId)` · `pageLoadsBoard`

### Decisions

- **a scope the server resolves, not the sidebar's session ids** — the
ids come from another request and have no upper bound; repeated
`sessionId` already works if you'd rather not add the param
- **which list the sidebar reads is decided from the URL** —
`pageLoadsBoard` is a path pattern next to `isSettingsPath`, because the
sidebar's loader only gets the URL; a new page that loads the board has
to be added to it, or it downloads both lists; `AppStartup` checks the
four pages there are today
- **between its two lists the sidebar borrows the other one from the
cache, not `keepPreviousData`** — the previous data could be another
Factory's cards after switching Factory

### Cost

Moving from a board to a session page now sends one request where main
sent none. A board opened from a session page is no longer already in
memory: its columns wait for the read. The sidebar's list takes a write
only for a card it already holds, so a card that gains its first session
reaches it with the next refetch, not from the mutation's response. The
scope also returns cards held only by a teammate's private session,
which the sidebar has no row for. On the server the scoped list is
picked and serialized once per board version and shared by every tab.

### Watch

on deploy: nothing to migrate, and tabs loaded before the deploy keep
reading the whole board from the sidebar. Worth a look afterwards:
unscoped `GET …/work-items` should drop to board pages, drafts and ⌘K.
Also the size of `?scope=sessions` next to the whole board. A card keeps
its session until that session is deleted, so the scoped list grows with
every card a session has worked: on a board where most cards have been,
the two are nearly the same download and the sidebar needs paging
instead.

### Not verified

- [ ] a real large board — sizes and timings; the tests use a handful of
cards
- [ ] a live browser — everything ran under Vitest with MSW
- [ ] moving between a session page and a board through the real router
— the test drives the sidebar alone, behind a plain link
- [ ] `AppStartup` on my machine — its 8 route cases fail on a late `GET
/web/status`, on main too; with that request masked all 11 pass

---

> ██████████████████ **tests** `+216 −40` — 55% of the additions
> ████████████ **source** `+142 −54`
> █ **changeset** `+16`
> █ **generated** `+15`
> █ **docs** `+1 −1`


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## ELI5

The Factory sidebar now loads only cards connected to sessions when it
does not need the full board. This reduces unnecessary data loading
while keeping session card sources and waiting indicators accurate.

## Changes

- Added `scope=sessions` to the Factory work-item list API.
- Scoped results include session cards, related cards, and linked pull
requests in board order.
- Reject invalid scopes and `scope` combined with `sessionId` with `400
invalid_scope`.
- Shared related-card selection through `withRelatedCards` and cached
`allSessionCards`.
- Added scoped ETag and snapshot caching that ignores changes outside
the scoped cards.
- Added scoped query keys, request handling, and
`useSidebarWorkItemsQuery`.
- Use the full board on board pages and session-scoped cards elsewhere.
- Added placeholder data when switching between the full-board and
scoped queries.
- Added board and draft prefetching, including immediate board
prefetches.
- Use a parked-session ID set for sidebar lookups.
- Updated API documentation, generated route metadata, and changesets.
- Expanded route, startup, sidebar icon, and session filtering tests.

## Validation

- Test execution results are not available.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local>
2026-11-11 10:58:12 -08:00
Eric Pinzur
b2e0e40b57
feat(cli): align score and feedback API commands (#30089)
Closes [OBS-794](https://linear.app/kepler-crm/issue/OBS-794).

Adds `feedback create`, `list`, `get`, `replace`, and `review-status`,
plus `aggregate`, `breakdown`, `timeseries`, and `percentiles` for both
scores and feedback. Creates generate missing IDs and timestamps once
and preserve them across bounded HTTP retries and credential fallback.
Replacements require the original identity and timestamp; review-status
updates preserve missing-record errors. Context-mode omission and
feedback author fields are passed through without inferring values.

List output preserves pagination and delta cursors, and write output
retains the server's success and identity data. Score/feedback schemas
are generated from the server routes and bundled for `--schema` without
requiring a target schema endpoint. Most of the diff is that generated
file. Includes help examples, CLI reference docs, and a minor `mastra`
changeset.

Validation: 221 CLI API tests, including 57 real-HTTP cases; 20 repeated
timeout/credential-fallback runs; CLI typecheck; type-aware
lint/precommit checks; docs check with Vale and the CI Vale
configuration. Validated all 14 write/analytics help examples against
the current server body schemas. Missing-anchor retries, transient
failures, credential fallback, older success-only responses, unsupported
endpoints, and API-prefix/auth headers are covered.

The full `turbo build --filter mastra` stopped in the unchanged
`@mastra/playground-ui` declaration step (`tsc found type errors`, with
no underlying diagnostic emitted) before building the CLI. Local checks
used Node 23.11.0, which is outside the repository's requested engine
range. Live Platform writes and package publication/deployment were not
tested.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## ELI5

This PR adds commands to create, review, list, and analyze scores and
feedback. It also makes retries safer by preserving the same IDs,
timestamps, and request data.

## Changes

- Added feedback `create`, `list`, `get`, `replace`, and `review-status`
commands.
- Added `aggregate`, `breakdown`, `timeseries`, and `percentiles` for
scores and feedback.
- Added validation for write inputs and feedback replacement identity.
- Added bounded retries for transient failures and credential fallback.
- Preserved pagination cursors, response identity data, and feedback
fields.
- Bundled generated score and feedback schemas for offline `--schema`
output.
- Added unsupported-endpoint errors for HTTP 405 and 501 responses.
- Updated documentation, help examples, and the `mastra` changeset.
- Added HTTP-backed tests for commands, validation, retries, responses,
and schemas.

## Validation

- The author reports 221 CLI API tests, including 57 real-HTTP cases.
- The author reports passing typecheck, lint, precommit, Vale, and
documentation checks.
- The build stopped in the unchanged `@mastra/playground-ui` declaration
step before the CLI build.
- Local checks used Node 23.11.0, outside the repository’s requested
engine range.
- Live Platform writes and package publication or deployment were not
tested.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-11 19:53:52 +01:00
mastra-platform[bot]
b0ef22e7bf
feat(schedules): Add bounded one-off schedules (#25131)
> Opened by @abhiaiyer91

Refs #24610

## Summary
Schedules can now fire once or stop after a given time, so you no longer
need to pin a cron expression to a date and clean it up yourself.

- **New `completed` status**: the scheduler and timing reconciliation
set it when no automatic fires remain. It's written in the same atomic
`nextFireAt` check-and-set used to claim a run, so a schedule still
fires only once across instances. A cron with no future occurrence left
also moves to `completed` instead of erroring. `pause`/`resume` on a
completed schedule return 409. Changing `runAt`/`endAt` reactivates it
only when the resulting timing can still fire. `list()` hides completed
schedules unless you pass `status: 'completed'`.
- **Declarative workflow schedules**: `createWorkflow({ schedule: {
runAt } })` and `{ cron, endAt }` are supported. Past times are accepted
so redeploys don't fail, and a completed schedule isn't re-armed unless
its timing changes.
- **Trigger kind**: one-off fires report `trigger.kind: 'once'`.
- `run(id)` doesn't complete a one-off schedule.

## Surfaces
- **Core**: types, validation, scheduler claim logic,
create/update/pause/resume/list, declarative sync.
- **Storage**: new nullable `run_at`/`end_at` columns for libsql, pg,
mysql, mongodb, spanner, convex and in-memory. Existing columns are
untouched: one-off schedules store `cron` as `''`.
`updateScheduleNextFire` takes an optional `newStatus`.
- **Server/client-js/CLI**: request bodies accept `runAt`/`endAt`
(one-of rule checked in the schema). Responses include the new fields
and `completed`. Route types and CLI route metadata regenerated.
- **Studio**: shows the run time for one-off schedules, shows the
`endAt` bound, adds a `completed` badge and hides pause/resume for
completed schedules.
- **Docs + changeset.**

## Not in this PR (remaining #24610 work)
- ISO 8601 string inputs for `runAt`/`endAt` (numbers and `Date` are
accepted today).
- The template `schedule_once` tool.

## Test plan
- [x] core: schedules, scheduler, cron, schedule-config and scheduler
integration tests (260 passing), clean `tsc`
- [x] Shared adapter suite gained tests for `runAt`/`endAt` round-trip
and atomic status CAS. Passing on libsql, pg, mysql and mongodb
(Docker), plus convex server tests. **Not run on Spanner (no emulator
available); typecheck only.**
- [x] server schedules handler tests (51 passing, including
one-off/bounded creation and body validation)
- [x] client-js and playground typecheck clean; playground schedules
tests passing

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## ELI5

Schedules can now run once at a chosen time or repeat until a chosen end
time. They complete when their planned runs are over, and changing their
timing can make them active again.

## Summary

- Added `runAt` for one-off agent and workflow schedules. API-created
schedules require a future `runAt`; declarative workflow schedules can
register past times as `completed`.
- Added `endAt` for cron schedules. A schedule becomes `completed` when
its next run would occur after `endAt`, or when no future run remains.
- Completed schedules cannot be paused or resumed. Timing changes can
reactivate a completed schedule when a future run remains. `list()`
hides completed schedules unless callers filter with `status:
'completed'`.
- Resuming a paused one-off schedule after its `runAt` has passed allows
it to fire on the next scheduler tick. Calling `run(id)` manually does
not complete a one-off schedule.
- Added the `once` trigger kind for scheduled one-off agent fires.
Manual runs remain `manual`.
- Declarative workflow schedules preserve completed status across
redeploys when timing is unchanged. Timing changes can re-arm them.
- Updated schedule APIs, storage adapters, Studio, and documentation.
Storage persists `runAt` and `endAt` and supports atomic status updates.

## Checks

Current-head CI, build, and test results: not available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com>
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>
Co-authored-by: NikAiyer <nick.aiyer@gmail.com>
Co-authored-by: mastra-platform[bot] <mastra-platform[bot]@users.noreply.github.com>
Co-authored-by: Ehindero Israel <iehindero419@stu.ui.edu.ng>
2026-11-11 19:33:50 +01:00
Damien Schneider
005b6f0247
feat(factory): list one session's cards with ?sessionId= (#30080)
**─────── TLDR ───────**
> A Factory session page now asks for its own cards with `?sessionId=`,
so its tab title, breadcrumb and pull request links stop waiting for the
whole board.

On a large board the work-item list is the biggest download the UI
makes, and three places on a session page read all of it to find one
card. The list route now takes an optional, repeatable `sessionId` and
answers with the cards holding those sessions plus the cards related to
them, in the same shape. `PageTitle`, `StatusLine` and
`RelatedFactorySessions` read that instead.

This is step 1 of taking the full-board read out of the UI. The sidebar
still loads the board on these pages until the next PR, so total bytes
on a session page don't drop yet.

### Behavior changed

a session page while the board is still downloading
&nbsp;&nbsp;├─ **was** — tab title, breadcrumb and PR links wait for the
whole board
&nbsp;&nbsp;└─ **now** — they show as soon as the session's own cards
arrive

`GET …/work-items?sessionId=a&sessionId=b`
&nbsp;&nbsp;└─ **new** — cards holding those sessions and their related
cards, in board order

a card outside that scope changes
&nbsp;&nbsp;└─ **new** — the scoped read gets a 304, its ETag hashes the
body

a `sessionId` that is empty or longer than 512 characters
&nbsp;&nbsp;└─ **new** — 400 `invalid_session_id`, never the whole board

`GET …/work-items` with no `sessionId`
&nbsp;&nbsp;└─ **unchanged** — the whole board, same ETag and gzip path

### Shape changed

| | | |
|---|---|---|
| **+** | `relatedCardIndex(cards, facts)` | extracted from the UI so
the server scope uses the same rules |
| **~** | `relatedWorkItemIndex` | now a wrapper over it, same
signature, callers untouched |
| **+** | `scopedSnapshot` | sibling of `boardSnapshot`, with a
body-hash ETag |
| **+** | `useSessionWorkItemsQuery` | the scoped read, keyed under the
board key |

what the reviewer now lives with
&nbsp;&nbsp;&nbsp;&nbsp;`?sessionId=` on `workItemList` ·
`workItemListQuerySchema` · `@mastra/factory/work-items/related-cards` ·
`queryKeys.sessionWorkItems(projectId, sessionId)`

### Decisions

- **related cards ride along in the scoped answer** — the header's
related links read them; drop the second pass in `sessionCards` to
return holders only
- **scoped key nested under the board key** — feed invalidation and the
board's optimistic writes reach it unchanged; a sibling key would need
each wired again
- **no cap on repeated `sessionId`** — the sidebar PR knows the real
count; one `.max()` on the schema then

### Cost

Until the sidebar moves, a session page makes one request more than
before: the scoped read, next to the board read the sidebar still makes,
and again on each feed event (a 304 when its cards didn't change). The
server still loads the cached board to answer it, then stringifies and
hashes the picked cards on every request.

### Watch

on deploy: nothing to migrate, and tabs loaded before the deploy keep
calling the unscoped route. Worth a look afterwards: response size and
duration of `GET …/work-items` with and without `sessionId`. The
unscoped count per session page stays flat until the sidebar PR.

### Not verified

- [ ] a real large board — sizes and timings; the tests use a handful of
cards
- [ ] a live session page in a browser — the three surfaces ran under
Vitest with MSW only

---

> ██████████████████ **tests** `+358 −53` — 58% of the additions
> ███████████ **source** `+223 −96` — 57 of the removed lines are
relation logic leaving the UI
> █ **generated** `+18 −2` — CLI route metadata
> █ **changeset** `+16`
> █ **docs** `+2`


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## ELI5

A session page can now request only the work-item cards connected to its
session. This lets page details load without waiting for the full board
request.

## Changes

- Added repeatable `sessionId` filtering to the work-item list route.
- Returns matching cards and related parents, children, and pull
requests in board order.
- Returns `400 invalid_session_id` for invalid session IDs.
- Added scoped snapshots with body-based weak ETags and conditional
`304` responses.
- Extracted shared relationship logic into `relatedCardIndex`.
- Added session-scoped React Query keys, requests, and cache updates.
- Updated page titles, status lines, related sessions, and pull-request
links to use scoped cards.
- Preserved unscoped board behavior.
- Added route, hook, and UI test coverage, documentation, changesets,
and generated route metadata.

## Known limitation

The sidebar still loads the full board. The scoped request adds another
request and still reads the cached board server-side.

## Validation

Test execution status: not available.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local>
2026-11-11 09:29:43 -08:00
dane-ai-mastra[bot]
3a6ca42696
chore: version packages (alpha) (#30026)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-11 08:16:57 -08:00
Eric Pinzur
c860b9bb43
feat(observability): support OSS feedback replacement (OBS-887) (#30059)
Implements
[OBS-887](https://linear.app/kepler-crm/issue/OBS-887/add-oss-feedback-replacement-and-export).

Add OSS `PUT /api/observability/feedback/:feedbackId` with the existing
wrapped client request. Replacements retain the original feedback ID,
trace ID, timestamp, and tenant; omitted optional fields are cleared. A
full replacement can create a missing record. OSS persists locally
before responding, then independently notifies supporting exporters.
Resolve mode still requires the local anchor. The SDK also exposes
optional `replaceFeedback()` for independent exporter delivery without a
producer-side storage lookup.

Replacement events use a separate optional exporter hook.
`MastraPlatformExporter` sends PUT with stable identity across bounded
anchor retries, and flush/shutdown drain deliveries. Older exporters
skip replacements rather than replaying them as creates. Unsupported
storage/package combinations return 501 or skip unavailable export
support. No UI changes; review-status PATCH propagation remains tracked
in OBS-785.

In-memory, PostgreSQL vNext, DuckDB, and ClickHouse vNext support
replacement. In-memory, PostgreSQL, and DuckDB enforce replacement
identity at the write. PostgreSQL coordinates writes by feedback ID,
including duplicates submitted with a different timestamp. Duplicate
HTTP creates return the stored identity and timestamp and re-notify
exporters with accepted values. Tenant mismatches remain hidden, and an
omitted SDK replacement author stays null. HTTP/exporter creates use
`onConflict: 'ignore'` so a delayed original create doesn't undo an
edit; direct storage calls keep their legacy upsert default.
**ClickHouse requires no migration:** it uses the existing schema and
read-before-insert protection. Sequential delayed creates are covered,
but overlapping writes from separate processes can race; this is not a
globally ordered or exactly-once protocol.

Latest review fixes: DuckDB's lazy facade delegates replacement to its
guarded writer; concurrent coverage runs 20 overlapping request pairs
per identity variant. Direct storage replacements normalize an omitted
author to null. PostgreSQL single-feedback reads use the primary for
read-after-write consistency, while list/aggregate reads retain the
configured read client. Batch advisory locks use one ordered query with
unchanged lock keys.

Validation: the stronger DuckDB regression failed on all four identity
variants before the facade fix. Afterward, the entire DuckDB package
passed 718 tests across 21 files in three consecutive runs. PostgreSQL
passed 57 feedback tests, including a real stale read snapshot and
overlapping reversed 1,000-ID batches. Shared replacement tests passed
on in-memory (12), and the new author regression passed on ClickHouse
without a migration. Core/storage builds and declarations, typed lint,
and formatting passed. Earlier HTTP (85 cases on each of four adapters),
generic Hono routes (2,848), server/system, exporter, and docs checks
remain recorded in the PR history. Local tests use Node 23.11.0; CI
validates the supported runtime.

The unrelated Traces UI fade assertion failure was fixed in
https://github.com/mastra-ai/mastra/pull/30068; this branch includes
that fix from main.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## ELI5

This PR lets users replace feedback without changing its identity. It
stores the replacement locally and sends it to supported exporters
without allowing delayed creates to overwrite it.

## Changes

- Added `PUT /api/observability/feedback/:feedbackId`.
- Preserved the feedback ID, trace ID, timestamp, and tenant.
- Cleared omitted optional fields.
- Added capability detection and `501` responses for unsupported
storage.
- Added replacement event types, SDK support, client types, route
metadata, and documentation.
- Added replacement delivery, stable retries, flush handling, and
shutdown draining for `MastraPlatformExporter`.
- Added replacement support for in-memory, PostgreSQL vNext, DuckDB, and
ClickHouse vNext.
- Added `onConflict: 'ignore'` for HTTP and exporter creates. Direct
storage calls retain their upsert default.
- Older exporters skip replacements instead of replaying them as
creates.
- Added ClickHouse support without a migration. Concurrent writes from
separate processes can still race.
- No UI changes were included.

## Validation

The author reports passing the HTTP route and contract suites, feedback
storage suites, partition and SQL tests, server and system tests,
record-builder tests, build, typecheck, lint, and documentation checks.

For the current head, the available CI result is `2027dev Evals:
skipped`. Other listed CI checks target different commits or remain in
progress. Current-head CI results are otherwise not available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-11 17:04:57 +01:00
Eric Pinzur
9751742c44
feat(observability): add aggregated trace root contracts (#30054)
Adds the shared contract for the Platform aggregated-roots experiment in
[OBS-891](https://linear.app/kepler-crm/issue/OBS-891): optional
`rootSource`, `rootKind`, runtime/error totals, and availability
reporting. Legacy requests retain their cursor bindings; aggregated
cursors are separate and aggregated metadata predicates and delta
requests are rejected.

The planner requires host opt-in. OSS servers report the capability as
false and explicitly reject aggregated requests; storage implementations
and UI are outside this prerequisite. Generated client and CLI contracts
are updated.

Validated with 102 core tests, 146 server tests, core typecheck,
core/server/client builds, and formatting/lint checks. A mutation check
confirms that removing root-source cursor binding fails the regression
test. Platform implementation follows after this merges and a snapshot
is published.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## ELI5

This PR defines how systems can report aggregated trace roots and their
totals. Systems without support reject these requests, while existing
legacy trace queries continue to work.

## Changes

- Added `rootSource` with `legacy` and `aggregated` values.
- Added aggregated-root response fields:
  - `rootKind`
  - `runtimeDurationMs`
  - `errorCount`
- Bound trace and group cursors to their root source.
- Rejected aggregated delta requests.
- Rejected metadata predicates for aggregated roots.
- Kept `runtimeDurationMs` and `errorCount` response-only.
- Added the `traceQueryAggregatedRoots` capability, which defaults to
`false`.
- Added a `501 TRACE_QUERY_UNSUPPORTED` response for unsupported
aggregated requests.
- Updated generated client and CLI route contracts.
- Added core and server regression tests.
- Added release changes for `@mastra/core`, `@mastra/client-js`,
`@mastra/server`, and `mastra`.

## Validation

Not available from completed checks on the current head.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-11 14:26:42 +01:00
Max Katz
9ee332c1fd
feat(ui): rounded squircle favicon for Studio, Factory and docs (#30040)
The tab icon gets rounded corners, matching the rounded style used
everywhere else in the UI. Today's tile has a 5% corner radius, which
reads as a plain square at 16px. The new tile is a squircle
(superellipse, n=7), the smooth corner shape app icons use. The logo is
at 80% of the tile width and centered, so it has a little room from the
corners.

## Before / After

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/de26b6ac-83db-4212-9a46-a73b36daa714"
width="400" alt="Before"> | <img
src="https://github.com/user-attachments/assets/d1f885ba-c647-4fa6-9a7d-58e7b72dcf02"
width="400" alt="After"> |

## What changed

- Studio (`mastra-dark-tile.svg`, green dev variant), Factory
(`mastra.svg`, `mastra-dev.svg` and the four session status icons) and
the docs `favicon.ico` all come from the same source, so they stay
identical.
- Factory's status dot still sits on the logo's bottom-left dot.
- `mastra studio` now serves `/mastra-dark-tile.svg` as a file. It still
checked for the old `/mastra.svg` name, so the tab got the page HTML
instead of the icon.

## Scope

- Factory's PWA and apple-touch PNGs stay as they are: the OS masks
those itself, so a rounded tile inside them would look double-rounded.
- Platform and mastra.ai get the same icon in their own PRs.

## Testing

1. Run Studio or Factory: the tab shows the rounded tile (green logo in
dev).
2. Factory: open a session, and the colored status dot shows on the same
rounded tile.
3. Docs: the tab shows the rounded tile from `favicon.ico`.
4. Run `mastra studio`: the tab shows the rounded tile.



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## ELI5

This PR makes the Mastra favicon more rounded across Studio, Factory,
and the docs. It also makes Studio serve the correct icon file so
browsers display it.

## Changes

- Updated Studio, Factory, and Factory session-status SVGs with the
rounded tile design.
- Replaced the docs `favicon.ico`.
- Updated Studio asset handling to serve `/mastra-dark-tile.svg`,
including nested paths.
- Added a test for serving the Studio favicon instead of the SPA HTML.
- Added patch changesets for `mastra` and `@mastra/factory`.

## Validation

- Test results: not available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-11 14:20:52 +04:00
dane-ai-mastra[bot]
695599b8ab
chore: version packages (alpha) (#30013)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-10 22:48:39 -08:00
mastra-platform[bot]
2c4f13b0e5
Avoid timeouts when switching running-session models (#29979)
Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com>
2026-11-10 22:22:59 -08:00
dane-ai-mastra[bot]
8bce7717eb
chore: version packages (alpha) (#29986)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-10 20:51:40 -08:00
Arthur Fiorette
bd1fca831d
fix(deployer): build and serve file-based agents with CloudflareDeployer (#30003) 2026-11-10 20:32:18 -08:00
Caleb Barnes
2d16c84823
feat(factory): Factory-wide sandbox environment variables (#29923)
Factory members can now add environment variables for every sandbox in a
Factory, under Settings › Manage Factory › Environment variables. Each
variable is marked Build, Runtime, or Both.

Runtime variables reach every command in the Factory's sandboxes.
Adding, editing or deleting one takes effect on the next command in a
sandbox that's already running, with no restart (processes already
running keep their old env). Build variables reach template builds and
Factory's setup commands, never runtime commands, and editing one makes
the next build rebuild the template.

Values are encrypted at rest, never returned by the API or shown in the
UI after saving, and never put into template names, identity, or images.
Saving is blocked when sign-in is on but no credential encryption key is
configured.

To make builds work, `FactorySandboxContext` gets two optional fields.
Providers pass `buildEnv` only to a build-only mechanism and put
`buildEnvRevision` (a random id, never derived from values) in template
identity:

```ts
const { buildEnv, buildEnvRevision, ...rest } = ctx;
return createRepoTemplate({ ...rest, buildEnvRevision });
```

The platform and E2B workspace packages pass Build variables to template
builds. Docker keeps them out of the image and its identity, and doesn't
apply them to template builds yet. The routes are also available from
the CLI as `mastra api factory project environment variables
list|set|update|delete`.

Tested with unit tests on a real local sandbox, route tests that check
no response ever contains a value, and UI tests. I also ran it end to
end against a Platform sandbox: a Runtime variable's new value showed up
after an edit and was gone after a delete, and a Build variable was seen
by setup but not at runtime, with an edit producing a new build.

Part of FACT-554


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## ELI5
Factory admins can save environment variables for a project and choose
whether each one is used to build sandboxes, run commands, or both.
Factory protects the values and applies changes to later commands or
relevant builds.

## Summary
- Added encrypted, project-scoped storage and authenticated API routes
to list, set, update, and delete sandbox environment variables.
Responses include metadata, not values. When sign-in is enabled without
a credential encryption key, writes are blocked.
- Added a Factory settings interface and CLI commands to manage
variables with Build, Runtime, or Both scopes.
- Runtime variable changes refresh the environment before later
commands. Build variables are available to build contexts and setup
commands. Build-variable changes update a revision used by supported
providers for template identity.
- Reads are served from memory per server: the revision and decrypted
values are reused until a variable changes. A write clears this server's
entry and is announced on Factory's event bus so other servers drop
theirs; a cached read is re-checked after a minute with a cross-process
bus, or after a second without one.
- Added optional `buildEnv` and `buildEnvRevision` fields to
`FactorySandboxContext`. Platform and E2B pass Build variables to
template builds. Docker excludes these fields from template input and
identity; Docker template builds do not receive the variables.
- Added documentation and tests for storage, API routes, settings, CLI,
sandbox behavior, and provider handling.

**Diff size:** 54 files changed; 3,241 lines added and 50 removed.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: CalebBarnes <CalebBarnes@users.noreply.github.com>
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-10 17:14:26 -07:00
dane-ai-mastra[bot]
23cc34a9c5
chore: version packages (alpha) (#29938)
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.28.0-alpha.6


## @mastra/code-sdk@1.19.0-alpha.6


## @mastra/playground-ui@69.0.0-alpha.7


## @mastra/client-js@1.60.0-alpha.6


## @mastra/react@1.15.0-alpha.6


## @mastra/deployer-cloud@1.83.0-alpha.6


## @mastra/longmemeval@1.1.42-alpha.6


## @mastra/opencode@0.1.42-alpha.6


## create-factory@0.4.3-alpha.6


## mastracode@0.50.0-alpha.6


## @mastra/agent-builder@1.2.1-alpha.3


## mastra@1.39.0-alpha.6


## @mastra/core@1.83.0-alpha.6


## @mastra/deployer@1.83.0-alpha.6


## @mastra/editor@0.17.1-alpha.4


## @mastra/mcp@2.9.0-alpha.3


## @mastra/mcp-docs-server@1.3.13-alpha.9


## @mastra/memory@1.41.1-alpha.3


## @mastra/rag@2.7.3-alpha.2


## @mastra/schema-compat@1.3.18-alpha.0


## @mastra/server@1.83.0-alpha.6


## @mastra/elysia@0.1.23-alpha.6


## @mastra/express@1.5.27-alpha.6


## @mastra/fastify@1.5.27-alpha.6


## @mastra/hono@1.7.25-alpha.6


## @mastra/koa@1.7.27-alpha.6


## @mastra/nestjs@0.3.0-alpha.6


## @mastra/next@0.2.41-alpha.6


## @mastra/server-adapters-test-suite@0.3.0-alpha.3


## @mastra/tanstack-start@0.2.41-alpha.6


## @mastra/upstash@1.6.1-alpha.0


## @mastra/vectorize@1.1.5-alpha.0


## @mastra/voice-google-gemini-live@0.14.19-alpha.0


## @mastra/voice-openai-realtime@0.14.9-alpha.0


## @mastra/voice-xai-realtime@0.2.18-alpha.0


## @mastra/inngest@1.11.2-alpha.4


## @mastra/temporal@0.6.0-alpha.6


## create-mastra@1.39.0-alpha.6


## @internal/playground@1.39.0-alpha.6

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-10 15:51:29 -08:00
mastra-platform[bot]
8d4f090107
Factory: replace work-item comments with a card description (#29062)
> Opened by @DSchau

## What

This removes comments from Factory work items across the API, storage,
agent tools, integrations and UI. In their place, each card gets a
single **description**.

**Removed**
- Comments storage: `work_item_comments`, `work_item_comment_mentions`
and `work_item_activity` are no longer registered.
- The comment CRUD routes, `/mention-roster` and the `/feed-events` SSE
stream. The stream only ever refreshed comment queries.
- The `mention` and `activity` attention kinds and their providers.
- Work-item fields `commentCount` and `feedActivityAt`.
- Slack integration: `aside` messages are no longer saved as card
comments (the agent still ignores them), and card comments are no longer
published back to Slack. The Slack emoji table, which existed only to
support that, is gone too.
- Integration hooks: `IntegrationContext.feed` and the integration
`feedPublisher` hook.
- Rules dispatcher: kickoffs no longer get the comment feed injected.
- UI: the feed panel, composer, comment counts on cards, the workspace
Comments button, `?comment=` deep links and the feed-events provider.
- Audit actions `comment_*`, and `commentId` on `factoryWorkItemUrl()`.

**Added**
- A nullable `description` column on work items. Pg adds it on boot with
`ADD COLUMN IF NOT EXISTS`.
- Create and update routes accept `description`; a blank value clears
it.
- Agent tools:
  - `factory_create_work_item` takes `description` instead of `brief`.
  - `factory_update_work_item` can edit the description.
  - `factory_inspect_work_item` returns it.
- Kickoffs append a `<work-item-description>` block, with an escaped
boundary and a "data, not instructions" preamble. The playground-ui
transcript renderer and the TUI now handle that tag instead of
`<work-item-feed>`.
- The card tray shows title, then an editable description, then the
activity timeline. Dragging a candidate with a custom prompt saves that
prompt as the card description.

Docs PR: mastra-ai/softwarefactory-docs, branch
`slack/1793395240-241709`.

## Proof
- `mastracode/factory`: `tsc --noEmit` and `oxlint --type-aware` are
clean, and the full vitest suite passes (226 files).
- `factory-ui`: typecheck and lint are clean. Full suite: 2,227 tests
pass. Two failures remain, and both also fail on unmodified `HEAD`:
  - `BoardPageProposedRun` "leads with the suggested run…"
  - `SessionsSectionGroups` "says so when every group…hidden"
- `playground-ui` (`skill-activation`, `span-payload-signal`), `tui`
(`render-messages`) and `core` (`signals`) tests pass, and those
packages typecheck clean.
- New and changed tests cover:
- the description in dispatcher kickoffs, including tag escaping and the
replay guard
  - setting and clearing the description through the tools
  - the attention inbox across the remaining kinds
- the description editor in the board virtualization and grouped-list
tests

## Unverified
- Not run against a real Postgres. The new column relies on the existing
boot-time `ADD COLUMN IF NOT EXISTS`.
- The Playwright e2e specs were not run. Only their feed-events stubs
changed.

## Risk: medium
- **Existing data stays in the database.** Factory storage has no
drop-table operation, so the old comment tables and the
`comment_count`/`feed_activity_at` columns remain unused. Old
`mention`/`activity` receipt rows are inert, because reads are filtered
by kind. A follow-up migration could drop them.
- **Breaking API change.** Callers sending `brief` to
`factory_create_work_item`, or calling the removed routes or attention
kinds, will break. See the changeset.
- **Old transcripts.** Messages that contain the old `<work-item-feed>`
trailer now show as raw text instead of a folded row.
- **Session owner names.** The session hover card now names people only
from the audit trail. An earlier owner who never appears there shows as
a raw id. Previously the mention roster could fill in their name from
comment authors or Slack links.
- **New card composer.** It still takes only a title; the description is
added from the card tray.

---------

Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>
Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local>
2026-11-10 15:07:41 -08:00
dane-ai-mastra[bot]
779d2875b1
chore: version packages (alpha) (#29912)
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/auth-studio@1.4.0-alpha.1


## @mastra/factory@0.28.0-alpha.5


## @mastra/mcp-apps-components@0.1.0-alpha.5


## @mastra/playground-ui@69.0.0-alpha.6


## @mastra/client-js@1.60.0-alpha.5


## @mastra/react@1.15.0-alpha.5


## @mastra/deployer-cloud@1.83.0-alpha.5


## @mastra/longmemeval@1.1.42-alpha.5


## @mastra/opencode@0.1.42-alpha.5


## create-factory@0.4.3-alpha.5


## @mastra/code-sdk@1.19.0-alpha.5


## mastracode@0.50.0-alpha.5


## @mastra/agent-builder@1.2.1-alpha.2


## mastra@1.39.0-alpha.5


## @mastra/core@1.83.0-alpha.5


## @mastra/deployer@1.83.0-alpha.5


## @mastra/editor@0.17.1-alpha.3


## @mastra/mcp@2.9.0-alpha.2


## @mastra/mcp-docs-server@1.3.13-alpha.8


## @mastra/memory@1.41.1-alpha.2


## @mastra/rag@2.7.3-alpha.1


## @mastra/server@1.83.0-alpha.5


## @mastra/elysia@0.1.23-alpha.5


## @mastra/express@1.5.27-alpha.5


## @mastra/fastify@1.5.27-alpha.5


## @mastra/hono@1.7.25-alpha.5


## @mastra/koa@1.7.27-alpha.5


## @mastra/nestjs@0.3.0-alpha.5


## @mastra/next@0.2.41-alpha.5


## @mastra/server-adapters-test-suite@0.3.0-alpha.2


## @mastra/tanstack-start@0.2.41-alpha.5


## @mastra/libsql@1.30.0-alpha.2


## @mastra/turso@0.1.21-alpha.2


## @mastra/inngest@1.11.2-alpha.3


## @mastra/temporal@0.6.0-alpha.5


## create-mastra@1.39.0-alpha.5


## @internal/playground@1.39.0-alpha.5

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-10 10:50:08 -08:00
shreyas-mastra
bfda77de97
fix(core,server): scope experiment comparison by organization and project (#29479)
`mastra.datasets.compareExperiments` had no way to scope by organization
or project, and the compare route ignored the tenancy query params the
other dataset routes accept. A caller scoped to one tenant could compare
experiments from another by ID.

`compareExperiments` now takes `organizationId` and `projectId`. When
either is set, every experiment must match, otherwise it throws
`EXPERIMENT_NOT_FOUND` (same as a missing row, so other tenants' IDs
don't leak). The route reads `tenancyQuerySchema` and passes the scope
to both the dataset lookup and the comparison. Unscoped calls behave as
before.

Added manager tests for a cross-tenant pair (rejected, fails without the
fix) and a same-tenant pair. Core datasets tests (490), server datasets
handler tests (106), tsc and lint pass.

Fixes PLTFRM-3165


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## ELI5

When a caller chooses an organization or project, experiment comparisons
now stay within that scope. Experiments outside it are treated as not
found, so their results are not exposed.

## Changes

- `mastra.datasets.compareExperiments` accepts optional `organizationId`
and `projectId` values.
- When either scope is set, the manager checks every distinct experiment
ID. It throws `EXPERIMENT_NOT_FOUND` if an experiment is missing or
outside the scope.
- The comparison route reads tenancy query parameters and passes them to
the dataset lookup and comparison.
- If scoped comparison is requested with a core version that does not
advertise tenancy enforcement, the route returns HTTP 501 before reading
data. Unscoped comparisons remain unchanged.
- Tests cover cross-organization rejection, same-organization
comparisons, and the route’s behavior when the core feature is
unavailable.
- Updated generated route metadata and added patch changesets for
`@mastra/core` and `@mastra/server`.

## Validation

Current-head test, TypeScript, and lint results are not available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-11-10 12:27:39 -05:00
dane-ai-mastra[bot]
7c4dd88400
chore: version packages (alpha) (#29889)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-10 15:48:17 +01:00
Eric Pinzur
2cfa92405b
feat(observability): add shared text search query contracts (#29897)
Adds shared text-search query contracts for Platform integration:
optional `textSearch` on `querySpans()` and `queryTraces()`,
normalization, a 3–256 character limit, and cursor binding. This does
not implement or enable text search in OSS stores.

Adds capability reporting, request forwarding, and unsupported-store
rejection, with generated client types and CLI metadata. Platform search
implementation and rollout flags follow in OBS-867. Delta search is
rejected for now. Public documentation is unchanged; changesets only
describe the contract additions.

Validated with 404 focused tests, 5 type tests, and core/server/client
typechecks. The 228 core query tests were rerun after reducing the limit
to 256. New contract tests also fail against the original
implementation.

Fixes
[OBS-866](https://linear.app/kepler-crm/issue/OBS-866/add-shared-text-search-query-contracts).


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## ELI5
This PR gives span and trace queries a standard way to request text
search. It also lets clients check whether a storage provider supports
that search, so unsupported searches return an error instead of
misleading results.

## Summary
- Add optional `textSearch` to span and trace query contracts. Trim
outer whitespace, convert input to lowercase, and require 3–256 Unicode
code points.
- Bind normalized search text to query cursors. Reject `textSearch` for
delta trace queries.
- Add span and trace text-search capability fields. Default missing
fields to `false` for compatibility with older responses.
- Forward search input to query planners. Return HTTP 501 when the
configured storage provider does not declare support.
- Report text-search capability only when Core can parse the field and
the storage provider declares the matching feature.
- Add tests for validation, normalization, cursor binding, unsupported
stores, and compatibility behavior.

## Validation
Reported test and typecheck results: not available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-10 15:12:03 +01:00
Ward Peeters
85f28b583a
fix(factory): remove the unreleased allowWorkingPhase from intake routes (#29894)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-11-10 12:50:17 +01:00