mirror of
https://github.com/mastra-ai/mastra.git
synced 2026-11-17 08:44:46 +00:00
254 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8d4abc4f88 |
chore(deps): Vanta 2026-11-12 — raise undici to 8.12.4 / 7.30.2 (#30205) | ||
|
|
3dbe6f4314 |
fix(agent-controller): restore stored tool suspensions (#30132)
## Problem
When the server process that parked a run on a tool question (for
example `submit_plan`) goes away, the run stays suspended in storage.
Approving the plan later was rejected with `{ok:false,
reason:"no_pending_suspension"}` because claiming only looked in memory.
The Factory UI treated that 200 as success, so "Approve & build" did
nothing and the card kept offering buttons. Seen in prod on thread
`f82402a7` (plan waiting about 14h).
## Changes
- **core:** `Session.restoreStoredToolSuspension(toolCallId, runId?)`
registers a suspension that exists only in storage. It only does this
when exactly one stored suspended run on the active thread matches the
tool call id, and it skips approval prompts.
- **server:** the tool-suspension route restores the stored suspension
before claiming it. The claim stays synchronous.
- **factory-ui:** reply mutations now reject `ok:false` acks and show an
error toast. The respond mutation refetches the session. The transcript
only resolves a prompt once the reply was actually delivered.
## Tests
- `session-stored-suspension-after-restart.test.ts`: park on one
controller, then approve from a second controller that shares storage.
Fails before the fix. A negative case covers unknown calls and
mismatched runs.
- `useRespondSuspensionRejected.msw.test.tsx`: an `ok:false` ack fails
the mutation. Fails before the fix.
- core agent-controller 1021/1021, server agent-controller 104/104,
factory-ui chat/hooks 616/616, typecheck clean.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
**ELI5:** When an AI agent asks a question and waits for an answer, the
server can restart before the user replies. The reply used to fail
because the server only checked memory. Now the server loads the waiting
question from storage, so the reply works. The user interface also shows
an error when a reply is rejected.
## Overview
This change fixes replies to tool prompts after the process that parked
the run has stopped. Before this change, the claim step checked only
in-memory suspensions. A reply could return `{ ok: false, reason:
"no_pending_suspension" }`. Factory UI treated that response as success,
so the prompt buttons stayed visible.
The change also keeps prompt cards in sync across windows. When a tool
call completes, the matching approval or suspension card clears in every
window.
## Changes
**Core (`packages/core/src/agent-controller/session.ts`)**
- Adds `Session.restoreStoredToolSuspension(toolCallId?: string, runId?:
string): Promise<void>`.
- Returns without a storage lookup when the tool-call ID is missing, the
suspension is already resolvable, or no thread is active.
- Searches suspended runs in storage for the active thread and resource.
It checks each configured agent, reads 100 runs per page, and reads at
most 10 pages per agent.
- Optionally filters by `runId`. Matches only non-approval tool calls
that have the requested ID and a tool name.
- Stops scanning an agent on the no-storage error. Propagates other
lookup errors.
- Registers the suspension and caches its owning agent only when exactly
one match exists and no concurrent restore occurred.
**Server (`packages/server/src/server/handlers/agent-controller.ts`)**
- If `session.restoreStoredToolSuspension` is available, the
tool-suspension route awaits it with `toolCallId` and `runId`. It then
claims the suspension. If the method is not available, the route claims
directly.
- Rejected claims return `{ ok: false, reason }`. Accepted claims are
acknowledged, and the suspension response runs in the background.
**Factory UI**
- `useAgentControllerRunMutations.ts`:
- Validates tool approval and suspension acknowledgments with
`requireAccepted`. A rejected acknowledgment throws the new
`RejectedReplyError`.
- Adds `isEndedPrompt(error: unknown): boolean`. It returns true for
rejections with reason `no_pending_suspension`.
- Both mutations report errors in a toast.
- Suspension-reply errors invalidate the session query. Successful
mutations also invalidate it.
- `Transcript.tsx`: Resolves a prompt after a successful mutation. On
rejection, resolves the prompt only when `isEndedPrompt` returns true.
Otherwise, leaves it unresolved.
- `services/transcript.ts`:
- On a `tool_end` event, updates the tool result. Removes only the
approval or suspension prompt with the matching `toolCallId`.
- Omits persisted prompts for tool calls in terminal states (`result`,
`output-error`, or `output-denied`).
- During server-window reconciliation, removes prompts for terminal tool
calls. Updates matching assistant tool invocations from persisted
terminal parts.
**Changeset (`.changeset/stale-plan-approval.md`)**
- Declares patch releases for `@mastra/core` and `@mastra/server`.
**Channels test
(`packages/core/src/channels/__tests__/agent-controller-channels.test.ts`)**
- The allow/deny policy test sets `deployTool` permission in
`onSessionStart`. It no longer sets the permission on a manually created
session. It reads the session after inbound processing.
**Tests**
-
`packages/core/src/agent-controller/__tests__/session-stored-suspension-after-restart.test.ts`
(new, +169): Covers approval from a second controller that shares
storage. Covers an unknown tool call, a call tied to a different run,
and the 10-page limit.
-
`mastracode/factory-ui/src/hooks/__tests__/useRespondSuspensionRejected.msw.test.tsx`
(new, +45): Mocks a `no_pending_suspension` rejection. Asserts an error
whose message indicates the prompt is no longer waiting. Asserts that
`isEndedPrompt` classifies only that rejection reason as an ended
prompt.
-
`mastracode/factory-ui/src/ui/domains/chat/services/__tests__/transcript.test.ts`
(+57): Covers persisted prompt visibility. A prompt stays visible while
its tool call has no result. It is hidden when a later message or
refetched window includes the result. A `tool_end` event clears only the
prompt with the matching `toolCallId`.
- `mastracode/web/e2e/web/approval-other-window.scenario.test.ts` (new,
+130): End-to-end scenarios for prompts in two windows. After a response
settles, approval, plan-suspension, and `ask_user` cards clear from the
non-answering window. Approval cards clear from the answering window.
Unanswered cards stay in both windows.
- `mastracode/web/e2e/web/fixtures/approval-other-window.json` (new,
+104): Fixture for the end-to-end scenarios. Defines six `gpt-5.4-mini`
interactions: write-file approve and decline, plan approve and revise,
and an `ask_user` prompt.
## Scope
- 12 files changed, 663 lines added, 30 lines removed.
- Added declarations:
- `Session.restoreStoredToolSuspension` (method,
`packages/core/src/agent-controller/session.ts`)
- `RejectedReplyError` (class) and `isEndedPrompt` (function) in
`mastracode/factory-ui/src/hooks/useAgentControllerRunMutations.ts`
## Test results
The author reports these results. This review did not run them:
- Core agent-controller: 1021/1021 passed.
- Server agent-controller: 104/104 passed.
- Factory UI chat and hooks: 616/616 passed.
- Typecheck: clean.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
Co-authored-by: mastra-platform[bot] <mastra-platform[bot]@users.noreply.github.com>
|
||
|
|
99e0cea5c8 |
feat(factory): give sessions the Platform project's Mastra Connect tools and a host tools option (#28756)
**─────── TLDR ───────**
> Factory sessions in Slack, web chat and on work items can now use the
Mastra Connect tools of every connection attached to the Factory's
Platform project.
Attach Linear to the project on Platform's Connect page, and a Slack
thread can ask about its issues. The organization's other connections
stay out until someone attaches them, and a new project has none. It
needs Platform credentials and `MASTRA_PROJECT_ID`: Platform deploys
already have both, and local or self-hosted Factories set them in
`.env`. Tools with delete or archive in their name are left out, and so
are GitHub and GitLab tools. Connect caches the list for 30 seconds and
keeps the last one while Platform refreshes fail. A first listing that
fails or takes over 15 seconds leaves the run without Connect tools, and
Factory logs why.
### Behavior changed
a session on a Factory whose project has Linear attached
└─ **new** — it calls Connect's `linear_*` tools, no
approval prompt
Settings → Tools
└─ **new** — the attached connections, read-only, linking to
Mastra Platform
a configured tool named like one Factory already gives the session
└─ **new** — Factory's tool stays, the server warns once per
name
the host's `~/.mastracode/mcp.json`
├─ **was** — its MCP servers reached every hosted session
└─ **now** — ignored, with a warning at startup when the
file exists
### Shape changed
options and routes the reviewer now lives with
`MastraFactory({ tools })` · `GET
/web/integrations/platform/connect-tools`
`tools` takes a tool map or a per-run function and replaces the default;
`tools: {}` turns it off. The route reads the same unscoped
`/v2/projects/:id/connections` list as the resolver, so the page can't
show a list sessions don't use. Factory always registers it, like the
integration status routes, and it answers `404 connect_tools_off` when
sessions get no Connect tools: an unregistered `/web` route would fall
through to the SPA's HTML. The README and changeset carry the `mcp.json`
migration, `tools: await mcpClient.listTools()`.
`stored-board-runtime.test.ts` also picks up the
`factoryProjectSettingsUserId` rename it was missing.
### Decisions
- **Platform's attached connections are the opt-in, Factory stores
nothing** — attaching is already explicit, 2 of the org's 58 here; a
per-org table if orgs must differ.
- **no connecting from Factory** — a Factory admin isn't always a
Platform project member, so Platform's membership check decides.
- **host `tools` replaces the default instead of merging** — nothing
registers twice; spread Connect's `tools()` in yourself to keep both.
- **GitHub and GitLab Connect tools stay out of sessions** — Factory's
own source-control tools enforce repository scope and self-review, and
Connect's `github_create_pull_request` would skip both.
- **the destructive filter goes by name**, `delete` or `archive`
anywhere, any case — Connect has no MCP destructive hints to read, so
this is the check available.
- **the 15 second limit sits on the run, not on Connect's fetch** — that
fetch also carries tool calls and MCP streams, which can run longer.
- **sessions run Connect tools without approval** — attaching a
connection is the opt-in; a per-connection mode (read only, read and
write, ask before writes) is a follow-up.
### Watch
> [!WARNING]
> <mark>Every org on a Factory uses the accounts attached to its
project</mark>, and a connection attached for another app on the same
project reaches Factory sessions too. Per-org accounts through Connect's
`resourceId` are a follow-up.
> [!WARNING]
> <mark>Sessions run these tools without approval, and a name filter
can't catch everything</mark>: a SQL tool running a `DROP`, an email
send, a refund. `linear_remove_issue_label` and
`incident_io_remove_alert_tags` still get through here.
a Platform that stalls instead of failing keeps later runs without
Connect tools until that listing answers or fails. Node's `fetch` gave
up after 301 seconds when the Platform sent nothing at all, but a
response that trickles data can hold it longer: Connect's shared refresh
can't be cancelled, so a real fix belongs in `@mastra/connect`.
on deploy: a project that already has connections attached gives
sessions their tools right away. `@mastra/factory` now depends on
`@mastra/connect`.
Against the real Platform with my sign-in, the route returned linear and
incident.io, the project's 2 attached connections rather than the org's
58, and the resolver returned 101 tools from those same two providers,
none with delete or archive in their name. Without `MASTRA_PROJECT_ID`,
the route answered `404 application/json` with `connect_tools_off`,
where an unregistered path next to it served the SPA's HTML. Against a
Platform stand-in that never answers, two concurrent runs both went on
without Connect tools after 15.0 seconds. Factory's own Jira, GitLab and
incident.io connect flows mint sessions on Platform's org-level
endpoint, so what they connect reaches sessions only once someone
attaches it; the org's Jira connection is in neither project list I
checked.
### Not verified
- [ ] a signed-in session calling the tools: my machine has no personal
model key for a signed-in account
- [ ] Settings → Tools in a browser: only the MSW tests render it
- [ ] Slack end to end in a real workspace
---
> ████████████████████ **tests** `+391 −17` — 48% of the additions
> ██████████████████ **source** `+350 −3` — 157 of the additions are the
Settings UI
> ██ **docs** `+39`
> █ **changeset** `+23`
> █ **generated** `+4 −1` — lockfile
---------
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
Co-authored-by: Damien Schneider <damien.schneider01@gmail.com>
|
||
|
|
9ce7e350ea |
chore(deps): lock file maintenance (#29341)
Co-authored-by: wardpeet <ward@coding-tech.com> Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
3bdb4ec5f4 |
chore(deps): update build tools (major) (#29026)
> [!NOTE] > This PR body was truncated due to platform limits. This PR contains the following updates: | Package | Type | Update | Change | Pending | |---|---|---|---|---| | [@vitest/coverage-v8](https://vitest.dev/guide/coverage) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8)) | pnpm.catalog.default | major | [`4.1.12` → `5.0.5`](https://renovatebot.com/diffs/npm/@vitest%2fcoverage-v8/4.1.12/5.0.5) | `5.1.0` | | [@vitest/mocker@>=2.1.0 <4.1.12](https://redirect.github.com/vitest-dev/vitest/tree/main/packages/mocker) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/mocker)) | pnpm-workspace.overrides | major | [`4.1.12` → `5.0.5`](https://renovatebot.com/diffs/npm/@vitest%2fmocker@>=2.1.0 <4.1.12/4.1.12/5.0.5) | `5.1.0` | | [@vitest/ui](https://vitest.dev/guide/ui) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/ui)) | pnpm.catalog.default | major | [`4.1.12` → `5.0.5`](https://renovatebot.com/diffs/npm/@vitest%2fui/4.1.12/5.0.5) | `5.1.0` | | [dotenv](https://redirect.github.com/motdotla/dotenv) | devDependencies | major | [`^17.4.2` → `^18.0.9`](https://renovatebot.com/diffs/npm/dotenv/17.4.2/18.0.9) | | | [dotenv](https://redirect.github.com/motdotla/dotenv) | devDependencies | major | [`17.4.2` → `18.0.9`](https://renovatebot.com/diffs/npm/dotenv/17.4.2/18.0.9) | | | [vitest](https://vitest.dev) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/vitest)) | devDependencies | major | [`^4.1.12` → `^5.0.5`](https://renovatebot.com/diffs/npm/vitest/4.1.12/5.0.5) | `5.1.0` | | [vitest](https://vitest.dev) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/vitest)) | pnpm.catalog.default | major | [`4.1.12` → `5.0.5`](https://renovatebot.com/diffs/npm/vitest/4.1.12/5.0.5) | `5.1.0` | | [vitest](https://vitest.dev) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/vitest)) | devDependencies | major | [`4.1.12` → `5.0.5`](https://renovatebot.com/diffs/npm/vitest/4.1.12/5.0.5) | `5.1.0` | | [vitest@>=2.1.0 <4.1.12](https://vitest.dev) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/vitest)) | pnpm-workspace.overrides | major | [`4.1.12` → `5.0.5`](https://renovatebot.com/diffs/npm/vitest@>=2.1.0 <4.1.12/4.1.12/5.0.5) | `5.1.0` | --- > [!WARNING] > Some dependencies could not be looked up. Check the [Dependency Dashboard](../issues/9505) for more information. --- ### Release Notes <details> <summary>vitest-dev/vitest (@​vitest/coverage-v8)</summary> ### [`v5.0.5`](https://redirect.github.com/vitest-dev/vitest/releases/tag/v5.0.5) [Compare Source](https://redirect.github.com/vitest-dev/vitest/compare/v5.0.4...v5.0.5) ##### 🐞 Bug Fixes - Keep vite default `fs.deny` with api token file - by [@​hi-ogawa](https://redirect.github.com/hi-ogawa), **Hiroshi Ogawa** and **Claude Opus 5.5** in [#​11578](https://redirect.github.com/vitest-dev/vitest/issues/11578) [<samp>(28dc1)</samp>]( |
||
|
|
47a6cd82e5 |
chore(deps): update ai sdk (#29242)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> |
||
|
|
fe6eae5aef |
feat(factory): support Vertex AI with ADC (#28850)
Adds native Google Vertex AI support to Code SDK and allows Factory operators to expose it as a deployment model provider using Application Default Credentials. Configure `GOOGLE_VERTEX_PROJECT`, `GOOGLE_VERTEX_LOCATION`, and `FACTORY_DEPLOYMENT_MODEL_PROVIDERS=google-vertex`. Vertex models are resolved through `@ai-sdk/google-vertex` rather than the OpenAI-compatible gateway, preserving native Gemini provider metadata across tool calls. Signed-in tenants can only use the deployment identity when the operator explicitly enables the provider. Test plan: Code SDK model-resolution and catalog suites pass 85 tests, Factory deployment-provider coverage passes 9 tests, Code SDK type-aware lint passes, standalone web typecheck passes, and `git diff --check` passes. Linear: https://linear.app/kepler-crm/issue/FACT-443/support-vertex-ai-with-adc-as-a-model-provider <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 This PR lets the Code SDK use Google Vertex AI with Google Cloud credentials already available to the deployment. Factory operators can choose whether deployments may use Vertex AI. ## Summary - Adds a Google Vertex gateway that uses `GOOGLE_VERTEX_PROJECT` and `GOOGLE_VERTEX_LOCATION` with Application Default Credentials (ADC). - Resolves Vertex models through `@ai-sdk/google-vertex`. Adds a cached model catalog that falls back to `gemini-3.8-flash` when it cannot retrieve the catalog. - Adds `google-vertex` to Factory’s deployment-provider allowlist. Operators can enable it with `FACTORY_DEPLOYMENT_MODEL_PROVIDERS=google-vertex`. - Adds tests for Vertex model resolution, Factory provider access, and catalog behavior. The PR description reports that 85 Code SDK model-resolution and catalog tests and 9 Factory provider tests passed. It also reports passing lint, web typecheck, and `git diff --check`. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
d258f15eb1 |
chore(deps): update dependency varlock to ^1.24.0 (#29024) | ||
|
|
278ecceb2d |
chore(deps): update ai sdk (#28928)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> |
||
|
|
ba8b955b1a |
fix(redis-streams,valkey-streams): expire idle streams by default and clear them on thread delete (#28968)
A production Factory deployment ran out of Redis memory. Every key was a
`mastra:topic:*` stream, and almost all of them (3,673 thread streams)
had no expiry. The deployment built `new RedisStreamsPubSub({ url })`
with defaults, and the default `streamIdleTtlMs` was `0`, meaning
streams never expire. Thread streams are open-ended and never get
`clearTopic()`, so they piled up forever. The Redis instance used
`volatile-lru`, which can't evict keys without a TTL, so writes just
started failing.
This PR makes `@mastra/redis-streams` and `@mastra/valkey-streams` give
every stream a sliding 7-day idle TTL by default. Writes refresh it, and
live subscribers keep receiving events after a stream expires because
the read loop recreates it. Streams are an event bus, not storage:
replay history lives in the caching layer and storage, so the backlog
only matters for grouped workers that are offline longer than the TTL.
```ts
// Before: streams never expire unless you opt in
new RedisStreamsPubSub({ url });
// After: 7-day idle TTL by default; opt out explicitly
new RedisStreamsPubSub({ url });
new RedisStreamsPubSub({ url, streamIdleTtlMs: 0 });
```
Both pubsubs now log one warning after they first connect if Redis has
`maxmemory` set with any policy other than `noeviction`. A TTL makes
streams, consumer groups and lease keys evictable under `volatile-*`,
which would silently drop events and leases (ElastiCache defaults to
`volatile-lru`). The check uses `INFO memory` because managed Redis
often blocks `CONFIG GET`.
`memory.deleteThread()` now also deletes the thread's event stream
through the registered Mastra pubsub. This runs fire-and-forget, so
neither deleting a thread nor `memory.settled()` waits on Redis during
an outage. It's skipped on older core versions. Agents configured with
their own pubsub still rely on the TTL.
The docs now require `noeviction`; the Helm guide used to say a
`volatile-*` policy was fine. They also add a runbook for reclaiming
streams created before the TTL: switch to `noeviction`, upgrade the
writers, then expire each stream relative to its last write. Tested
against real Redis/Valkey containers, including a real TTL expiry while
a subscriber is listening and a thread delete with Redis unreachable.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
Redis and Valkey can keep old event streams forever, which uses storage.
This change removes streams after seven days without writes by default
and cleans up a thread’s stream when the thread is deleted.
## What changed
- Redis and Valkey streams now use a sliding seven-day idle TTL by
default. Writes refresh the TTL; reads do not. Set `streamIdleTtlMs: 0`
to disable expiry.
- The read loop recreates an expired stream so a live subscriber can
continue receiving events.
- After connecting, each pubsub warns once when `maxmemory` is enabled
with a policy other than `noeviction`. The check uses `INFO memory`.
- Thread deletion starts best-effort stream cleanup through the
registered Mastra pubsub without waiting for Redis. Older core versions
skip this cleanup.
- Documentation and the local Docker configuration now recommend
`noeviction`. The documentation also explains how to expire existing
streams that lack a TTL.
## Tests
Tests cover TTL behavior, delivery after expiry for live subscribers,
eviction-policy warnings, and thread-stream cleanup. Test execution
results were not provided.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
|
||
|
|
f6cd11f348 |
chore(deps): lock file maintenance (#28672)
This PR contains the following updates: | Update | Change | |---|---| | lockFileMaintenance | All locks refreshed | --- > [!WARNING] > Some dependencies could not be looked up. Check the [Dependency Dashboard](../issues/9505) for more information. 🔧 This Pull Request updates lock files to use the latest dependency versions. --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - "before 6am on wednesday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://redirect.github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xOTAuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjE5MC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhdXRvbWF0aW9uIl19--> --------- Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
4cd2abcbd9 |
feat(factory): browser tools in the local dev Factory (#28502)
`mastracode/web` is the Factory app we run locally for development. This lets its sessions use browser tools, so agents can open pages, click around, and take screenshots while we work on Factory. ## What - `FACTORY_BROWSER=local` makes `mastracode/web` pass an `AgentBrowser` to `MastraFactory`: a headless Chromium on the machine running Factory, one per session thread so sessions don't share tabs. Unset, sessions have no browser. - Chromium only launches on a session's first browser tool call. Install it once with `npx playwright install chromium`. - `prebuild` now lists `@mastra/agent-browser` explicitly. This doesn't change `@mastra/factory` (which already accepts `browser`), the Factory templates, or Shipyard. A session's browser stays open until the agent closes it or the server restarts. ## Local development only This browser runs on the host, outside the sandbox, so the agent can open host files (`file://`) and services on `localhost`. That's acceptable on your own machine and is why it's opt-in, with a warning in `.env.schema`. A shared or hosted Factory should run the browser inside the sandbox or use a hosted browser instead; that's tracked separately. ## Test plan - [x] `mastracode/web` typechecks - [x] `turbo build --dry` for the `prebuild` filters includes `@mastra/agent-browser#build` - [ ] Start the local Factory with `FACTORY_BROWSER=local`, ask a session to open a page and take a screenshot <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 This change lets a local Factory session use its own browser to open pages and take screenshots. It is off by default because the browser runs on the host, outside the sandbox. ## Changes - Added `@mastra/agent-browser` to `mastracode/web` and included it in the `prebuild` Turbo filters. - When `FACTORY_BROWSER=local`, Factory creates a headless, thread-scoped `AgentBrowser`. Otherwise, sessions do not receive browser tools. - Added a schema warning that browser access is for local development only. Install Chromium on the host with `npx playwright install chromium`. ## Testing The author reports that `mastracode/web` typechecks. The planned manual browser check was not reported as completed. <!-- 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> |
||
|
|
9f73a243dd |
feat(factory): support Slack Socket Mode (#28449)
## Summary Adds first-class Slack Socket Mode support to Factory while keeping webhook mode as the default and preserving its existing behavior. Slack integrations now validate credentials for the selected transport, forwarding `appToken` only for Socket Mode and `signingSecret` for webhook mode. Factory account-linking credentials remain separate from Socket Mode transport configuration, avoiding the Slack adapter's unsupported multi-workspace path. Factory now owns cleanup for channel adapters that expose `disconnect()`, so persistent Socket Mode connections close exactly once during shutdown. The standalone Factory web template also supports Socket Mode through `SLACK_APP_TOKEN` while retaining the existing webhook configuration. ## Test plan - Focused Slack integration tests: 17 passed - Factory channel-adapter shutdown test: passed - `@mastra/factory` lint: passed with no warnings or errors - `mastracode/web` TypeScript check: passed - Repository formatting check for the changed template: passed - Live Slack validation: connected over Socket Mode, completed account linking, received an `app_mention`, and posted a response <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 Factory can now talk to Slack through Socket Mode or HTTP webhooks. Webhooks remain the default, and Factory disconnects channel adapters when it shuts down. ## Summary - Added Slack Socket Mode configuration with `mode: 'socket'` and `appToken`. Slack validates the credentials required for the selected transport. - Kept OAuth client credentials for account linking separate from transport credentials. - Updated the web template to select Socket Mode when `SLACK_APP_TOKEN` is set and webhook mode otherwise. - Added shutdown handling for channel adapters that expose `disconnect()`. Concurrent shutdown calls share the in-progress shutdown, and failed disconnects can be retried. ## Validation The PR objectives report that 17 focused Slack integration tests, the Factory adapter-shutdown test, lint, the web TypeScript check, and the changed-template formatting check passed. They also report live Slack validation for Socket Mode, account linking, receiving an `app_mention`, and posting a response. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
84fa97871a |
Validate the checked-in factory templates and retire the generated softwarefactory-template (#28436)
## Summary `create-factory` now scaffolds the checked-in `templates/template-factory` (platform) and `templates/template-factory-self-hosted` (`--no-platform`) starters (#28430). The old path — generating `mastra-ai/softwarefactory-template` from `mastracode/web` with `sync-template.mjs` and pushing it from a dedicated workflow — no longer feeds anything users receive, so this PR removes it. The new templates sync through the same `sync-templates.yml` as every other template. | Before | After | | --- | --- | | `sync-softwarefactory-template.yml` generated a template from `mastracode/web` and pushed it after an install/typecheck/build check against published npm | Removed. Both factory templates sync through the shared `sync-templates.yml`, unchanged | | `e2e-softwarefactory` generated the template, scaffolded it, and booted it with auth disabled | Scaffolds both checked-in templates through the built CLI, typechecks and builds them against the local package set, and boots the self-hosted template against its own Postgres (`npm run db:up`) behind WorkOS auth | | Template edits did not trigger the E2E suite | Changes under `templates/template-factory*` run it | Also removes `mastracode/mastra-factory/scripts/sync-template.mjs`, its test, `template/README.md`, and the `template-out` ignores. The suite's local registry setup is fixed: it could not resolve the verdaccio bin (verdaccio 6 only exports `.` and `./package.json`) and, because that failure happened after the repo was snapshot-versioned, left the working tree mutated. Stacked on #28430 → #28255. ## Follow-up after release Once a `create-factory` release that uses the new templates is on `latest`, archive `mastra-ai/softwarefactory-template` (don't delete it — older CLI versions still clone it). ## Test plan - [x] `create-factory`: tests (55), `tsc --noEmit`, lint - [x] Both templates typecheck and bundle with `mastra build` against workspace packages - [x] Self-hosted template boots under `mastra factory dev` against Postgres: `/signin` serves the Factory UI, `/auth/me` reports `workos`, `/api/tools` returns 401 - [x] `e2e-softwarefactory` passes locally (7 tests, ~7 min): both templates scaffold via the built CLI, typecheck, and build against the local registry; the self-hosted template boots against `npm run db:up` Postgres - [ ] `e2e-softwarefactory` passes in CI --------- Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
e638d5893b |
fix(factory): support separate Jira API base URLs (#28569)
## Summary Adds a separate Jira API base URL for direct Factory integrations so scoped Atlassian API tokens can use the required gateway without breaking browser-facing issue links. - keeps `baseUrl` as the Jira site URL used for links such as `https://acme.atlassian.net/browse/ENG-42` - adds optional `apiBaseUrl`, defaulting to `baseUrl` for existing Jira token configurations - routes REST requests through `apiBaseUrl`, including scoped-token URLs such as `https://api.atlassian.com/ex/jira/{cloudId}` - adds optional `JIRA_API_BASE_URL` wiring to the standalone Factory web host - normalizes trailing slashes independently for site and API URLs ## Why Factory previously used one URL for two different purposes: Jira REST requests and human-facing issue links. Scoped Atlassian API tokens require REST requests to use `api.atlassian.com/ex/jira/{cloudId}`, but that gateway cannot be used to construct `/browse/{issueKey}` links. This made scoped tokens impossible to configure correctly. The new setting separates those roles while preserving the existing behavior when `apiBaseUrl` is omitted. ## Test plan - `pnpm --filter ./mastracode/factory exec vitest run src/integrations/jira/api.test.ts src/integrations/jira/integration.test.ts --reporter=dot --bail 1` — 41 tests passed - `pnpm --filter ./mastracode/factory check` - `pnpm --filter ./mastracode/factory lint` — 0 warnings, 0 errors - `pnpm --filter ./mastracode/factory build:lib` - `cd mastracode/web && pnpm check` - `pnpm exec oxfmt --check $(git diff origin/main --name-only -- '*.ts')` - `git diff --check origin/main` Linear: FACT-445 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 This change lets Jira send API requests to a separate service while keeping issue links pointed at the Jira website. If no separate API URL is configured, requests use the existing Jira URL. ## Changes - Added optional `apiBaseUrl` to `JiraIntegrationConfig`. Jira API requests use this URL, while `baseUrl` remains the site URL for issue links. - Defaulted `apiBaseUrl` to `baseUrl` for existing configurations. - Added optional `JIRA_API_BASE_URL` configuration for the standalone Factory web host. - Added tests for separate API and site URLs, URL forwarding, and the default URL behavior. - Added a changeset for `@mastra/factory`. ## Tests The PR description reports 41 passing Jira tests and lists additional Factory and web checks, lint, build, formatting, and diff-check commands. Results for those additional checks are not provided. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
40a522c142 |
chore(deps): update build tools (#27997) | ||
|
|
a1e248bfe0 |
feat(factory): let Slack runs attach workspace files to the thread (#27351)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
9f84a1d6b4 |
chore(deps): update dependency varlock to ^1.23.0 (#27992)
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [varlock](https://varlock.dev) ([source](https://redirect.github.com/dmno-dev/varlock/tree/HEAD/packages/varlock)) | devDependencies | patch | [`^1.9.0` → `^1.23.0`](https://renovatebot.com/diffs/npm/varlock/1.23.0/1.23.0) | --- > [!WARNING] > Some dependencies could not be looked up. Check the [Dependency Dashboard](../issues/9505) for more information. --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - "before 6am every weekday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://redirect.github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNzUuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjE3NS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhdXRvbWF0aW9uIl19--> |
||
|
|
4f60903242 |
chore(deps): lock file maintenance (#27013) | ||
|
|
f3cf77305f |
security: Vanta remediation (2026-10-20) (#27828) | ||
|
|
dda0406d8d |
fix(factory): watch shared React components during development (#27657)
Factory's `dev:ui` and `factory:dev` commands build `@mastra/react` initially but omit its watcher. Add `client-sdks/react` to the existing Turbo filters and use the same build-before-watch ordering already configured for Playground UI. Validated both entrypoints with Turbo's dry run, including initial-build ordering. Ran the actual React SDK watch command through Studio and Factory's Vite configurations in Chromium: three consecutive component edits per app rendered with the counter retained at 2 and no edit-triggered page reloads. Targeted type-aware lint, types, formatting and diff checks passed. API/Docker services were not started. The redundant script-selection test is removed. Shared UI chunk identities and Factory's Vite alignment are handled separately in draft PR #27654; this change can be reviewed and merged independently. Fixes #27656. |
||
|
|
dbde4bf36a |
chore(deps): update ai sdk (#27728)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> |
||
|
|
fa409d430b |
security: Vanta remediation pass 2026-10-14/15/19 (zod 4.6.7, @ai-sdk/provider-utils, @copilotkit template) (#27023) | ||
|
|
96206136bc |
fix: only an explicit start creates an agent controller session, so the first prompt can't land on a stray thread (#27474) | ||
|
|
891f9dbd7a |
test(mastracode-web): fix 14 stale create-factory web entry tests (#27518) | ||
|
|
870622d506 |
fix(create-factory): refuse to boot in production without credential encryption or an isolated sandbox (#27499) | ||
|
|
cc42d1431a |
feat(factory, workspaces, factory-ui): environment builds on the FactorySandbox builds capability (#26479)
## What A factory project's environment template can be built ahead of sessions, so the next session finds the image warm instead of building it on first boot. The `FactorySandbox` `builds` capability is what makes this possible. `DockerFactorySandbox` gains `start` and `get` here (platform and E2B already have theirs), reporting the local image build as `building`, `ready` or `failed` while the daemon runs it. A sandbox without `builds` gets none of what follows: no routes, no triggers, no UI. Factory runs a build: - on **Build now** (`POST /web/factory/projects/:id/environment/build`, the Environment page button, or `mastra api factory project environment build <id>`) - on a **cron schedule**, kept in core `Schedules` as one row per project - after a **push** to a linked repository's default branch, at most once per debounce window (a single conditional update on the project row decides the winner) Saving settings never builds; the next trigger picks the changed template up. No trigger starts a build while the last one is still running. Scheduled and push builds also skip when the last build is ready and no repository head moved. The build runs as a `factory-environment-build` workflow registered through `MastraFactory.prepare()`; its poll step pins the active template id and heads on the project once the provider reports ready. Factory stores four new columns on the project (`last_build_id`, `last_build_attempted_at`, `build_on_push_enabled`, `build_push_debounce_minutes`). Status and history come from the provider through `GET …/environment/builds/:buildId` and `GET …/environment/builds` (404 `no_history` when the provider keeps none), with clone credentials redacted. The environment payload carries `buildTriggers` and the last build. After a session's own setup, each repository link records `configured` or `failed` with the redacted error. The Environment page gains a **Builds** section when the provider can build: the last build's status and Build now in its header, a Build schedule row (Off, Daily, Weekly or Custom, with the day and time or a cron expression underneath), a Rebuild on push switch with its push debounce in minutes, and the build history with logs when the provider lists builds. The CLI gains `environment build`, `environment builds` and `environment builds <buildId>`. ## How it works - `environment/build.ts`: one build attempt. Resolves the environment, claims the push debounce, reads the last build for schedule and push, starts the provider build and records the id. A provider failure clears the last build id so a later schedule cannot mistake the previous ready build for the current template. - `environment/build-workflow.ts`: the two-step workflow (start, await build) and its schemas. - `environment/build-runner.ts`: starts runs through the booted `Mastra`, answers the start step's outcome to the caller while the poll continues, handles the push hand-off from the GitHub webhook, and builds the status-read context from the stored heads so a status read never calls GitHub once a build is pinned. - `environment/build-schedule.ts`: the per-project schedule in core `Schedules`, cron validation with the validator `Schedules` uses, and the availability probe. - `environment/heads.ts`: head resolution and comparison, keyed by repository slug. ## Test plan - `mastracode/factory`: `pnpm exec vitest run` 3589 passed, `tsc --noEmit` 0, `pnpm lint` 0 - `workspaces/docker`: `pnpm exec vitest run` green, including `factory-sandbox.test.ts` - `packages/cli`: `pnpm exec vitest run src/commands/api` 136 passed - `mastracode/factory-ui`: `pnpm typecheck` 0, settings and workspaces MSW suites 292 passed, `pnpm test:unit` 530 passed - Live on the web host with a platform sandbox: Build now reached `ready`, `GET …/builds` answered `no_history`, a schedule-triggered run skipped as `unchanged` with a ready build and unmoved heads Closes FACT-343 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 Factory can build a reusable environment for a project when the project’s sandbox supports builds. Teams can start a build, set a schedule, or rebuild after changes to a linked repository’s default branch. ## What changed - Added a build workflow that starts builds, checks their status, and pins ready templates. - Added build-start leases to prevent overlapping builds. Scheduled and push builds skip when another build is running or when a ready build still matches repository heads and template inputs. - Added build status and history routes, project build settings, and CLI commands. - Added schedule and push-trigger controls, build status, and build history to the Factory Environment settings page. - Recorded per-repository setup outcomes after session setup. Setup errors are recorded with credentials redacted. - Saving environment settings does not start a build. Providers without build history can return `no_history`. ## Validation The PR description reports passing tests and type checks for Factory, Docker workspaces, the CLI, and Factory UI. It also reports live testing that reached `ready`, returned `no_history` from the builds endpoint, and skipped a scheduled build as `unchanged`. The PR has a failing-tests label, but the description does not identify a failing test. <!-- 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> |
||
|
|
001795671c |
feat(factory): FactorySandbox, one host object for session sandbox, template and settings (#26467)
## Why
Factory keeps growing features that need something from the sandbox
provider: per-project settings (CPU, memory, idle timeout), a template
built ahead of a session, build history, and later builds on a schedule
or on push. Until now the only hook a host had was a bare callback that
returned a sandbox, so every new feature meant another callback on
`MastraFactory` and provider-specific knowledge leaking into factory.
`FactorySandbox` adds one object per provider with a stable contract
between factory and the provider. Factory asks the object what it can do
and renders accordingly; providers add features by implementing an
optional method, not by changing factory. The change is backwards
compatible: a host that passes the `sandbox` callback today keeps
working unchanged. Factory wraps it as a `custom` provider, so sessions
boot exactly as before; the host just does not get the new features
(per-project settings, template builds, or any later capability) until
it moves to a `FactorySandbox`.
## What
A host configures where Factory sessions run with one object:
```ts
new MastraFactory({
sandbox: new PlatformFactorySandbox({ defaults: { cpuCount: 4, memoryMb: 8192 } }),
})
```
`FactorySandbox` (in `@mastra/core/workspace`) owns:
- **The session sandbox.** `create(ctx, settings)` constructs the
sandbox for a session, with the environment's working directory handed
through so the session finds the template's checkouts where the template
cloned them.
- **The template.** `template(ctx, settings)` describes the repository
template a session boots from, so the same definition drives a session
and an ahead-of-time build.
- **Settings.** Each provider declares the settings a user can tune per
project as a schema (`PublicSchema`, any flavor). Factory validates
against it on write and exposes the input-side JSON Schema on the wire,
which is what the Environment settings page renders: one row per
property, typed by the schema (integer, enum, boolean), with provider
defaults as placeholders. A provider with no settings renders nothing.
Adding a setting is a one-line change in the provider.
- **Optional capabilities.** `builds` (start, get, list) is the first
one. Factory describes what is present through
`MastraFactory.sandboxDescription` (`provider`, `settingsSchema`,
`capabilities`) and the UI shows a Builds section only when the provider
has it. A provider that does not build simply omits the method.
Factory detects the object by a `Symbol.for('mastra.factory.sandbox')`
brand, so no instanceof across package boundaries.
Providers:
- `@mastra/platform-workspace`: `PlatformFactorySandbox` (`cpuCount`,
`memoryMb`, `idleTimeoutMinutes`, provider-side `defaults`). The `start
complete` log line gains a `templateHash` of the serialized template.
- `@mastra/e2b`: `E2BFactorySandbox` (`cpuCount`, `memoryMb`,
`idleTimeoutMinutes`) with `builds` (`start` via
`Template.buildInBackground`, `get` with logs, `list` from the
template's build history).
- `@mastra/docker`: `DockerFactorySandbox` (`baseImage`, `owner`).
- `@mastra/factory`: `sandbox` accepts a `FactorySandbox` or the
existing callback. The callback keeps working, wrapped as `provider:
'custom'` with no settings and no capabilities; `LocalFactorySandbox({
root, env })` replaces hand-rolled local fallbacks.
- The web host constructs the class with the same
local/platform/E2B/local precedence it had.
- Docs: `reference/workspace/factory-sandbox` plus the E2B per-session
example.
The single-repo `createRepoTemplate` functions are unchanged; a unit
test pins that the class produces the same template definition and build
envs as the callback form for the web and shipyard hosts.
## Test plan
- `packages/core`: `vitest run src/workspace/factory-sandbox.test.ts`
(9), `src/workspace/factory-sandbox.test-d.ts` (2), `pnpm check`
- `workspaces/platform-workspace`: `vitest run` 268 passed, `tsc
--noEmit`
- `workspaces/e2b`: `vitest run` 265 passed (mocked SDK covers
`start`/`get`/`list`), `tsc --noEmit`
- `workspaces/docker`: `vitest run` 336 passed, `tsc --noEmit`
- `mastracode/factory`: `vitest run` 3589 passed, `tsc --noEmit`, `pnpm
lint`
- `mastracode/web`: `pnpm check`
- `docs`: `pnpm format:check`
Closes FACT-384
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5
This PR gives Factory one consistent way to create a sandbox for each
session. It also lets sandbox providers describe their settings and
whether they can prepare repository templates or report build status.
## Changes
- Added the branded `FactorySandbox` contract to
`@mastra/core/workspace`. `MastraFactory` exposes the provider, settings
schema, and available capabilities through `sandboxDescription`.
- Updated `MastraFactory` to accept a `FactorySandbox` instance or the
existing callback. Factory wraps callbacks as `custom` providers without
settings or capabilities.
- Added `PlatformFactorySandbox`, `E2BFactorySandbox`,
`DockerFactorySandbox`, and `LocalFactorySandbox`.
- Updated Factory workspace and integration types to use
`FactorySandbox`. Updated the web host to select a provider using its
existing local, platform, and E2B configuration precedence.
- Added tests, exports, changesets, and documentation. Platform sandbox
start logs include a template hash when a template is used.
## Validation and review
The PR objectives report package tests, type checks, lint, and
documentation formatting checks. These results were not independently
verified. The PR objectives report the label `tests: green ✅`. The
supplied comments contain no review findings. Review severity counts are
unavailable.
<!-- 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>
|
||
|
|
7aec8b0d95 |
security: Vanta remediation pass 2026-10-12 (better-auth, MCP SDK) (#26773)
## Summary Vanta remediation for 2026-10-12. Target list is today's live export (77 findings, 44 unique IDs). Platform findings are handled in mastra-ai/platform#3317. ### What changed | Package | From → To | Findings | Where | How | |---|---|---|---|---| | better-auth | 1.7.5 → 1.7.7 | AIKIDO-2026-373183 (Critical) | root + `examples/agent` | raise override `better-auth: ^1.7.7`; direct dep `@mastra/auth-better-auth` ^1.7.7 | | @better-auth/drizzle-adapter | 1.7.5 → 1.7.7 | AIKIDO-2026-261025 (Low) | root + `examples/agent` | floor `'@better-auth/drizzle-adapter@<1.7.7': 1.7.7` (also pulled by better-auth 1.7.7) | | @modelcontextprotocol/sdk | 1.31.0 → 1.32.1 | AIKIDO-2026-365378 (High), -156139, -344432 | root, nested locks, `scripts/gh-issue-triage` | raise floor to `<1.32.0 → 1.32.1`; bump direct pins/ranges | Nested `pnpm-workspace.yaml` floors raised in e2e-tests/*, examples/*, integration-tests, etc., and those lockfiles regenerated. Versions used were published >24h ago (minimumReleaseAge). Patch changeset included for published packages whose dependency ranges changed. Aikido lens on this branch: better-auth and MCP SDK findings are gone. OSV: handlebars already clear on main; remaining high are braces/extract-zip (no patch). ### Left as-is (no patch, or major-only) - extract-zip ≤2.0.1: no fix (overdue; removed by #25855 when that lands). Needs Vanta risk acceptance. - braces 3.0.3, sprintf-js 1.0.3/1.1.3: no patched release - postcss-selector-parser 6.x: @tailwindcss/typography pins 6.0.10 - katex 0.16: mermaid declares ^0.16.47 - @ag-ui/client 0.0.59: fix only in 1.0.0 (major). Parent `@copilotkit/channels-*` 0.11.0 pins 0.0.59 exactly (template-genui-data-explorer) - @hono/node-server 1.19 (fix 2.1.3), undici 6.29 (fix 7.23/8.10), raw-body 3 in templates (fix 4), bundle-name 3 (fix 4.1.1), got 15 (fix 16), zod 3.25 (fix 4.x), @bufbuild/protobuf 1.10 (fix 2.x), openai 6.49 (fix 7.x), jose 5.10 via @segment/analytics-node in template (fix 6.x), @ai-sdk/provider-utils 2.2.8 / 3.0.x Aikido ranges wanting 4.0.18+: major-only or scanner range noise Do not merge unless reviewed. No CI weakened. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 This PR updates shared dependency versions so the project uses newer releases of Better Auth and the MCP SDK. It also updates workspace rules to keep older versions from being selected. ## Changes - Updated Better Auth requirements and workspace overrides to `^1.7.7`. - Updated `@modelcontextprotocol/sdk` requirements and overrides to `1.32.1` across affected packages and workspaces. - Added overrides for older `@better-auth/drizzle-adapter` versions to use `1.7.7`. - Added a patch changeset for `@mastra/auth-better-auth`, `@mastra/mcp-registry-registry`, and `@mastra/playground-ui`. Test results and review findings were not provided. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
84312835a7 |
fix(factory): answer /auth/me with 404 when auth is disabled (#26797)
> Opened by @abhiaiyer91
## Summary
When a Factory runs with authentication disabled (`auth: null`, e.g.
`MASTRACODE_AUTH_DISABLED=1`), the web UI hung on the splash screen
forever.
No `/auth/me` route was registered in that mode, so the request fell
through to the deployer's HTML catch-all and came back as `200
text/html`. The UI only treats a `404` from `/auth/me` as "auth
disabled". It failed to parse the HTML as JSON, treated that as an
error, and retried every 2 seconds indefinitely.
## Changes
- `@mastra/factory`: new `buildAuthDisabledRoutes()` registers an
unauthenticated `GET /auth/me` that returns `404` with `{ authEnabled:
false, authenticated: false }`. `MastraFactory` uses it whenever `auth`
is null. The UI now resolves to its intended "no authentication provider
configured" screen instead of looping.
- `mastracode/web/.env.schema`: documents `MASTRACODE_AUTH_DISABLED` as
an API-only, local smoke-test mode. The web UI still requires a sign-in
provider.
- Patch changeset for `@mastra/factory`.
Out of scope: a supported no-auth UI mode (e.g. a built-in local-dev
provider). That is a separate product/security decision.
## Test plan
- [x] `auth-seam.test.ts`: `buildAuthDisabledRoutes` registers only `GET
/auth/me` (`requiresAuth: false`), and serving it through Hono returns
`404` JSON with the expected body.
- [x] `factory.test.ts`: with `auth: null`, the assembled API routes
contain exactly one `/auth/*` route (`GET /auth/me`), and its handler
responds `404` with `authEnabled: false`. This replaces the old "no auth
routes" assertion.
- [x] `vitest run` for `auth-seam`, `factory`, `auth`, and `spa-static`
tests (197 passing); `tsc --noEmit` clean; oxfmt clean.
- [x] `varlock load` accepts the new schema entry.
Fixes #26792
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5
When authentication is disabled, the server now gives the UI a clear
response instead of sending it a web page by mistake. This lets the UI
detect that no authentication provider is configured.
## Changes
- Add a `GET /auth/me` route for `auth: null`. It returns status `404`
with `{ authEnabled: false, authenticated: false }`.
- Add tests for the route and its integration with the factory.
- Document `MASTRACODE_AUTH_DISABLED` as an API-only local smoke-test
option. A supported no-auth UI mode is out of scope.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>
|
||
|
|
38643beb41 |
feat: automatic per-role memory model selection for Observational Memory (#24508)
## What this changes
Mastra Code and Factory run Observational Memory with two background
models: an **Observer** that condenses conversation into observations,
and a **Reflector** that compresses those observations. Both were pinned
to a materialized default (Gemini Flash) unless you picked one by hand.
That had two consequences:
- Memory work went to a provider you might not have credentials for, and
the failure surfaced as a warning instead of an invitation to choose a
role model.
- Changing your main model did not change the memory model, so a session
running on one provider still did its memory work on another.
Observer and Reflector now default to **Auto**. On every observation and
reflection, Auto picks a concrete model: Gemini Flash when a Google key
is set, otherwise the low-cost model of the active main model's provider
(for example `anthropic/claude-sonnet-4-6` →
`anthropic/claude-haiku-4-5`), otherwise the main model itself (which is
what custom providers get). Changing the main model changes the memory
model without rewriting saved settings or rebuilding `Memory`. Explicit
per-role choices stay pinned, and the two roles are independent of each
other.
## How it works
**`@mastra/memory` owns the Auto policy.** `model: 'auto'` is the new
default for the top-level, observation, and reflection model. Memory
resolves it from the active actor model on each call; literal `'auto'`
never reaches the model router. New options: `autoModels` (override the
per-provider low-cost table), `resolveModel` (turn the picked model ID
into a model instance, e.g. through a host's credential store), and an
exported pure `resolveAutoModelId(mainModelId)` for previews. A
`mastra/` gateway route is kept on the picked model.
**Core** — `AgentControllerOMConfig` gains
`observerModel`/`reflectorModel` (accepting `'auto'`) and an optional
`resolveAutoModelId` for reporting. Sessions persist per-role selection
intent separately from the concrete ID: `session.om.<role>.model()`
returns the intent, `modelId()` the effective concrete model,
`switchModel({ modelId: 'auto' })` returns a role to Auto, and
`om_model_changed` still carries a concrete ID. Dynamic model functions
may return `{ model, id }` so consumers like Memory can read the
provider/model ID of a resolved model; router models expose a read-only
`id`.
**Mastra Code SDK and TUI** — the SDK passes `'auto'` through to Memory
along with its credential-aware resolver. Onboarding, provider login,
ACP sign-in, and `mastracode login` no longer write a memory model.
`/om` shows **Auto (effective-model)** per role and resets either role
independently. A model pack's memory model has three states (unset → use
`/om`, Auto, concrete) and, when set, applies to both roles while the
pack is active; `/om` and the status line show the model the pack
selects.
**Factory** — Auto roles persist as `NULL` in the existing nullable
columns and explicit picks as concrete IDs; provider connection no
longer writes them, and the unused `POST
/web/config/om/provider-defaults` route is removed. The caller's row is
read per run and placed on the request context before memory runs, so a
stored pin takes effect on the same run; channel runs layer the sender's
saved knobs over the project's. If the row cannot load, memory falls
back to Auto and default thresholds and the thread shows an error. `GET
/web/config/om` returns intent, effective model, and provider
availability per role (`mastra/` models count as available with a Mastra
gateway key), and `PUT /web/config/om/:role/model` accepts `{ modelId:
'auto' }` to reset a role.
`MastraCodeConfig.inputProcessors` also accepts a function of `{
requestContext }` so Factory can add its per-run settings processor.
## Verification
- Focused suites for Core (`session-om`, `resolve-model`,
`dynamic-model-fallback`), Memory (`auto-model`, `observational-memory`,
type tests), SDK (memory, model, packs, schema, ACP), TUI (om,
om-settings, om-model, status-line, login), Factory (memory settings,
config routes, sessions, Slack, rules processor), and Factory UI MSW
tests.
- TUI E2E scenarios covering Auto selection, pack memory models,
onboarding, and the pack editor; ACP conformance.
- Typechecks, lint, and builds for Core, Memory, SDK, TUI, Factory,
Factory UI, and `packages/server`.
- Two deterministic end-to-end proofs driving the built TUI and a real
local Factory server against local model endpoints, with logs showing
which concrete model each role invoked, plus red runs of the same
scripts against the merge base. The green runs show both roles following
a main-model change and an explicit pin holding, with zero external
provider requests. Transcripts are session artifacts under
`.mastracode/plans/` and are not committed.
- CI adds a `mastracode-web-e2e` job that runs the web-host OM
scenarios.
## Changesets
`@mastra/memory` (minor: default model is now `'auto'`), `@mastra/core`
(minor), `@mastra/code-sdk` / `@mastra/factory` / `@mastra/server`
(patch), `mastracode` (patch). Saved Observer/Reflector choices stay
pinned after upgrading; `'auto'` in the Factory settings body now means
automatic selection rather than a model name.
---------
Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com>
|
||
|
|
ea7ca755a4 |
security: Vanta remediation pass 2026-10-07 (MCP SDK, sharp, hono) (#26260) | ||
|
|
6d1307af4c |
feat(factory): let deployments enable Amazon Bedrock for signed-in accounts (#26249) | ||
|
|
bf0dd07091 |
security: Vanta remediation pass 2026-10-05 (#25966)
Update 2026-10-06 (commits added on this branch; origin/main merged in to clear the lockfile conflict) Dependabot opened new alerts overnight (4 critical). This pass adds: - braintrust ^3.24.0 -> ^3.36.0 in @mastra/braintrust. braintrust 3.27 pulled in simple-git 3.36.0, which has critical and high advisories (GHSA-x6jw-m9v5-85vh, GHSA-v5rq-49vh-5v5c via @simple-git/argv-parser 1.1.1, GHSA-858h-whjf-mvg5, GHSA-g4wm-2vf7-vfgr). Those are only fixed in simple-git 4. braintrust 3.36 no longer depends on simple-git, so simple-git drops out of the lockfile. @mastra/braintrust only uses initLogger and currentSpan. - wrangler ^4.110.0 -> ^4.147.0 (devDependency of @mastra/deployer-cloudflare, type-only import). This moves workerd 1.20260708.1 -> 1.20261001.1 on that chain (Aikido medium). workerd 1.20260714.1 is still there through the miniflare 4 devDependency in stores/cloudflare and stores/cloudflare-d1. - source-map-js 1.2.1 -> 1.2.2 (GHSA-68fv-2mgg-jv7q, high). Added the floor `source-map-js@>=1.0.0 <1.2.2: 1.2.2` in the root and in 15 nested pnpm workspaces (9 e2e projects, mastracode/web, otel-bridge agent-hub and hono-multi, agent-builder, mcp and memory integration-tests). postcss, css-tree, magicast and @tailwindcss/node all declare ^1.2.x. In the customer-refund template, a plain npm lock refresh was enough (no override). - postcss-selector-parser: raised the existing floor from `>=7.1.0 <7.1.3: 7.1.3` to `>=7.1.0 <7.1.6: 7.1.6` (GHSA-rj75-hqrm-r3gf, medium). - observability/_examples/otel-bridge/hono-multi: tsx catalog ^4.21.0 -> ^4.23.15. tsx 4.23 uses esbuild ~0.28, so esbuild 0.27.2 is gone (Aikido high and low, fixed in 0.28.1). - Changeset `.changeset/vanta-2026-10-06.md`: patch for @mastra/braintrust. Still not fixed (as of 2026-10-06) - sprintf-js 1.0.3/1.1.3 (GHSA-hp3w-g68c-fv3c): no patched release. - postcss-selector-parser 6.0.10/6.1.3: the fix is only in 7.1.6. @tailwindcss/typography 0.5.20 pins 6.0.10 exactly, and cssnano 6/postcss-calc 9 use ^6. - katex 0.16.47 (GHSA-238p-pmpm-9mq7, low): the fix is in 0.18.2. mermaid 12.1.0 still declares ^0.16.47. - http-cache-semantics: 4.3.0 is now older than 24h, but it still doesn't touch the max-stale path, and the advisory still lists no patched version. - braces 3.0.3 has no new release. - The rest of the deferred list below is unchanged. --- Vanta remediation for 2026-10-05. The finding list was rebuilt from GitHub Dependabot, OSV-scanner on every tracked lockfile, and Aikido intel (full intel.aikido.dev feed re-pulled today). It is not a Vanta export. What changed Package bumps - probe-image-size ^7.2.3 -> ^7.4.0 in @mastra/memory (GHSA-gjj5-9665-rwrc, high). - verdaccio ^6.10.4 -> ^6.10.5 in the 9 e2e projects. That moves @verdaccio/core to 8.3.2 and js-yaml 5.2.2 -> 5.4.1 (GHSA-r3ph-w7gj-g6xm, medium). - smol-toml 1.8.0 -> 1.9.0 pin in @mastra/code-sdk. Root lockfile refresh (no range changes) - serialize-javascript 7.0.5 -> 7.1.2, shell-quote 1.10.0 -> 1.12.0, ws 7.5.11 -> 7.5.13, enhanced-resolve -> 5.26.0, fs-extra 11.3.5 -> 11.4.1, @sinclair/typebox 0.27.8 -> 0.27.12, @zip.js/zip.js 2.8.26 -> 2.23.0, memfs/@jsonjoy.com/fs-snapshot 4.57.2 -> 4.80.0, @vue/* 3.5.38 -> 3.5.43. pnpm overrides, for parents that pin an exact vulnerable version. All stay in the same major. - modern-tar 0.7.7 (just-bash), smol-toml 1.9.0 (just-bash, @blaxel/core, @react-grab/cli, modal), strnum 2.4.2 (fast-xml-parser 5.10.1), inline-style-parser 0.2.9 (style-to-object 1.0.11), `@opentelemetry/configuration>yaml` 2.9.1 (sdk-node 0.221). Nested lockfiles - shell-quote floor raised from <1.10.0 to <1.11.0 in examples/agent, examples/voice-agent and otel-bridge/agent-hub. - yaml 2.9.0 -> 2.9.1 in e2e-tests/pkg-outputs, examples/durable-agents, mastracode/web, packages/mcp/integration-tests and the customer-refund template. - next 16.3.6 -> 16.3.8 in packages/memory/integration-tests. - customer-refund template: tinypool 2.1.0 -> 2.1.2 through an override scoped to oxfmt. oxfmt 0.59 pins it exactly, and bumping oxfmt would change the template's format check. Not fixed here - braces 3.0.3 (GHSA-vfj7-8cjw-p6xm) and http-cache-semantics 4.2.0 (GHSA-ch52-4w7c-c8xp): no patched release. http-cache-semantics 4.3.0 is outside the advisory range, but it doesn't change the max-stale code path, so bumping to it would only hide the alert. - extract-zip 2.0.1: no patched release. It comes from the webdriverio chain that #25855 removes. - workerd 1.20260708/1.20260714 (Aikido medium): miniflare 4.x stops at workerd 1.20260730. The fix needs miniflare 5, which is only published as an alpha. - Major-only: @ai-sdk/provider-utils 2.2.8 / ai 4.3.19 (AI SDK v4), @opentelemetry/core 1.30.1, esbuild 0.18/0.25/0.27.0 (convex pins 0.27.0 exactly), js-yaml 3, brace-expansion 1/2, uuid 11, zod 3, pino 8/9, undici 6, plus other Aikido lows. - websocket-driver 0.7.5: Aikido says the fix is 0.8.x, but no 0.8 is published on npm. The changeset is a patch for @mastra/memory and @mastra/code-sdk. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 This PR updates several dependencies that have security fixes. It also adds version rules so nested projects use safer versions of related packages. ## Changes - Updates `probe-image-size` in `@mastra/memory` to `^7.4.0` and pins `smol-toml` in `@mastra/code-sdk` to `1.9.0`. - Updates Verdaccio to `^6.10.5` in nine end-to-end test projects. - Raises `shell-quote` overrides to `1.11.0` and adds overrides for transitive dependencies, including `yaml`, `source-map-js`, `postcss-selector-parser`, `modern-tar`, `smol-toml`, `strnum`, `inline-style-parser`, and `tinypool`. - Updates `braintrust` to `^3.36.0`, `wrangler` to `^4.147.0`, and `tsx` to `^4.23.15`. - Adds patch changesets for `@mastra/memory`, `@mastra/code-sdk`, and `@mastra/braintrust`. The changesets report no API changes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
0a37598686 |
feat!: make controller sessions single-model and move packs to TUI (#25997)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
4358322b7b |
chore(deps): override upstream-blocked vulnerable transitive deps (#25853) | ||
|
|
bc826e8fb1 |
refactor: use Web Crypto where synchronous contracts stay intact (#25462)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
e4e0f9000d |
Reattach the existing sandbox VM on Factory session resume instead of silently replacing it (#24004)
Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com> |
||
|
|
aeddbc9909 |
security: Vanta 2026-09-28 residuals (template proxy-addr, nested undici/next/shell-quote/form-data, OTEL, onnxruntime) (#25344) | ||
|
|
96233975b7 |
fix(mastracode): correct tokens-per-second accounting in TUI and web (#25196)
Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com> |
||
|
|
00e72fabd9 |
fix(mastracode-web): honor INCIDENT_IO_API_KEY on generated Factory Servers (#25178)
## Summary Setting `INCIDENT_IO_API_KEY` on a generated Factory Server (`mastracode/web`) did nothing: the entry constructed direct GitHub, GitLab, Linear, and Jira integrations from their env groups but never constructed `IncidentioIntegration`, so incident.io follow-up intake only worked on Platform-backed servers. And even with the integration constructed, the Work Intake settings section was gated solely on Platform connect routes, leaving no way to select or route follow-up sources on a Platform-less server. This surfaced while documenting the integration in [softwarefactory-docs#6](https://github.com/mastra-ai/softwarefactory-docs/pull/6). ### mastracode/web - Construct `IncidentioIntegration` when `INCIDENT_IO_API_KEY` is set, matching the direct-fallback pattern of the other providers. Construction is gated on the env var because the constructor throws without a key; an explicit integration takes precedence over the factory's auto-installed `PlatformIncidentioIntegration`. - Declare `INCIDENT_IO_API_KEY` in `.env.schema`. ### @mastra/factory - `/web/incidentio/status` now reports the credential `mode` (`api-key` | `platform`), mirroring Jira's status shape, so the SPA can tell a deployment key from Platform connections. ### factory-ui - The Work Intake incident.io section stays usable when a deployment API key serves the feature: rendered without Platform connections, sync toggle and source picker enabled, connect controls replaced with an "API key configured on this server" caption (a direct key takes precedence over Platform connections server-side). ## Test plan - `mastracode/web` `src/mastra/index.test.ts`: direct integration registered when the key is set; nothing registered without key or Platform credentials; direct key preferred when Platform credentials are also configured. The 3 pre-existing failures in that file reproduce identically on clean `main` (GitHub rules routing, unrelated). - `@mastra/factory`: new status-route test asserting `mode` passthrough; all incidentio + platform/incidentio suites pass (92 tests); `tsc --noEmit` clean. - `factory-ui`: new MSW test — deployment API key without Platform connections keeps the section usable for source selection and routing; all 35 IntakeSection MSW tests pass; `typecheck` clean. - `mastracode/web` `pnpm check` (tsc) clean. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 Generated servers can now use an incident.io API key for intake without a Platform connection. The settings page shows intake controls when the key is ready, and keeps them hidden when the key still needs an organization. ## Changes - Added `INCIDENT_IO_API_KEY` to the generated server environment schema and register `IncidentioIntegration` when the trimmed key is set. Direct credentials take precedence over Platform credentials. - Added credential `mode` to incident.io status responses to identify API-key or Platform credentials. - Updated Work Intake to load sources and enable controls when a direct API key is ready, even if Platform connection data is unavailable. When the key requires an organization, the section and sources request remain gated. - Added tests for integration registration and credential precedence, status mode, and API-key Work Intake behavior. Test results were not verified in the supplied evidence. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
2f14fb37f3 |
fix(mastracode): simplify Factory web dev startup (#24996) | ||
|
|
06605b4f04 |
chore(mastracode): let the Factory web dev server take a PORT override (#24953)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
44510eebe0 |
remove secrets | ||
|
|
1fd3abe7e5 |
fix template (#24937) | ||
|
|
36a103bc9a |
remove gh rules in template (#24934) | ||
|
|
af01f2dc29 |
feat(factory-ui): show your own sessions in the Factory sidebar by default (#24858)
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> Co-authored-by: Tyler Barnes <tylerdbarnes@gmail.com> |
||
|
|
e7d378f16e |
fix(redis-streams): plug pubsub memory leaks in subscriptions, reply topics, and feed acks (#24580)
Co-authored-by: Mastra Code (anthropic/claude-fable-5) <noreply@mastra.ai> Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com> |
||
|
|
7485da663e |
feat(factory): place GitHub cards by label on arrival, reconcile, and PR review (#24649)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
ffc23d28fa |
feat(mastracode): simplify Factory local development (#24632)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |