Commit 59dde92
feat(agent-builder): fast-followups — smoke-test skill alignment + product fixes (#17246)
## Summary
Agent Builder fast-followups. Two threads:
1. **Builder smoke-test skill (`.claude/skills/builder-smoke-test`)** —
bring docs, scaffolding, and scripts into sync with shipped Agent
Builder behavior so the next person running the skill can trust it.
2. **Server fix (`PLTFRM-1012`)** — make the favorites response shape
consistent across every read/write path on stored agents and skills.
Both threads fell out of a from-scratch run of the smoke test against
`origin/main`.
## Skill alignment (no runtime impact)
`3b5eb7ec` — 16 corrections from running the full smoke test:
- Scaffold template imports `createBuilderAgent` (factory). The old
singleton `builderAgent` export no longer exists.
- `stars` → `favorites` rename swept across SKILL.md, references,
endpoints (`/star` → `/favorite`), response fields
(`starCount`/`isStarred` → `favoriteCount`/`isFavorited`), and feature
flags.
- Picker docs corrected to use `.picker.visibleTools` etc. (were
top-level).
- Agent/skill shape: `model: { provider, name }`; skill attach is a
record map `{ id: {} }`, never an array; oversized avatar returns `413`
(not `400`); `favoriteCount` populated as `0` on create.
- Model policy jq path: `.configuration.agent.models`.
- `scaffold.sh` auto-writes `SMOKE_TEST_COOKIE_LEAK=1` for auth-on runs.
- `wait-for-server.sh` logs a tail-of-log hint when the dev server fails
to boot.
- Minor: registries always present with `enabled: false` (not omitted),
partial PATCH works, `/auth/me` returns `200 null` under `--auth off`.
`53b1504c` — agent view header only contains `Switch to Edit mode`. The
`Add to library` toggle lives on the **edit** page right panel, not the
view header.
`0abe10cf` — `/favorite` returns `401` or `404` under `--auth off`
depending on build (saw both across runs); skill now accepts either.
`stored/skills` create requires `description` alongside
`name`/`instructions`.
## Server fix — PLTFRM-1012
`6817aaca` — `fix(server): annotate isFavorited on stored agent/skill
POST + PATCH + publish`.
Before this commit, POST, PATCH, and (for skills) publish returned the
resolved storage row without running favorites enrichment, so
`isFavorited` was missing from the response, and under `--auth off`
`favoriteCount: 0` leaked through where GET would have stripped it.
### Response matrix
For a freshly-created, unfavorited entity on `/api/stored/agents/:id` or
`/api/stored/skills/:id`:
| Path | Auth-off (before → after) | Auth-on (before → after) |
| --- | --- | --- |
| POST | `favoriteCount: 0`, no `isFavorited` → **neither field** |
`favoriteCount: 0`, no `isFavorited` → **`favoriteCount: 0`,
`isFavorited: false`** |
| PATCH | `favoriteCount: 0`, no `isFavorited` → **neither field** |
`favoriteCount: 0`, no `isFavorited` → **`favoriteCount: 0`,
`isFavorited: false`** |
| Publish (skill) | same as PATCH | same as PATCH |
| GET | neither field (unchanged) | `favoriteCount: 0`, `isFavorited:
false` (unchanged) |
| LIST | neither field (unchanged) | `favoriteCount: 0`, `isFavorited:
false` (unchanged) |
| PUT/DELETE `/favorite` | 401/404 (unchanged) | `{ favorited,
favoriteCount }` (unchanged) |
After the fix, every read/write path on a single entity shares one
shape, so client code can read `response.isFavorited` directly without
an extra GET round-trip.
### Implementation
Adds `enrichOrStripFavorites(mastra, requestContext, entityType,
record)` to `favorites-enrichment.ts` — same shape as the existing
inline GET logic (run `prepareFavoritesEnrichment`; on hit, spread the
record and add `isFavorited`; on miss, `stripFavoriteFields`).
Applied at 6 call sites:
- `stored-agents.ts`: GET (refactored to use helper), POST return, PATCH
return.
- `stored-skills.ts`: GET (refactored to use helper), POST return, PATCH
return, publish return.
LIST handlers are unchanged — they already had the correct
strip-when-feature-off branch.
`starCount` / `isStarred` do not appear in any response shape. They
never did; the original ticket's "deprecated alias leakage" framing was
withdrawn during investigation.
## Verification
- `pnpm --filter @mastra/server test stored-agents stored-skills
favorites` → 131/131 pass.
- `pnpm build:server` clean.
- Live re-probe against `localhost:4111` on both auth modes, agent and
skill, confirms the matrix above.
- Full builder smoke test (32 tasks) ran twice against this branch —
auth-off (14 sections) + auth-on (15 sections) both green; reports at
`/tmp/builder-smoke-report.md` and `/tmp/builder-smoke-report-run2.md`.
## Linear
- [`PLTFRM-1012`](https://linear.app/kepler-crm/issue/PLTFRM-1012) —
fixed here.
- [`PLTFRM-1011`](https://linear.app/kepler-crm/issue/PLTFRM-1011) —
investigated and closed as not-a-bug during smoke-test run 2; the
auth-off favorite button is a properly disabled `<button disabled>` with
`cursor-not-allowed` and a sign-in aria-label. Skill docs corrected
accordingly.
## Test plan
1. Pull the branch.
2. `pnpm --filter @mastra/server test stored-agents stored-skills
favorites`.
3. Optional: run `.claude/skills/builder-smoke-test` end-to-end
(`scripts/scaffold.sh --auth off` and `--auth on --workos-...`) and
confirm all sections pass.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5
This PR updates the Agent Builder smoke tests and scaffolding to match
the shipped product, and fixes a server bug so "favorite" fields in API
responses are consistent whether you read or write an entity.
## Overview
Two concurrent threads:
1. Align the builder smoke-test skill docs, scripts, and templates with
shipped Agent Builder behavior (renames, docs, scaffold and script
fixes, UI/docs expectations).
2. Server fix (PLTFRM-1012): centralize favorites enrichment so
GET/POST/PATCH/publish single-entity responses present a consistent
favorites shape.
## Key Changes
### Builder smoke-test alignment
- Renamed "stars" → "favorites" across docs, references, endpoints,
feature flags, and tests; added new favorites.md reference.
- Documentation updates: picker allowlist path (.picker.visibleTools),
model-policy jq path (.configuration.agent.models),
registry/visibility/workspace/infrastructure/permissions clarifications,
UI expectations (Agent view header, Add to library placement).
- Skills/agents behavior documented: create now requires description +
name/instructions; partial PATCH supported; publish authoritative from
SKILL.md frontmatter; avatar uploads return 413 for oversized images;
favoriteCount initialized to 0 on create.
- Scaffolding/scripts: template uses createBuilderAgent() factory;
scaffold.sh now writes SMOKE_TEST_COOKIE_LEAK for auth-on runs;
wait-for-server.sh adds a log-tail hint for stale template imports.
- Feature flags: favorites enabled flags added; favorites endpoints
return 404 when feature disabled.
### Server — favorites consistency (PLTFRM-1012)
- New helper: enrichOrStripFavorites<T>(mastra, requestContext,
entityType, record) in
packages/server/src/server/handlers/favorites-enrichment.ts to
centralize either annotating records with isFavorited or stripping
favorite fields when enrichment is unavailable.
- Applied to stored-agents and stored-skills handlers: GET (single),
POST, PATCH, and skill PUBLISH responses now consistently use
enrichOrStripFavorites.
- List routes now strip favorite fields when enrichment is unavailable
instead of returning raw records.
- Responses from write endpoints (POST/PATCH/publish) now match GET
shape: include isFavorited when applicable or omit favorite fields per
feature/auth state.
## Verification
- Server tests for stored-agents, stored-skills, and favorites pass
(131/131).
- pnpm build:server completes cleanly.
- Builder smoke test ran successfully (twice) in both auth modes; live
probes confirm expected response matrix.
- PLTFRM-1012 resolved; PLTFRM-1011 investigated and closed.
## Notable files touched
- .claude/skills/builder-smoke-test/** (docs, templates, scripts)
- packages/server/src/server/handlers/favorites-enrichment.ts
- packages/server/src/server/handlers/stored-agents.ts
- packages/server/src/server/handlers/stored-skills.ts
- .changeset for `@mastra/server`
<!-- review_stack_entry_start -->
[](https://app.coderabbit.ai/change-stack/mastra-ai/mastra/pull/17246?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)
<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Mastra Code (anthropic/claude-opus-4-7) <noreply@mastra.ai>1 parent 7ed8985 commit 59dde92
21 files changed
Lines changed: 293 additions & 238 deletions
File tree
- .changeset
- .claude/skills/builder-smoke-test
- assets/template/src/mastra
- references
- scripts
- packages/server/src/server/handlers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| |||
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
392 | | - | |
| 392 | + | |
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
| 396 | + | |
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
510 | | - | |
| 510 | + | |
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
Lines changed: 162 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
0 commit comments