Skip to content

fix(showcase/mastra): add missing runtime routes for 3 dead-on-load demos (OSS-451) - #5881

Merged
tylerslaton merged 5 commits into
mainfrom
mark/oss-451-mastra-demos-404
Jul 10, 2026
Merged

tylerslaton merged 5 commits into
mainfrom
mark/oss-451-mastra-demos-404

Conversation

@contextablemark

@contextablemark contextablemark commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds the three missing per-demo CopilotKit runtime routes in the Mastra showcase integration:

  • src/app/api/copilotkit-a2ui-fixed-schema/route.ts
  • src/app/api/copilotkit-declarative-gen-ui/route.ts
  • src/app/api/copilotkit-agent-config/route.ts

Fixes OSS-451 — three demos are dead on load in production (showcase-mastra-production).

Why (root cause)

Each of these demo pages sets <CopilotKit runtimeUrl="/api/copilotkit-<demo>">, but those route handlers were never created in the Mastra integration — the pages were mirrored verbatim from the langgraph-python north-star (which does have per-demo routes) without porting the backend routes. The client's runtime-info fetch 404'd → runtime_info_fetch_failed → the page never mounted. Deterministic, reproduces on every plain page load.

git log --all confirms these route dirs have 0 commits ever in Mastra; they arrived via the omnibus parity PRs #4280 / #5127.

Approach

Dedicated routes, mirroring the proven copilotkit-beautiful-chat pattern rather than repointing the pages at the shared /api/copilotkit. This is required for the two A2UI demos: they pass a client-side catalog, which makes the runtime default injectA2UITool to true, but weatherAgent already owns its own generate_a2ui tool — serving them from the shared route would double-bind the tool. So the A2UI routes set injectA2UITool: false and pin defaultCatalogId to the catalog the page registers (avoids "Catalog not found"). agent-config is a plain runtime that registers the exact agent id the page requests (agent-config-demo).

Zero page edits — the pages already point at these routes.

Scope

Page-load / 404 only, matching the ticket's explicit scope. These agents currently alias weatherAgent (consistent with how every other Mastra demo currently runs); full behavioral parity (dedicated Mastra agents that emit real A2UI operations / honor agent-config context) is tracked under OSS-381.

Verification

  • next build compiles all three into the route manifest (.next/server/app/api/copilotkit-*/route.js).
  • Runtime smoke against the built server: POST to each new route returns 400 (route resolves, handler runs) — identical to the flagship copilotkit-beautiful-chat — vs 404 for a nonexistent route. No getLocalAgent returned null init error.
  • Recommend a click-through in an aimock/real-LLM env before locking D5 regression coverage.

Follow-ups (not in this PR)

  • declarative-hashbrown / declarative-json-render are broken the same way but are status: unshipped (non-navigable); they + the manifest.yaml byoc-* drift need reconciling before they can flip to wired.
  • Preventing recurrence (a page→route/agent invariant in the pre-merge gate) ships as a separate PR.

…a, declarative-gen-ui, agent-config

Three wired demos 404'd on load: their pages point <CopilotKit runtimeUrl>
at /api/copilotkit-<demo>, but those route handlers were never created in the
Mastra integration (the pages were mirrored from langgraph-python without
porting the routes). The runtime-info fetch 404'd, so the page never mounted
(runtime_info_fetch_failed).

Add the three dedicated routes, mirroring the proven copilotkit-beautiful-chat
pattern. The two A2UI demos set a2ui.injectA2UITool:false (weatherAgent already
owns generate_a2ui — avoid a double-bind) and pin defaultCatalogId to the
catalog the page registers. agent-config registers the agent id the page
requests (agent-config-demo).

Page-load fix only; full behavioral parity (dedicated Mastra agents) is OSS-381.

Verified: next build compiles all three into the route manifest; POST returns
400 (route resolves) identically to copilotkit-beautiful-chat, vs 404 for a
nonexistent route.

Refs OSS-451
@linear

linear Bot commented Jul 8, 2026

Copy link
Copy Markdown

OSS-451

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

📣 Social Copy Generator

Generate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.

  • Generate social media copies

@github-actions

github-actions Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Production Digest-Pinning Audit

All 41 services digest-pinned.

Run 2026-07-09 13:39:29 PDT — 0 finding(s).

@pkg-pr-new

pkg-pr-new Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@copilotkit/a2ui-renderer

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/a2ui-renderer@5881

@copilotkit/agentcore-runner

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/agentcore-runner@5881

@copilotkit/angular

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/angular@5881

@copilotkit/channels

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/channels@5881

@copilotkit/channels-discord

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/channels-discord@5881

@copilotkit/channels-intelligence

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/channels-intelligence@5881

@copilotkit/channels-slack

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/channels-slack@5881

@copilotkit/channels-teams

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/channels-teams@5881

@copilotkit/channels-telegram

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/channels-telegram@5881

@copilotkit/channels-ui

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/channels-ui@5881

@copilotkit/channels-whatsapp

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/channels-whatsapp@5881

@copilotkit/core

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/core@5881

@copilotkit/react-core

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/react-core@5881

@copilotkit/react-native

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/react-native@5881

@copilotkit/react-textarea

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/react-textarea@5881

@copilotkit/react-ui

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/react-ui@5881

@copilotkit/runtime

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/runtime@5881

@copilotkit/runtime-client-gql

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/runtime-client-gql@5881

@copilotkit/sdk-js

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/sdk-js@5881

@copilotkit/shared

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/shared@5881

@copilotkit/sqlite-runner

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/sqlite-runner@5881

@copilotkit/voice

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/voice@5881

@copilotkit/vue

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/vue@5881

@copilotkit/web-components

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/web-components@5881

@copilotkit/web-inspector

pnpm add https://pkg.pr.new/CopilotKit/CopilotKit/@copilotkit/web-inspector@5881

commit: 04dbc1d

@contextablemark

Copy link
Copy Markdown
Contributor Author

Scope note — demoAgentNames cleanup reverted (defer to #5798)

An earlier commit here also cleaned up the base /api/copilotkit route's demoAgentNames (removed the now-dead agent-config / declarative-gen-ui / a2ui-fixed-schema aliases) and greened the pre-existing-red demoAgentNames.parity.test.ts. I've reverted that (6d22153) to keep this PR conflict-free.

Why: #5798 (OSS-381/OSS-384 reasoning + streaming work, open) edits the exact same two files —

  • src/app/api/copilotkit/route.ts (demoAgentNames)
  • tests/vitest/demoAgentNames.parity.test.ts (WELL_KNOWN_EXCLUDES)

— and would textually conflict. #5798 is already reconciling that registry (it also registers the reasoning-default / reasoning-custom agents), so the cleanup belongs there as the union of both exclude sets. The hand-off list is captured in the OSS-384 comment.

This PR is now scoped to just the dead-on-load fix: the 3 new dedicated routes (copilotkit-{a2ui-fixed-schema,declarative-gen-ui,agent-config}). No overlap with #5798, which adds different routes (a2ui-recovery, background-agents, browser-use, observational-memory).

(One incidental 1-line change remains in builtAgents.types.test.ts — lefthook's linter converted buildAgents to a type-only import and keeps re-applying it; it's stricter-correct and harmless.)

@contextablemark
contextablemark force-pushed the mark/oss-451-mastra-demos-404 branch from 6d22153 to 127b4a8 Compare July 9, 2026 05:05
@tylerslaton
tylerslaton merged commit 58dedc7 into main Jul 10, 2026
21 checks passed
@tylerslaton
tylerslaton deleted the mark/oss-451-mastra-demos-404 branch July 10, 2026 04:05
contextablemark added a commit that referenced this pull request Jul 10, 2026
…check) [OSS-451 prevention] (#5884)

## What

Adds a pre-merge guard that prevents the
[OSS-451](https://linear.app/copilotkit/issue/OSS-451) **dead-on-load**
failure class from recurring:

- `showcase/scripts/validate-runtime-routes.ts` — static validator +
`validate-routes` npm script
- `showcase/scripts/__tests__/validate-runtime-routes.test.ts` (+
fixture integration) — regression coverage
- `.github/workflows/showcase_validate-wiring.yml` — runs it on every
`showcase/integrations/**` PR

> **Stacked on #5881** (the fix). Base branch is
`mark/oss-451-mastra-demos-404`; retarget to `main` once #5881 merges.
The guard is green *because* #5881 is present.

## Why

OSS-451 shipped because **nothing linked a demo page's `runtimeUrl`
string to the existence of the `/api` route it names.** The only
automatic pre-merge gate for `showcase/**` is `showcase_build_check.yml`
— a Docker *build* — and a page that references a non-existent route
compiles perfectly cleanly. So three demos went dead-on-load in
production undetected (the e2e specs that *would* have caught it run
on-demand only, post-deploy, and exclude TS-only Mastra).

## How it works

For every **shipped** demo — a demo directory whose slug is in its
integration's `manifest.yaml` `features` — the validator asserts every
`runtimeUrl` it declares resolves to a real route dir under
`src/app/api/`.

- Unshipped / experimental demos (not in `features`) and
`not_supported_features` are **skipped** — they aren't claimed to work,
so they don't fail the gate. Promoting one into `features` immediately
starts enforcing it (this is the safety net for the still-unshipped
`declarative-hashbrown` / `declarative-json-render`).
- A `validate-runtime-routes.baseline.json` can grandfather pre-existing
violations (same pattern as the pin-drift `fail-baseline.json`). **The
fleet is currently clean — 0 violations, no baseline needed.**
- Handles the shared `/api/copilotkit` route and catch-all routes
(`copilotkit-auth`, `copilotkit-voice`) by asserting the top-level route
dir exists.

## Verification

- `npm run validate-routes` → clean across all 21 integrations.
- Removing the 3 OSS-451 routes locally → the guard flags **exactly
those 3** and exits 1; restoring → exits 0.
- Regression test (5 cases): flags the shipped-demo-with-missing-route
shape, passes shared + dedicated routes, skips unshipped.
- Full `showcase/scripts` vitest suite: **2151 tests green**.
- Workflow YAML validated; actions pinned to SHA; `contents: read` only;
no secrets.

## Follow-up for a maintainer
Add **"Showcase: Runtime-Route Wiring (PR)"** to the branch-protection
required checks so it blocks merge like the build check does.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants