Repository navigation
fix(showcase/mastra): add missing runtime routes for 3 dead-on-load demos (OSS-451) - #5881
Conversation
…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
📣 Social Copy GeneratorGenerate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.
|
Production Digest-Pinning AuditAll 41 services digest-pinned. Run 2026-07-09 13:39:29 PDT — 0 finding(s). |
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-telegram
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
Scope note —
|
6d22153 to
127b4a8
Compare
…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)
What
Adds the three missing per-demo CopilotKit runtime routes in the Mastra showcase integration:
src/app/api/copilotkit-a2ui-fixed-schema/route.tssrc/app/api/copilotkit-declarative-gen-ui/route.tssrc/app/api/copilotkit-agent-config/route.tsFixes 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 thelanggraph-pythonnorth-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 --allconfirms 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-chatpattern 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 defaultinjectA2UITooltotrue, butweatherAgentalready owns its owngenerate_a2uitool — serving them from the shared route would double-bind the tool. So the A2UI routes setinjectA2UITool: falseand pindefaultCatalogIdto the catalog the page registers (avoids "Catalog not found").agent-configis 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 buildcompiles all three into the route manifest (.next/server/app/api/copilotkit-*/route.js).POSTto each new route returns 400 (route resolves, handler runs) — identical to the flagshipcopilotkit-beautiful-chat— vs 404 for a nonexistent route. NogetLocalAgent returned nullinit error.Follow-ups (not in this PR)
declarative-hashbrown/declarative-json-renderare broken the same way but arestatus: unshipped(non-navigable); they + themanifest.yamlbyoc-*drift need reconciling before they can flip towired.