mirror of
https://github.com/mastra-ai/mastra.git
synced 2026-11-17 08:44:46 +00:00
740 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8759d3ab63 |
test: keep real network calls out of unit test projects (#30498)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
7da6593acb |
ci(test-tiers): let the daily update finish (#30467) | ||
|
|
ca0af9fa6e |
ci: skip memory benchmarks on PRs and run durable stream tests in parallel (#30416) | ||
|
|
add6f402d6 |
ci: skip test files and jobs that have not failed in 30 days (test tiers) (#30374)
## Summary On pull requests, CI now skips test files and whole CI jobs that haven't failed in the last 30 days. Main still runs everything, so a quiet test that breaks is still caught on main. - `scripts/test-tiers/` builds `tiers.json` from the last 30 days of CI failures on main and PRs. A file or job goes back "in" as soon as it fails, and drops "out" after 30 days without a failure. The scheduled `test-tiers.yml` workflow keeps that file current on the `ci/test-tiers` branch. - `select-affected-tests.cjs` removes "out" unit and package E2E files before the files are split across shards. Prebuild exposes `tier_skip_jobs` so the store, workspace, E2E and mastracode workflows can skip "out" jobs. - Everything runs when: the PR has the `full-tests` label, the PR changes the tier files or a job's own workflow, or `tiers.json` or the PR's labels can't be read. ## Measurement One-line change to `packages/core/src/agent/agent.ts`, with Affected UNIT run as CI runs it (3 shards, 4 CPUs): | | Unit files | Slowest shard | |---|---|---| | Before | 3,208 | 639 s | | After | 1,118 | 361 s | Package E2E files go from 49 to 3, and 9 whole jobs are skipped. ## Test plan - 110 routing tests, including 7 new tier-routing cases: dropped files and shard count, job gates, the edited-path override, workspace and cloud package lists, the `full-tests` label, and no tiers file. - 38 tier script tests. - 18 parity scenarios against the previous selection. - actionlint and oxfmt; the one actionlint finding is pre-existing on main. - Timing measured on 4-CPU runners: the numbers above. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 This change makes pull request CI run fewer tests. Tests and CI jobs that have not failed in the last 30 days are skipped. If a skipped test or job fails again, it returns to the normal set. ## Overview This change adds test-tier filtering to pull request CI. A tier file, `tiers.json` on the `ci/test-tiers` branch, lists unit test files, package E2E files, and CI jobs as `in` (run) or `out` (skip). A scheduled workflow updates the file from recent failures. Rules: - Full-suite runs, the `full-tests` label, and missing or invalid tier data run everything. - Changing a tier file, or changing a job's own workflow, runs all tests. - An `out` file is dropped only when the pull request does not change it. - An `out` job is skipped only when the pull request does not change that job's owned paths. - Filtering runs before unit sharding. - The workspace artifact keeps the full workspace selection. ## Changes by area **Routing and selection** - `.github/scripts/select-affected-tests.cjs`: `routeTests` accepts optional `tiers` and `storeNames`. Its result includes retained tests, dropped files, and skipped jobs. It also emits workspace packages for unit and Docker runs, omitting quiet packages. Store, memory, E2E, experiment-worker E2E, MastraCode E2E, and workspace flags depend on whether their jobs are skipped. - `scripts/test-tiers/select.mjs` (new): loads tier configuration, classifies E2E files, selects unit tests and jobs, and provides a `skip-jobs` CLI. - `.github/workflows/prebuild.yml`: the `affected-tests` job exposes `tier_skip_jobs`. It reads tier configuration from `ci/test-tiers` and reads PR labels. A label-read failure runs all tests. It passes `skip_jobs` to the reusable E2E, Mastra Code E2E, and combined-store workflows. It adds `issues: read` permission. **Workflow inputs and job gates** - `.github/workflows/e2e-tests.yml`: new optional input `skip_jobs` (default `'[]'`). Nine E2E jobs run only when their `job:e2e/...` key is not listed. The E2E registry publisher and the E2E workflow gate stay enabled when tiered E2E jobs are quiet, because npm import needs the registry. - `.github/workflows/mastracode-e2e.yml`: new optional input `skip_jobs`. Skips `mastracode-e2e` when the list contains `job:mastracode-e2e`. Skips `mastracode-web-e2e` when the list contains `job:mastracode-om`. - `.github/workflows/test-combined-stores.yml`: new optional input `skip_jobs`. Removes stores listed as `job:store/<name>` before splitting outputs. The `test` job runs only when its store output is nonempty. - `.github/workflows/lint.yml`: the `changeset-check` job applies tier selection to its validator tests. It forces full tests if the changed-file diff fails. It skips nothing if tier selection fails. It adds a step that runs the test-tier script tests. - `.github/workflows/secrets.test-workspaces.yml`: removes cloud-test packages whose `job:workspace-cloud/<package>` tier is `out`. Changeset-release branches, the `full-tests` label, and failures to read PR labels or changed files select full tests. Invalid tier data skips no packages. If no packages remain, `workspaces-changed` becomes `false`. **Tier data maintenance** - `scripts/test-tiers/update.mjs` (new): CLI with `versioning` and `daily` commands. It records failures and settles whole-job failures. It removes deleted files, adds new files and job keys in `all` scope, and moves entries that stay clean for `WINDOW_DAYS` to `out`. It requires `--tiers`. `versioning` also requires `--run-id`. `daily` defaults the lookback to 14 days. - `scripts/test-tiers/seed.mjs` (new): generates initial tier data from file ages, qualification records, failure indexes, and rename mappings. It validates job keys and tier values. - `.github/workflows/test-tiers.yml` (new): runs after completed Prebuild workflows, on a daily schedule, or manually. It runs only in `mastra-ai/mastra` and serializes runs. It commits and pushes changed tiers to `ci/test-tiers`. A manual run with `seed=true` creates the branch. **Seed data** - `scripts/test-tiers/seed-data/fail-index.json`, `jobs-seed.json`, and `renames.json`: seed inputs. `jobs-seed.json` covers 54 jobs. `renames.json` contains 669 path mappings. **Tests** - `.github/scripts/select-affected-tests.test.ts`, `scripts/test-tiers/select.test.mjs`, `scripts/test-tiers/seed.test.mjs`, and `scripts/test-tiers/update.test.mjs`: cover routing, tier selection, seeding, and tier updates. ## Reported results (author-reported, not verified here) - One-line change to `packages/core/src/agent/agent.ts`, measured on 4-CPU runners: - Affected unit files: 3,208 to 1,118. - Slowest shard: 639 to 361 seconds. - Package E2E files: 49 to 3. Nine whole jobs skipped. - Reported test plan: 110 routing tests (7 new tier-routing cases), 38 tier-script tests, 18 parity scenarios, actionlint, and oxfmt. - Reported: one actionlint finding exists on main before this change. - CI status on the current head: not available. - Review severity counts: not available. ## Review notes - The diff has 20 files, with 12,163 lines added and 12 removed. Most added lines are seed data (`fail-index.json`, `renames.json`, `jobs-seed.json`). - Reviewers should check the paths that decide whether tests are skipped first. These are tier loading failures, label-read failures, full-suite mode, and the changed-file rules. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com> |
||
|
|
fdd242c2a4 |
chore(ci): remove 2027dev evals workflow (#30107)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
5e6417057e |
ci: report CodeQL scans that time out instead of staying silent (#30017)
Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com> |
||
|
|
5c0f12c5a2 |
ci(mcp): fix MCP compatibility job on version-packages PRs (#29988)
Co-authored-by: YJ <yj@example.com> Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
c10344bbae |
ci: scan main with CodeQL twice a day and alert Slack, instead of scanning every PR (#29098)
Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com> |
||
|
|
51a20e848e |
feat(docs): one pnpm check command for all docs checks, with JSON output and stable rule IDs (#29801)
Co-authored-by: LekoArts <lekoarts@gmail.com> |
||
|
|
27340425d7 |
ci: select tests for dependency bumps and directory-scanning tests on… (#29725)
… PRs PR test selection only follows source imports, so three PRs merged green and broke the alpha cron's full suite: an OpenTelemetry lockfile bump (#28581, otel-bridge), lockfile maintenance moving @ai-sdk/anthropic (#29341, schema-compat e2e), and a new hook without a story (#29373, storybook-coverage.test.ts reads the hooks folder rather than importing it). Prebuild now compares each workspace package's resolved dependency tree between the base and head lockfiles and runs the tests of packages whose tree or package.json changed. A root toolchain change, or a selection over a quarter of the suite, runs the sharded full suite instead. Tests that scan their package's directory run when a file there is added, removed or renamed. The selection logic also moves out of inline workflow script into .github/scripts/select-affected-tests.cjs with unit tests, and keeps the three-way split of large affected unit runs from #29143. ## Description <!-- Required: Provide a brief description of the changes in this PR. --> ## Related issue(s) <!-- Required: Link to the issue(s) this PR addresses, e.g. with: Fixes #123. PRs without linked issues will be closed. High-quality issues with reproductions are preferred to vague pull requests. --> ## Type of change - [ ] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Code refactoring - [ ] Performance improvement - [ ] Test update ## Checklist - [ ] I have linked the related issue(s) in the description above - [ ] I have made corresponding changes to the documentation (if applicable) - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have addressed all Coderabbit comments on this PR <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 The test selector checks whether package dependencies changed and whether tests search their package folders for files. It uses the PR’s own lockfile changes to select relevant tests, so unrelated changes on the base branch do not trigger extra test runs. ## What changed - Added dependency-based test routing. It compares resolved dependency trees in the merge-base and PR-head lockfiles, follows workspace links, and selects tests for affected packages. - Selects a package’s tests when its `package.json` changes. - Selects directory-scanning tests when files in their package are added, removed, or renamed. - Requests the full suite when root dependencies change or dependency-based selection exceeds 25% of the test files. - Moved Prebuild test selection into `.github/scripts/select-affected-tests.cjs`. The script combines import-graph and dependency-based selections and routes tests to the applicable suites. - Added tests for dependency routing and suite selection. Added `yaml` as a root development dependency. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
81940b555e |
ci: upload studio and factory assets only to production R2 (#29729)
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> |
||
|
|
181cff7be8 |
ci: split large affected unit runs across three jobs (#29143)
Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com> |
||
|
|
3a01ed16f4 |
ci: cache what affected-test detection parses, so PR test selection takes ~4s instead of ~40s (#29133)
## What "Detect affected tests" decides which test files a PR runs. Today it parses ~15,000 files on every PR run: madge builds the import graph, then a second pass extracts exported names and symbol edges. That takes ~40s on the 5 vCPU runner, and almost none of those files changed since the last run. This change caches the parse results in a file, keyed by a hash of each file's content: - `scripts/affected-tests-cache.mjs` stores, per file, only what its own text decides: the import specifiers precinct finds and the exports and symbol edges the second pass extracts. Records are keyed by `sha1(extension + content)`. - Resolving those specifiers to files is **not** cached. It still runs live through filing-cabinet with madge's exact options, so a rename, a moved file or an alias change can't be hidden by a cache hit. - The cache file records its schema version and the precinct and typescript versions. If any of them differ, the run starts cold. It is never wrong. - `.github/workflows/prebuild.yml` restores the cache before detection (restore only; PRs never save). The key is `affected-graph-v1-<os>-<sha>` with the prefix restore-key `affected-graph-v1-<os>-`, so a PR gets the newest main seed. - The new `.github/workflows/affected-graph-seed.yml` refreshes the seed on every push to main. It runs detection once on core's entry point, which touches the whole graph, then saves the cache. A newer push cancels an older seed run. The detection output (selected files, graph nodes, test files) is unchanged. ## Numbers Measured on a 5 vCPU / 16 GB container like the CI runner, Node 24.22.1: | | time | |---|---| | Uncached (today) | 40.3s | | Cached, current seed | 4.0s | | Cached, seed ~300 commits old | ~13s | | Seed run on main | ~40s | The seed file is 14.8 MB raw and 1.7 MB in the actions cache. Compute: about 36s saved per PR run, against about 90s per merge to main for the seed run. ## Testing - Ran detection uncached and cached on 20 recent merged PRs (between 1 and 3,532 files selected): output identical on all 20. - Renamed `retry-after.ts`, updated its importers and added a new test file importing the renamed module: identical output (2,849 selected), the new test is selected and the old path is gone from the graph. - `packages/core/src/affected-tests-cache.test.ts` covers cold, warm and changed-import runs. It fails if records are keyed by file name instead of content. - `packages/core/src/affected-tests-resolution.test.ts` and `.github/scripts/ci-routing.test.ts` pass. oxlint and prettier are clean. Stacked on #29091 (cancelled runs stop downstream jobs). It will be retargeted to main once that merges. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 The affected-test detector checks which tests may need to run after code changes. This PR saves file-parsing results so later checks can reuse them, while still resolving file links against the current code. ## What changed - Added a content-addressed cache for file parsing. It stores import specifiers, exported names, and symbol edges, and checks a schema and extractor-version string before reusing records. - Kept file resolution live through filing-cabinet and Madge’s existing options. Updated affected-test detection to use the cache and save records used during the run. - Added a workflow to refresh the cache seed on pushes to `main`. Updated prebuild to restore the seed for affected-test detection. - Added a test for uncached, cold-cache, and warm-cache graphs, including after a file’s imports change. ## Validation Test, lint, formatting, output-comparison, runtime, and review-finding results: 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> |
||
|
|
43f77e77a0 |
ci: delete the Changed Test Gate (#29099)
## What this does
Deletes the Changed Test Gate workflow, its labeler workflow (which
labels PRs from the gate's result) and `scripts/pr-test-gate/`. The
gate's deployer rule is kept: it moves into Prebuild as a small
`Deployer E2E coverage` job.
## What the gate enforced, and what goes
The gate checked out the base branch, restored the PR's changed test
files on top of it, and ran them. Removing it drops two rules:
1. **Fail-before-fix.** If a PR changed tests, those tests had to fail
against the base branch ("Changed tests passed against the base branch.
They should fail before the PR code is applied."). This rule goes.
2. **External contributors must add tests.** A PR from outside the org
(`AUTHOR_ASSOCIATION` not OWNER/MEMBER/COLLABORATOR) with no changed
test files failed. This rule goes.
A third rule stays: **a PR that changes `packages/deployer/` must also
change `e2e-tests/monorepo/`** (`packages/deployer/AGENTS.md` and
`CHANGELOG.md` exempt; the same-repo Changesets release PR skipped).
It's now `Deployer E2E coverage` in `prebuild.yml`: a `git diff
--name-only` against the merge base, no install or build. It's its own
job rather than a step in `changes`, because a failing `changes` job
would skip every test job. `packages/deployer/AGENTS.md` now names that
job.
## Why dropping 1 and 2 is acceptable
- Neither rule was enforced at merge time: the gate isn't a required
check. The required checks are `Lint` and `Unit and E2E Tests / Merge
Test Reports`, and this PR touches neither.
- Of the gate's last 1000 runs, 8 failed. All 8 were the fail-before-fix
rule firing on tests that passed without the fix; each PR resolved it by
rewriting its tests. Across 812 gate logs from Aug–Oct, every run that
executed tests took the passing path (changed tests failed against base,
as required). So it shaped how a few tests were written, but no run
showed it stopping broken code from merging.
- It costs a runner, a checkout and a test run on every non-draft PR, on
top of Prebuild running the same changed tests against the PR head.
- External contributions still go through maintainer review, which can
ask for tests.
## Test plan
- [x] `rg` for remaining references: only two "former" comments and an
unrelated fixture name
- [x] `pnpm install --frozen-lockfile` works after removing
`scripts/pr-test-gate` (192 projects)
- [x] Deployer check shell logic run locally under `bash -eo pipefail`
with a stubbed diff: deployer-only change fails with the annotation;
deployer + `e2e-tests/monorepo/` passes; `AGENTS.md`/`CHANGELOG.md`-only
passes; no deployer change passes
- [ ] CI on this PR: no Changed Test Gate check appears; `Deployer E2E
coverage` passes
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
This change removes the old system that checked whether pull requests
added and tested tests. It keeps one focused rule: changes to the
deployer package must include a monorepo E2E test change, with specified
documentation files exempt.
## Changes
- Deleted the Changed Test Gate workflow, its labeler workflow, and the
`scripts/pr-test-gate/` package.
- Added a separate `Deployer E2E coverage` job to Prebuild. The job
checks the merge-base diff and fails when a non-exempt file under
`packages/deployer/` changes without a file under `e2e-tests/monorepo/`.
- Exempted `packages/deployer/AGENTS.md` and
`packages/deployer/CHANGELOG.md` from the coverage check.
- Updated `packages/deployer/AGENTS.md` to refer to the Prebuild job.
- Updated comments in the memory simulation config and two test
link-provider files.
## Validation
The PR description reports that `pnpm install --frozen-lockfile`
succeeded across 192 projects and that the deployer-check shell logic
passed the listed local cases. CI validation is not confirmed: the
description says it is not yet known whether the old check disappears
and the new job passes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com>
|
||
|
|
d73e4ed054 |
ci: let cancel-in-progress stop superseded PR test runs (#29091)
## Summary When a new commit is pushed to a PR, `concurrency: cancel-in-progress` cancels the running Prebuild run, and GitHub holds the new run until the old one has fully finished. The downstream test jobs and Merge Test Reports were gated with `if: always() && …`. `always()` is true even when the workflow is cancelled, so the cancelled run kept running its test jobs, and the new push waited for results nobody would read. This changes: - `prebuild.yml`: the six downstream callers (Unit and E2E Tests, E2E, Mastra Code E2E, Combined Store Tests, Workspace Tests, Memory) go from `always()` to `!cancelled()`. None of them is itself a required check. - `test-suite.yml`, Merge Test Reports: the job **keeps** `if: always()`; its four heavy steps (checkout, setup pnpm/Node, download test results, merge reports) get `!cancelled() &&` in front of their existing condition. Why Merge Test Reports keeps `always()`: the ruleset requires two checks, `Lint` and `Unit and E2E Tests / Merge Test Reports`. GitHub reports a skipped required job as passed, so skipping that job on cancel would leave the required check green with no tests run. With the job still running, its "Require every test job to finish" step (#28964) fails it when a test job was cancelled, as before. A cancelled run now spends seconds in that job instead of minutes. Step-level `always()` (artifact uploads, the "Require every test job to finish" step) and the Slack notifier are unchanged. ## Example Branch `feat/knowledge-alpha-standalone`, Oct 31: a push at ~03:55 cancelled run 41165713431 at 03:55:05. Its `always()` jobs kept going, and its Merge Test Reports job *started* at 04:12:40. The new run 41166383453 started no jobs until 04:14:12, a 19.1 min wait, while the old run spent 28 min of compute on 6 jobs. Across 53 recent PR runs, 9 waited like this, 3–19 min each (77 min in total), with 81 min of compute spent after the cancel. ## Why failures still report A failed test job, or one that hits its timeout, doesn't cancel the workflow, so `cancelled()` stays false. Merge Test Reports, its "Require every test job to finish" step and the Slack notifier still run in those cases. GitHub's docs: `always()` "returns true even when canceled", and they recommend `!cancelled()` for "run unless cancelled". Past example: runs 40586465971 and 40585251182, where Affected UNIT hit its 20 min timeout (job conclusion `cancelled`, run conclusion `failure`), and Merge Test Reports still ran. ## Test plan - [x] YAML parses, prettier clean (the `if:` needs `${{ }}` because a bare `!` is a YAML tag) - [x] No other called workflow has a job-level `always()` - [ ] CI on this PR runs as before - [ ] Optional: push twice quickly and check the first run stops at the cancel, while its Merge Test Reports still ends red <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 When a newer pull request run replaces an older one, the older run now stops starting downstream work after cancellation. This can free up time and resources for the newer run while preserving the required test check. ## Changes - In `.github/workflows/prebuild.yml`, six downstream jobs use `!cancelled()` instead of `always()`. Their other conditions remain in place. - In `.github/workflows/test-suite.yml`, `merge-reports` keeps job-level `always()`. Its checkout, setup, result-download, and report-merge steps now check for cancellation before running. - The “Require every test job to finish” step, test-result uploads, and Slack notifier remain unchanged. Test results and overall CI completion status are not established by the supplied evidence. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com> |
||
|
|
78d801b154 |
fix(ci): grant id-token: write to the alpha cron test job (#29570) | ||
|
|
8b11e542bb |
ci: run container-free store and workspace unit tests in one job each (#29090)
Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com> |
||
|
|
f94beac862 |
fix(core): unwedge restarted nested evented loops (#29431)
> Opened by @user_01KNA8J74D4RF84RXSDRX26BS9
## Problem
Setup: a split deploy (API with `MASTRA_WORKERS=false` plus dedicated
workers over Redis) with `recovery.durableAgents: 'auto'`. When the API
and the worker die together mid-tool and both restart, boot recovery
claims the run under a new generation and the interrupted tool runs
again. After that, the run stops making progress. It sits in
`durable-agentic-loop:running` forever while the API keeps renewing its
lease. Because the run never ends, it also keeps its thread lease, so
any later run on the same thread is rejected with
`AgentThreadLeaseConflictError`. Mastra Doctor hits this every time,
since its thread is the deployId and every re-diagnosis lands on the
stuck thread. The `DurableExecutionFenceError` and `This workflow run
was not active` messages in the ticket are side effects of this stuck
run.
## Root cause
Recovery behaves correctly: it claims a new generation and re-drives the
run. The run gets stuck in the evented step guard in
`WorkflowEventProcessor.endWorkflow`.
When a restarted nested loop body finishes, `endWorkflow` calls
`#processLoop` for the parent loop. The `!parentWorkflow.restart`
condition there, introduced by
|
||
|
|
a0068a9ad1 |
feat(core): resumable streams for every Agent (#28424)
> Opened by @user_01KNPFT2RPETZTEP15J3AEBA08 Originally stacked on [#28416](https://github.com/mastra-ai/mastra/pull/28416), which has merged. This PR now targets `main`. ## What Any `Agent` can now have resumable streams, not only durable agents. A run is published on `agent.stream.<runId>` with a replay cache, so: - a client can reconnect after a disconnect, - another reader can follow the run with `agent.observe(runId)`, - any reader can stop it (`observe().abort()`, `agent.abortRunStream(runId)`, or the abort-run route). Durable execution (surviving process restarts) stays with `DurableAgent` / `EventedAgent` / `InngestAgent`, which keep publishing through the same stream layer. ### Config New `streams?: boolean | { pubsub, cache, shouldCache, cleanupTimeoutMs }` on `Agent`. - Omitted: on when the agent is registered on `Mastra`, off for standalone agents. - `false`: off. `{ cache: false }`: live only, no replay. - With `durable`, `streams` keys override `durable` keys. `durable: true` + `streams: false` keeps publishing, drops the replay cache, and warns. ### Bus selection - Registered agents (plain and `DurableAgent` on any engine) publish on `mastra.pubsub`, so other processes sharing the PubSub and run-record cache can observe and abort. - Precedence: `streams.pubsub` > `durable.pubsub` > `mastra.pubsub`. The evented engine still forces `mastra.pubsub` over an agent-level pubsub and warns when they differ. - Unregistered agents keep a private in-process `EventEmitterPubSub`. - The replay cache wraps the shared bus once (existing `CachingPubSub` reuse check), so nothing is double-published. ### Behaviour change With streams on, closing the HTTP stream detaches the reader instead of aborting the run. To stop a run explicitly, use `POST /agents/:agentId/runs/:runId/abort`, which now works for plain agents too (ownership-checked, including across servers sharing the PubSub and run-record cache), or the thread abort route. `streams: false` keeps the old behaviour. ## Commits 1. ` |
||
|
|
fc182d9c14 |
feat(mcp-apps-components): pin dashboard widgets through standard MCP Apps model context (#29488)
This makes dashboard widget pinning work with any MCP Apps host, using
only standard MCP Apps messages, and gives React hosts a small hook to
wire it up.
When the user clicks a pin, the app sends `ui/update-model-context` with
the full list of widgets the user wants pinned under
`mastra.ai/dashboard-pinned-widgets` in `structuredContent` (each entry
is `{ widget, scope, defaults }`), plus a short text block so the model
knows too. The host still owns the state: it sends pinned ids back in
host context and the buttons follow that. Pin and drilldown state go in
the same update, so one never wipes the other, and quick clicks build on
each other until the host answers. Pin buttons only show when the host
holds the ids array and advertises
`updateModelContext.structuredContent`. Hosts parse the payload with
`dashboardPinnedWidgetsSchema`.
On the host side, `@mastra/playground-ui/domains/mcps` gets
`McpAppHostProvider`, which lets a chat add host-context keys per app
instance and receive raw model context with the app it came from,
without reloading the iframe. The existing text model-context path is
unchanged, and without the provider nothing changes.
`@mastra/mcp-apps-components/host` adds `useMcpAppHost`, which parses
and routes pin updates; that subpath doesn't pull in the app's HTML (1.6
KB vs 2.1 MB).
```tsx
import { McpAppHostProvider } from '@mastra/playground-ui/domains/mcps';
import { useMcpAppHost } from '@mastra/mcp-apps-components/host';
const host = useMcpAppHost({ dashboardPins: { pinnedIds, onPinnedChange } });
<McpAppHostProvider value={host}>{chat}</McpAppHostProvider>;
```
`@mastra/mcp-apps-components` is also added to the playground-snapshot
publish job so the platform frontend can pick it up with playground-ui.
Tested with the real app over an in-memory AppBridge (pin/unpin round
trip through `useMcpAppHost`, rapid clicks, host declining a pin,
drilldown + pins coexisting, capability gating, invalid payloads) and
MSW-backed tests for `McpAppToolResult`/`McpAppViewer` (host-context
changes reach the running app without reload, raw params reach
`onModelContext`, read-only and no-provider cases). Key behaviors were
mutation-checked. Typecheck, oxlint and builds pass for both packages.
Also checked by hand in Studio against `examples/agent`'s dashboard
agent, with a temporary `useMcpAppHost` provider around the chat: pin →
unpin → pin sends exactly one host update per click (with the widget's
defaults), the iframe never reloads, and the agent correctly names the
pinned widget from model context alone.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
The dashboard can now send its pinned widgets to the app that hosts it.
The host can save those choices and send them back, while apps that do
not use the new host support can continue to work.
## What changed
- Added `McpAppHostProvider` to `@mastra/playground-ui/domains/mcps`. It
provides per-app host context and receives raw model-context updates
while the app is running.
- Added the `@mastra/mcp-apps-components/host` export and
`useMcpAppHost` hook. Hosts can provide pinned widget IDs and handle
validated pin updates.
- Changed dashboard pinning to use `ui/update-model-context`. The app
sends the full requested widget list under
`mastra.ai/dashboard-pinned-widgets`, with a text description and
request number. Pin and drilldown state share an update.
- Pin controls require host-provided pin IDs and support for
`updateModelContext.structuredContent`. The host can disable pinning by
setting the pin context value to `null`.
- Removed the dashboard pin notification API. Hosts now use the
pinned-widget schemas and model-context updates.
- Added `@mastra/mcp-apps-components` to the playground snapshot publish
workflow and updated snapshot release guidance. Snapshot checks and
publishing use production dependency filters.
## Compatibility
Apps can continue to work without `McpAppHostProvider`. The former
dashboard pin notification API was removed and replaced with
model-context updates.
## Tests and validation
Added tests for pin and unpin interactions, pending and declined
requests, host-context updates, model-context handling, capability
gating, and invalid pin data. The PR objectives report typecheck,
oxlint, and builds passing for both packages, plus manual Studio checks.
These results were not independently verified.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
|
||
|
|
cd96954ced |
ci: run Quality assurance and Prebuild on stacked PRs, diffed against main (#29393)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
ab4d89cd38 |
test(redis-streams): run durable worker-takeover suite against real Redis and Postgres (#28952)
> Opened by @user_01KNA8J74D4RF84RXSDRX26BS9
Part 3 of 3, split from #28676. Refs COR-1490. Parts 1 and 2 (#28947,
#28951) are merged into `main`. This PR is based on `main`.
## What this does
The API-loss and worker-takeover guarantees from #28951 only hold with a
shared store that supports run fencing and a transport that works across
processes. In-memory suites can't test that. This PR:
- adds `.github/workflows/test-durable-streams.yml`, which runs the
two-process takeover suite against Redis (`:6381`) and Postgres
(`:5436`) service containers. The checkout uses `persist-credentials:
false`.
- calls it from `test-suite.yml` as the `durable-streams` job. The job
reports its own check but does not gate `Merge Test Reports`, because
its flake rate hasn't been measured yet.
- runs it when `prebuild.yml` sees changes to the evented agent and
workflow code, `packages/core/src/mastra/`, `packages/memory/`,
`pubsub/redis-streams/`, `stores/pg/`, or the workflow files
- extends `pubsub/redis-streams/src/durable-worker-takeover.test.ts` and
adds the `durable-api-loss.entry.mjs` fixture. The scenarios: API
SIGTERM/SIGKILL with remote workers, a thread follow-up after API loss,
a remote abort, worker shutdown, single-process Redis shutdown, and the
original caller completing with and without a survivor that is already
running
- adds `tsconfig.test.json` and a `check:test` script, which type-check
the tests and fixtures against core's `dist`
No changeset: this PR only touches CI and tests.
## Verification
- Reviewer run at `
|
||
|
|
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>]( |
||
|
|
f62a2d6dc1 |
fix(observability): pin OTLP exporters to the OpenTelemetry SDK 2 line (#29265)
## Description A Renovate bump moved the OTLP exporter packages in `observability/*` to `0.300.0`, the OpenTelemetry SDK 3 line, while `sdk-trace-base`, `core` and `resources` stayed on 2.x. The two lines need different `@opentelemetry/api` versions, so npm hoists api 1.9.1 and the 0.300 exporters fail to load with `The requested module '@opentelemetry/api' does not provide an export named 'SeverityNumber'`. pnpm in the monorepo never hit it. What users saw, all reproduced with fresh npm installs from the registry: - `import "@mastra/arize"` and `import "@mastra/arthur"` crash (the linked issue). - `@mastra/otel-exporter` 1.5.0 exports nothing. It loads its exporters with a dynamic import, that import fails, and the catch logs "exporter is not installed" and disables export. ESM and CommonJS, traces and logs, every protocol, including the install commands in the docs. 1.4.10 exports fine. - `import "@mastra/laminar"` crashes when installed next to `@mastra/otel-exporter`. Changes: - Move the OTLP exporters back to `^0.223.0`, the last SDK 2 release, in `@mastra/arize`, `@mastra/arthur`, `@mastra/laminar` and `@mastra/otel-exporter`. No source change. - Set `@opentelemetry/api` to `^1.9.0` in arize, arthur, laminar, otel-exporter and otel-bridge. The same Renovate bump had raised it to `^1.10.0`, and the SDK 2 packages need api below 1.10, so npm nested a second api copy under each of our packages. A 1.10 copy cannot see the tracer provider or the active span registered through the 1.9 copy (checked with a real two-copy install). In the monorepo pnpm keeps 1.10.0, so only the lockfile specifiers change. Declaring it in arize and arthur also keeps pnpm linking them to the same SDK instance as otel-exporter. - Widen otel-exporter's exporter `peerDependencies` from `^0.218.0`, which on 0.x only matches 0.218.x, to `>=0.218.0 <0.300.0`, so they agree with the optional dependencies. - Add a Renovate rule that holds the six OTLP exporters below `0.300.0` under `observability/*`. Renovate treats `0.22x -> 0.300` as a minor update, so the major-approval gate did not stop it. A second rule keeps the `@opentelemetry/api` ranges under `observability/*` as written and updates only the lockfile, because the repo-wide `bump` strategy is what raised them to `^1.10.0`. Remove both rules when `observability/*` moves to SDK 3 together. - Add the e2e suite `e2e-tests/npm-import`. It installs one template app per install shape (arize and arthur, otel-exporter, laminar, otel-bridge) with npm, not pnpm, imports and requires each package, checks that npm installs one `@opentelemetry/api` copy, and sends a real span through `OtelExporter` to a local server. It failed on the old manifests with the errors above and passes on the fixed ones. It runs in CI next to the sibling suites. ## Related issue(s) Fixes #29175 ## Type of change - [x] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Code refactoring - [ ] Performance improvement - [ ] Test update ## Checklist - [x] I have linked the related issue(s) in the description above - [x] I have made corresponding changes to the documentation (if applicable) - [x] I have added tests that prove my fix is effective or that my feature works - [ ] I have addressed all Coderabbit comments on this PR <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 Some packages used OpenTelemetry versions that did not work well together after a fresh npm install. This PR aligns their version ranges and adds checks for package loading, shared API installation, and trace export. ## What changed - Pins OTLP exporter dependencies to `^0.223.0` in `@mastra/arize`, `@mastra/arthur`, `@mastra/laminar`, and `@mastra/otel-exporter`. - Sets `@opentelemetry/api` to `^1.9.0` in the affected observability packages, including `@mastra/otel-bridge`. - Widens the six OTLP exporter peer dependency ranges in `@mastra/otel-exporter` to `>=0.218.0 <0.300.0`. - Adds Renovate rules to keep OTLP exporters below `0.300.0` and update the API lockfile without changing its declared range. - Adds an npm-import E2E suite that checks ESM imports, CommonJS requires, a single installed API copy, and HTTP/protobuf trace export. - Adds the suite to the E2E workflow and local registry publish configuration, and adds patch changesets for the affected packages. The supplied information does not establish test results. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
541819e6fa |
ci: install pnpm dependencies from StarSling Disks (#29130) | ||
|
|
8e73a43d3f |
ci: fail Merge Test Reports when a test job did not finish (#28964)
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
46c6a77d4c |
ci: give Affected UNIT 60 minutes for PRs that touch core (#28944)
## Summary The Affected UNIT job runs every test affected by a PR in one unsharded vitest run, capped at 20 minutes. When a PR changes `@mastra/core` or the stores, the affected set is nearly the whole repo. The full suite needs about 40 minutes of test time (4 shards of 10–15 min each on the latest main run), so these PRs get cancelled at 20 minutes with no failing tests. This happened on #28353 twice (~44,880 passing tests when cancelled) and on #28935. This raises the cap to 60 minutes. Small PRs are unaffected (they finish in 1–4 minutes). ## Test plan - One-line change to `timeout-minutes` on the Affected UNIT job in `.github/workflows/test-suite.yml`. - Verify by re-running Affected UNIT on #28353 after merge; it should complete instead of being cancelled. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 Some changes make the affected test job run many more tests than usual. This PR gives that job up to 60 minutes instead of 20, so it has more time to finish. ## Change - Set `timeout-minutes` to `60` for the `affected-unit-test` job in `.github/workflows/test-suite.yml`. The planned rerun to verify completion has not been reported. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
64b43eefcc |
ci: send Release PR test alerts to the recreated alerts channel (#28938)
Follow-up to #28937 (move Release PR test alerts out of #eng-maintainers-club). The alerts channel was recreated after that merged, so this swaps the one-line channel override in prebuild.yml to the new channel ID. Alpha publish alerts are unchanged. Workflow-only, no changeset. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 Release PR test alerts now go to the recreated Slack channel. The previous channel no longer receives these alerts. ## Change - Updated the channel ID in `.github/workflows/prebuild.yml` from `C0CD83111EX` to `C0CD83YFFNF`. - Alpha publish alerts are unchanged. - This workflow-only change has no changeset. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
0730fb40fa |
ci: send Release PR test alerts to #eng-release-alerts (#28937)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
aa120ea351 |
ci: include @mastra/observability in playground snapshots (#28875)
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
e9a658742a |
ci(release): publish npm packages in parallel, in dependency order (#28733)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
f1964c0256 |
ci(e2e): publish a single e2e-test dist-tag for every suite (#28688)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> |
||
|
|
a08f79873e |
ci(release): check out full history for stable publishes (#28685)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
29cb6c4867 |
ci: remove the E2E softwarefactory template job (#28686)
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> |
||
|
|
cb74894ef4 |
ci: only validate the changeset release plan when a PR adds changesets (#28563)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> |
||
|
|
ac0a24c2a8 |
docs: strengthen authoring guardrails and prose lint workflow (#28256)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
4c25a7c3f9 |
ci: run affected tests on regular PRs again (#28252)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
323c14179f |
chore(security): bump Node.js to 22.23.4 / 24.22.1 (CVE-2026-111497) (#28170)
Node.js Oct 2026 security release (v22.23.4 / v24.22.1): fixes Brotli
OOB write RCE CVE-2026-111497, TLS hostname-verification bypasses, dns
NUL truncation, eMudhra CA distrust, undici/OpenSSL/c-ares updates.
Bumps the Node pins in this repo: 24.22.1 for CI and the default E2B
template, 24.22.1 and 22.23.4 for the starter templates and the
otel-bridge example. `node:22-*` image tags stay floating, so they
resolve to the patched release on their own, and engine ranges are
unchanged.
⚠️ 24h soak rule: nodejs.org dist published 2026-10-21 10:33 UTC. Docker
`node:22.23.4-slim`/`-bookworm-slim` published 2026-10-21 17:38 UTC (24h
at 1:38 PM EDT Oct 22); `node:22.23.4-alpine` published 2026-10-22 02:39
UTC (24h at 10:39 PM EDT Oct 22). Do not merge before then.
After merge, images must be rebuilt and redeployed for the fix to take
effect.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
This PR updates Node.js versions used by CI, templates, and E2B sandbox
defaults. It brings them to the versions identified in the PR
description as security updates.
## Changes
- Updates Node.js 24 pins in GitHub Actions workflows and the setup
action from `24.22.0` to `24.22.1`.
- Updates the default Node.js version for E2B templates to `24.22.1`.
- Updates Node.js pins in two templates and an observability example to
`22.23.4` or `24.22.1`.
- Adds a test for the E2B default template’s version-based identity and
a patch changeset for `@mastra/e2b`.
The supplied change summary does not confirm updates to floating
`node:22-*` tags. It does not provide test results or current review
findings.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Justin Levine <20596508+jal-co@users.noreply.github.com>
|
||
|
|
0ed521db82 |
chore(deps): update github actions (#26814) | ||
|
|
10f27aa293 |
ci: stop repeated 'release PR green again' Slack alerts (#27890)
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
6f56ba3aa1 |
ci: prevent repeated release PR failure alerts (#27627)
Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
8ea568a973 |
ci: run the full test suite before alpha publishes (#27344)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com> |
||
|
|
0778bf739f |
ci: run the full test suite on the Changesets release PR (#27341)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
b5e6c8f61c |
ci(lint): use a blobless checkout for the npm package check (#27215)
## Problem The `New packages exist on npm` job in `lint.yml` checks out full history with every old file version (`fetch-depth: 0`, no filter). Across 182 runs on Oct 15, that checkout took a median of 95s and as long as 533s. On #27078 it took 8m53s, so the job hit its 10-minute timeout and GitHub cancelled it before the npm check ran ([run](https://github.com/mastra-ai/mastra/actions/runs/38685545054/job/116259426065)). ## Change Add `filter: blob:none` to that job's checkout, the same setting `Validate changeset packages` already uses (its checkout takes about 18s). The check still has the full commit history it needs, and old file versions are skipped. It only runs `git diff --name-only <base>...HEAD -- '**/package.json'`, which never reads old file contents, and pnpm reads package.json files from the working tree, which the checkout still provides. ## Testing I ran the check in a fresh `git clone --filter=blob:none` of this repo: - Replaying the PR that added `@mastra/sprites`, the changed-package check found exactly that package. With a mock registry that returns 404 for it, the check failed with the recovery instructions (exit 1). - The check never had to download old file versions: the local count stayed the same while it ran. - Checking all 163 publishable packages at `main` passed. - `yaml-lint` passes, and `actionlint` reports only the existing custom runner-label warnings. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 The npm check needs the project’s history to find new packages. It does not need old copies of every file, so this change skips downloading those old file contents and can make checkout faster. ## Summary - Added `filter: blob:none` to the `new-package-npm-check` checkout in `.github/workflows/lint.yml`. - Kept `fetch-depth: 0`, so the checkout retains full history. - Left the package-detection check unchanged. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com> |
||
|
|
4bb2f0ad72 |
feat(ci): fail PRs and publishes on packages missing from npm (#26721)
## Why Alpha.9 publish run 38152562840 published 7 packages, then failed partway through on the brand-new `@mastra/sprites` with `E404 PUT` / `ERR_PNPM_AUTH_TOKEN_EXCHANGE`. `npm-publish.yml` uses npm trusted publishing (OIDC) with no token fallback. npm only exchanges the job's GitHub OIDC token for a publish token if the package exists and has a trusted publisher matching this repo and workflow, and npm only allows a trusted publisher on a package that already exists. So a never-published workspace package, or an existing one with no trusted publisher (or one for another workflow), breaks the release after other packages have already gone out. Recovery took an npm org admin doing a manual first publish and an `npm trust` call, then a rerun. ## What - **`.github/scripts/check-npm-packages-exist.mjs`** checks that every non-private workspace package exists on npm, using anonymous registry reads (works in PR workflows without secrets). `--since <ref>` limits the check to packages whose `package.json` changed, which catches new packages and private→public promotions. `--retry-404` waits out registry propagation delay. A registry it can't reach (exit 2) is reported separately from a missing package (exit 1), so registry flakiness is never reported as a missing package. - **Trusted-publishing check (`--oidc`, publish jobs only; new in this PR)**: for every package in scope, the script requests a GitHub OIDC token (audience `npm:registry.npmjs.org`) and POSTs it to `/-/npm/v1/oidc/token/exchange/package/<name>`. This is the exchange pnpm 11 and npm 11 perform at publish time (endpoint and request shape taken from pnpm 11.21's `publish/oidc/authToken.js` and npm 12.2's `lib/utils/oidc.js`). The token npm returns is discarded and never printed. A granted token proves npm accepts this job as the package's trusted publisher (repo, workflow and, if the publisher names one, GitHub environment). It does not prove the publish itself will be accepted: npm uses the same exchange for publish, stage publish and dist-tag, so a trusted publisher limited to staged publishing passes this check. The placeholder script below checks that permission when it configures or reads back trust. A refused exchange fails with the packages named and the fix (`scripts/npm-placeholder-publish.mjs` or `npm trust github … --file npm-publish.yml`). Registry or GitHub-token errors are reported separately as "could not verify". The check covers every package in scope, not just those with a new version, because stable and snapshot run it before versioning. All 163 current public packages already have a version published through trusted publishing. - **PR gate** (`lint.yml`, job *New packages exist on npm*): Changesets release PRs check every package. Other PRs only check packages whose `package.json` changed, and PRs that touch none make no registry calls. PR refs stay out of shell: routing is done with `if:` and the base ref is passed through `env:`. The gate has no OIDC token, so it only **warns** (`:⚠️:`, never fails) when a package exists but no version of it was ever published through trusted publishing. A fresh placeholder looks like that until CI's first publish. - **Publish check** in all four publish jobs (prerelease, stable, snapshot, playground-snapshot): existence check, then the trusted-publishing check. Each check makes one pass over every package, then re-checks only the missing or refused ones against one shared 5-minute deadline, which picks up a package or trusted publisher an admin fixed minutes ago. A failing job therefore takes about one retry window, however many packages fail. If every package is refused, which points to a misconfigured job rather than the packages, the check fails after the first pass. It runs before anything publishes, and for stable before the version commit is pushed to `main`. - **`scripts/npm-placeholder-publish.mjs`**: the recovery both checks point to. An npm org admin runs `node scripts/npm-placeholder-publish.mjs <package>` after `npm login`. For a never-published name it publishes an empty `0.0.0` placeholder (package.json + README, no code from any branch). It then configures trusted publishing for `npm-publish.yml` (with npm ^11.15.0, the first version with `--allow-publish`) and reads it back with `npm trust list`. It skips the setup when a usable trusted publisher is already present, and fails if npm doesn't report one afterwards. A trusted publisher for this repo and workflow is usable only if it allows publishing (`createPackage`; older settings with no permissions field count) and is not restricted to a GitHub environment, because the publish jobs declare none. A stage-only or environment-restricted one is reported with the `npm trust revoke --id` command to remove it, instead of being treated as configured. CI then publishes the real versions. Prereleases go out under `alpha`, so `latest` stays on the placeholder until the first stable release, and the placeholder's description and README point installers to `<package>@alpha`. The script refuses unknown or private names, an unreachable registry and a logged-out session, publishes nothing for a name already on npm, and supports `--dry-run`. CI-only change, so there is no changeset. ## Testing - `node --test .github/scripts/check-npm-packages-exist.test.mjs scripts/npm-placeholder-publish.test.mjs`: 37/37, all against local mock registries. Against the previous scripts, 12 of the 13 new tests fail, as does the tightened trust-configuration test. The one exception is the "no warning" test, which passes on both. - Trusted-publishing check: trust present (exchange granted), no trust (exchange refused, package named, fix printed), every package refused (points at the job), exchange endpoint unreachable (exit 2, not "no trust"), transient 503/429 recovery, GitHub token endpoint failing, missing `id-token: write`, and trust appearing within the retry window. Timing tests cover a run where every package is refused (fails in under a second with a 60-second window; the earlier per-package polling took 144 seconds) and 24 refused or 24 missing packages (about one 3-second window; per-package polling took about 7.6 seconds). The tests assert the request shape (audience, POST path, bearer token) and that no token appears in the output. - Placeholder script: runs the real `npm publish`, `npm trust github` and `npm trust list`, and asserts the uploaded tarball holds only `README.md` and `package.json` at 0.0.0, with the `@alpha` install pointer. Trust read-back is covered for already configured, configured but not reported back (fails), an existing package trusting another workflow, a stage-only publisher and an environment-restricted publisher (both fail with revoke steps; both were accepted before), and older settings with no permissions field (accepted). - **The token exchange has not been run against live npm with a real GitHub OIDC token.** That needs `npm-publish.yml` in mastra-ai/mastra, so the first real run will be the next publish. Locally, read-only: a fake id token sent to the live exchange endpoint gets `401 OIDC token exchange error - unauthorized`, which the check reports as refused (exit 1). Without `id-token: write` it exits 2. - Current main against live npm: all 163 publishable packages exist (exit 0), with no trusted-publishing warnings. - Incident replay (tree before the alpha.9 version commit, registry in its publish-day state): flags only `@mastra/sprites`. Running the placeholder script then publishes 0.0.0 and sets up trust, and the re-run check passes. - The PR that added sprites (#26650, which added the `@mastra/sprites` package) would have been flagged by the PR gate: of the 32 packages it changed, only sprites is flagged. - Live npm, read-only: `--dry-run` for an existing name and for a never-published name (nothing uploaded). - actionlint on `lint.yml` and `npm-publish.yml` (no findings besides the repo-wide custom runner labels); `yaml-lint` on both workflows; `oxfmt --check` on the scripts. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 This PR checks that packages exist on npm before release workflows use them. It also adds a script to prepare new packages for their first npm release. ## Changes - Added a pull request check. Changesets release PRs check all publishable packages. Other PRs check packages whose `package.json` changed. PRs that change no package manifests make no registry calls. - Added package-existence and trusted-publishing preflights to the prerelease, stable, snapshot, and playground-snapshot jobs. - Added optional `--oidc` checks. A successful token exchange shows that npm granted the job a token; it does not prove that the token has publish permission. Without OIDC, the check warns when a package has no version previously published through trusted publishing. - Added retries for missing packages and refused token exchanges, using a shared deadline. The check stops polling when every package’s first OIDC exchange is refused. - Added `scripts/npm-placeholder-publish.mjs`. It can publish a public `0.0.0` placeholder and configure trusted publishing. It rejects unknown, private, already-published, unverifiable, or unauthenticated cases, and supports `--dry-run`. - Added tests for the package checks and placeholder-publishing flows. - The PR objectives report 37/37 tests passing against local mock registries and workflow and script lint checks. These results were not independently verified. - The PR objectives report that live npm token exchange with a real GitHub OIDC token has not yet been tested. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com> |
||
|
|
32e92b3cb0 |
ci: speed up the release versioning checkout with a partial clone (#26976)
## Summary The **Version Packages** workflow (and **Cron Alpha Publish**, which uses the same pattern) re-checks out the repository with the app token and `fetch-depth: 0`, so Changesets can find the commit that added each changeset for changelogs. That full-history fetch downloads every historical version of every file and took **137s** in [this run](https://github.com/mastra-ai/mastra/actions/runs/38520173688/job/115707828838), which is most of the job. This adds `filter: blob:none` to that checkout. The clone keeps the full commit graph and all trees, so history lookups work unchanged. Old file contents are fetched on demand only if something reads them. `lint-docs.yml`, `prebuild.yml` and others already use the same setting. ## Verification (local, against mastra-ai/mastra) - `--filter=blob:none` full-history clone of `main`: **9s**, 60 MiB, all 21k commits - `git log --diff-filter=A --max-count=1 --pretty=format:%H:%P -- <changeset>` (what `@changesets/git` runs) returns identical results to a full clone for every pending changeset, with no on-demand blob fetches - `@napi-rs/simple-git` (used by `changesets-changelog-github-local`) opens the partial clone (`repositoryformatversion = 1`), reports it as not shallow, and reads commit messages - Reading an old file version (`git show <old>:package.json`) still works via on-demand fetch - Steps after checkout (working-tree diffs, commit, rebase, push) don't need historical blobs <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 The release workflows need Git history to find changes, but they do not need every old file version. This change lets them download the history first and fetch old file data only if needed. ## Changes - Added `filter: blob:none` to the full-history, app-token checkout in the Cron Alpha Publish workflow. - Added the same filter to the full-history, app-token checkout in the Version Packages workflow. - Kept `fetch-depth: 0` in both workflows, so both still fetch the full commit history. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
5409e9949b |
ci: speed up the remaining full-history checkouts with a partial clone (#26977)
## Summary Follow-up to #26976. Eleven more `actions/checkout` steps use `fetch-depth: 0`, which downloads every past version of every file. On this repo that full fetch takes over two minutes (137s in [Version Packages](https://github.com/mastra-ai/mastra/actions/runs/38520173688/job/115707828838)). This adds `filter: blob:none` to each one: the clone keeps every commit and tree, and old file contents download only if something reads them. `lint-docs.yml`, `prebuild.yml` and `changed-test-gate.yml` already use this setting. | Workflow | Checkouts | Why it needs history | |---|---|---| | `npm-publish.yml` | 4 (prerelease, enter prerelease, playground snapshot, snapshot) | changesets versioning/tagging | | `lint.yml` | 2 (changeset release plan, peer-deps check) | `changeset status --since`, `changeset version` | | `vitest-all.yml` | 2 | full history checkout | | `backport-auto.yml` | 1 | cherry-pick onto a release branch | | `regenerate-provider-registry.yml` | 1 | commit + push to main | | `sync_renovate-changesets.yml` | 1 | `git diff --name-only base..HEAD` | The stable release job in `npm-publish.yml` is left as is: it starts shallow and deepens on purpose. ## Verification (local, against mastra-ai/mastra) - Partial full-history clone of `main`: 9s, all 21k commits - Changesets commit lookups match a full clone, with no on-demand blob fetches - `git cherry-pick -x` (what the backport script runs) works on a partial clone, fetching the blobs it needs on demand - On-demand fetches work without credentials, so checkouts with `persist-credentials: false` are fine (public repo) - `git diff --name-only` between commits needs only trees - All edited workflow files parse as YAML <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 These workflows need the project’s full commit history, but they do not need every old file downloaded at the start. This change makes Git fetch old file contents only when a workflow needs them, which can reduce checkout time and data use. ## Summary - Added `filter: blob:none` to 11 full-history checkouts across six GitHub Actions workflows. - Kept `fetch-depth: 0`, so the workflows retain full commit history. - Left the stable release checkout unchanged. ## Testing - No test results were provided. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
6cf79e92cd |
ci: close the stale release PR after cron alpha versioning (#26964)
## Summary Two workflows version the same changesets: - `version-packages.yml` runs on every push to main and uses `changesets/action` to maintain the `changeset-release/main` branch and its release PR. - `cron-alpha-publish.yml` runs twice a day, versions the changesets directly on main, and pushes the result straight to main. After the cron pushes, the release PR still carries its own version commit for the same changesets, so it conflicts with main (for example, #26699). `changesets/action` doesn't repair it: in alpha mode it ignores changesets already listed in `.changeset/pre.json`, so after the cron there are no changesets left and the action does nothing. This PR makes Version Packages clean up after itself: - **Close stale release PR:** when `changesets/action` reports `hasChangesets == 'false'`, the workflow deletes `changeset-release/<branch>` if it exists, which closes the PR. The next push to main that adds a changeset opens a fresh release PR from main. - **Concurrency group** (`version-packages-<ref>`, `cancel-in-progress: true`): an older run can never finish after a newer one, so a release branch built from stale main can't come back after the delete. Only the newest main matters, since each run rebuilds or closes the release PR from it. Every cron version commit already triggers its own Version Packages run (it's pushed with the app token), so that run performs the cleanup. `cron-alpha-publish.yml` is unchanged. ## Test plan - [x] The workflow YAML parses; `cron-alpha-publish.yml` is identical to main. - [x] Checked that the last cron version commits each triggered a Version Packages push run. - [x] Checked `changesets/action` at the pinned SHA: in pre mode, `hasChangesets` excludes changesets already in `pre.json`. - [ ] After the next cron run, confirm the Version Packages run on its commit deleted `changeset-release/main` and the release PR closed. - [ ] After the next push to main that adds a changeset, confirm the release PR is recreated with no conflicts. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 When there are no changes left to release, the workflow removes the old release branch so its outdated pull request closes. A later change can then create a new release pull request. ## Changes - The workflow cancels an in-progress run when a newer run starts for the same Git ref. - The Changesets action now has the `changesets` step ID. - When `hasChangesets` is `false`, the workflow checks for `changeset-release/${{ github.ref_name }}` and deletes it if it exists. If it does not exist, the workflow logs that no branch needs deletion. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
8d74917480 |
ci: move StarSling jobs to Ubuntu 26.04 (#26801)
## ci: move StarSling jobs to Ubuntu 26.04 This PR moves every StarSling job in **mastra-ai/mastra** from Ubuntu 24.04 to Ubuntu 26.04 LTS on [StarSling Runners](https://starsling.dev). ### What changed - **Runner labels**: `starsling-ubuntu-24.04` replaced with `starsling-ubuntu-26.04`, and `starsling-ubuntu-24.04-2` with `starsling-ubuntu-26.04-2` (77 `runs-on` lines). - **Same size, same price**: 4 vCPU at $0.008/min and 2 vCPU at $0.004/min, as before ([instance types](https://docs.starsling.dev/runners/instance-types)). - **Nothing else**: no step, script or condition changes. `npm-publish.yml` and `discord-release.yml` stay on `ubuntu-latest`. ### Changes <details> <summary>30 files in <code>.github/workflows/</code></summary> - `.github/workflows/2027dev-evals.yml` - `.github/workflows/backport-auto.yml` - `.github/workflows/changed-test-gate-labeler.yml` - `.github/workflows/changed-test-gate.yml` - `.github/workflows/cron-alpha-publish.yml` - `.github/workflows/e2e-docs.yml` - `.github/workflows/e2e-experiment-worker.yml` - `.github/workflows/e2e-tests.yml` - `.github/workflows/flag-spam-comments.yml` - `.github/workflows/issue-pending-release.yml` - `.github/workflows/issue-triage.yml` - `.github/workflows/labeler.yml` - `.github/workflows/lint-docs.yml` - `.github/workflows/lint.yml` - `.github/workflows/major-version-check.yml` - `.github/workflows/mastracode-e2e.yml` - `.github/workflows/prebuild.yml` - `.github/workflows/regenerate-provider-registry.yml` - `.github/workflows/renovate.yml` - `.github/workflows/secrets.test-workspaces.yml` - `.github/workflows/sync-softwarefactory-template.yml` - `.github/workflows/sync-templates.yml` - `.github/workflows/sync_renovate-changesets.yml` - `.github/workflows/test-combined-stores.yml` - `.github/workflows/test-suite.yml` - `.github/workflows/test-workspaces.yml` - `.github/workflows/trigger-cloud-tests.yml` - `.github/workflows/upload-studio-r2.yml` - `.github/workflows/version-packages.yml` - `.github/workflows/vitest-all.yml` </details> ### What happens next Once merged, these workflows run on Ubuntu 26.04. To go back, revert this commit. Co-authored-by: starslingdev[bot] <248995740+starslingdev[bot]@users.noreply.github.com> |