Repository navigation
Warn readers on deprecated V1 reference pages - #6517
Closed
ataibarkai wants to merge 2 commits into
Closed
ataibarkai wants to merge 2 commits into
ataibarkai wants to merge 2 commits into
Conversation
Contributor
Production Digest-Pinning AuditAll 41 services digest-pinned. Run 2026-08-16 22:21:38 PDT — 0 finding(s). |
ataibarkai
marked this pull request as ready for review
August 17, 2026 06:09
ataibarkai
requested review from
jpr5,
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
August 17, 2026 06:09
MikeRyanDev
added a commit
that referenced
this pull request
Aug 21, 2026
Moves docs and examples off the deprecated v1 runtime entrypoint, so a reader who follows a quickstart ends up with a runtime that can actually be probed (`GET /api/copilotkit/info`). **Stage 0** proves the target shape in a real running app; **Stage 1** propagates that proven code into the docs. 50 files. No file owned by #6517 or #6582 is touched (verified against the full ownership list). Stacks cleanly with #6618, which does the same for `showcase/integrations/**`. ## Stage 0 — `examples/shadcn`, proven live A textbook instance of the reported bug: a v1, POST-only route behind a `@copilotkit/react-core/v2` frontend. | | Before | After | | --- | --- | --- | | `GET /api/copilotkit` | **405** Method Not Allowed | 404 (correct: multi-route serves nothing at the bare basePath) | | `GET /api/copilotkit/info` | **404** — Next.js HTML 404, the path did not route at all | **200** | | `POST /api/copilotkit/agent/default/run` | n/a | **200**, chat turn renders in the UI | Exact `GET /api/copilotkit/info` body from the running app: ```json { "version": "1.61.2", "agents": { "default": { "name": "default", "description": "", "className": "BuiltInAgent", "capabilities": { "tools": { "supported": true, "clientProvided": true }, "transport": { "streaming": true }, "humanInTheLoop": { "interrupts": true } } } }, "audioFileTranscriptionEnabled": false, "mode": "sse", "threadEndpoints": { "list": true, "inspect": true, "mutations": false, "realtimeMetadata": false }, "a2uiEnabled": false, "openGenerativeUIEnabled": false, "telemetryDisabled": false } ``` (Captured before the `@copilotkit/*` bump in the same commit, hence `1.61.2`.) The model backend was aimock — `@copilotkit/aimock` 1.37.4, the same mock the `test / integration / docs` CI job uses — so the chat turn is real traffic through the migrated route with no live API key. ## Three findings that changed the shape of this work All three came from running the code rather than reading it, and all three affect every page Stage 1 touches. ### 1. The plan's canonical shape was deprecated, and that is where `hono` came from The prescribed snippet was `createCopilotEndpoint` + `handle` from `hono/vercel`. `createCopilotEndpoint` is a **deprecated alias** — this repo's own handler table in `docs/backend/runtime-endpoints.mdx` lists it under "Deprecated → use `createCopilotHonoHandler`". `createCopilotRuntimeHandler` serves the same multi-route mode (it is the default), returns a plain fetch handler, is not deprecated, and needs **no `hono` at all**: ```ts const handler = createCopilotRuntimeHandler({ runtime, basePath: "/api/copilotkit", }); export const GET = handler; export const POST = handler; ``` I first propagated the deprecated shape and then documented installing `hono` to make `hono/vercel` resolve under pnpm. Both are reverted in `720910833e`: `hono` was an artifact of the shape, not a requirement of the library. Verified by **deleting `node_modules/hono` outright**, not merely removing it from `package.json`, so a hoisted copy could not mask the result — `GET /info` → 200, `POST /agent/default/run` → 200, turn renders. No sidecar lists `hono` any more, so CI proves by construction that these snippets do not need it. ### 2. The multi-route runtime needs a frontend co-change, and the docs said otherwise Published `<CopilotKit>` still ships ```js useSingleEndpoint={props.useSingleEndpoint ?? true} ``` (verified in the `@copilotkit/react-core` 1.68.3 bundle), pinning the single-route transport. A multi-route runtime answers that envelope with **404 while `GET /info` still returns 200**, so the app looks connected. The runtime diagnoses it itself: > Received a single-route request envelope (`{ method: "..." }`) but this runtime is mounted in multi-route mode, so the request matched no route. If the frontend uses `<CopilotKit>` from `@copilotkit/react-core/v2`, pass `useSingleEndpoint={false}` — that provider defaults it to true. `backend/runtime-endpoints.mdx` — the authoritative page — said the opposite: that omitting the prop is safe on either provider because the client negotiates. True on `main` (#6605 removed the pin, merged today, unreleased) and **false in every published release**. `auth.mdx`, `custom-agent.mdx` and two quickstart callouts repeated it. All corrected: the pairing table now splits `<CopilotKit>` from `<CopilotKitProvider>` and says passing `{false}` is the forward-compatible choice — required now, harmless later. **This is a live docs defect independent of the migration.** So the v2 multi-route shape is *not* a drop-in for a v1 route: changing only the route file converts a working POST-only app into a broken one. ### 3. `showcase/shell`'s `@ts-ignore` is stale Its canonical route carries `// @ts-ignore — BuiltInAgent type mismatch with AbstractAgent, pending upstream fix`. `tsc --noEmit` passes without it on 1.68.3, so the docs snippets carry no suppression. Angular needs none of this: `provideCopilotKit` defaults its transport to `"auto"`. Those snippets are unchanged. ## The docs snippets now have a real CI gate The plan assumed there is no automated gate on `.mdx` snippets. There are two, and both mattered: - **`showcase/scripts/verify-shell-docs.ts`** asserts the *content* of titled fences, and for the two Claude SDK quickstarts it **requires** `ExperimentalEmptyAdapter` and `copilotRuntimeNextJSAppRouterEndpoint` — actively pinning those pages to v1. - **`scripts/doc-tests/{extract,run}.ts`** runs in CI (`test / integration / docs`): a fence tagged `doctest="component"` is extracted and typechecked with `tsc --noEmit` against real npm-installed deps. Exactly **one** fence in the whole docs tree opted in. **20 route snippets across 20 pages are now tagged `doctest="component"`** and typechecked in CI against real npm-installed packages. I had claimed the integration pages couldn't be doctested (path aliases, per-integration deps) — that was an assumption I never checked and it was wrong: 47 of 52 fences import nothing project-relative. Five harness defects blocked this and are fixed: - `extract.ts` wrote a fence title as a path without creating intermediate directories → ENOENT on any titled route fence. - `run.ts` derived the npm package name from the snippet directory; a catch-all leaf directory is literally `[[...slug]]`, which npm rejects. - `run.ts` looked for `doctest.json` only in the snippet's own directory while the sidecar is copied per page, so a nested snippet silently installed nothing and failed with "Cannot find module". - `extract.ts` found sidecars only in a page's own directory, which would have meant ~20 duplicated dependency lists; it now walks up to the docs root, so one shared list lives at `content/doctest.json`. - `run.ts` installed dependencies per snippet — **7:58** for 21 snippets against a 15-minute job timeout. Each dep set now installs **once** into `.doctest-output/.deps/<hash>` and is linked in: **0:45** cold. **Mutation-checked:** restoring the v1 import in a gated fence turns the run red (20 passed, 1 failed). My first attempt at this check was a silent no-op — the pattern missed because the fence is JSX-indented, and it "passed" misleadingly. The real check asserts the mutation reached the extracted snippet before trusting the result. `@ag-ui/*` has to be pinned to what the runtime expects (`@ag-ui/[email protected]`, `@ag-ui/[email protected]` for runtime 1.68.3). Unpinned, npm installs a newer `@ag-ui/client` and two `AbstractAgent` declarations collide: `separate declarations of a private property '_debug'`. **Seven fences are deliberately not gated**, un-tagged with reasons rather than left red: two are illustrative fences with placeholder identifiers (`myAgent`, `verifyJwt`), and five langgraph-family fences hit that same `_debug` collision via `@copilotkit/runtime/langgraph`, which pinning does not fix. **That one is a pre-existing package defect, not a migration regression** — I reconstructed the v1 form of the langgraph quickstart snippet verbatim from `origin/main`, typechecked it against identical deps, and it fails the same way. Those snippets have never typechecked against published packages. Worth filing; it is also what the ~220 `@ts-ignore` comments in `showcase/integrations` were papering over. ## A mistake worth recording A block regex scoped to the fence's opening indentation corrupted five quickstart pages: their fences open and close at *different* indentation, so the match ran past the closing backticks and re-indented the following `</Step>` / `</Tab>` into the code block. Reverted and redone with a line-oriented pass that never re-indents and re-emits the closing line verbatim. (A malformed `runner:` insertion on three a2ui pages was caught and redone the same way.) Every modified page is now checked structurally — fence-marker count plus every JSX structural line, indentation included, must be byte-identical to `HEAD`. That check found the corruption; a diff review had already missed it. ## Verification ``` pnpm tsx scripts/doc-tests/extract.ts -> 21 snippets pnpm tsx scripts/doc-tests/run.ts -> 21 passed, 0 failed (0:45 cold) vitest extract + verify-shell-docs -> 34 passed showcase/shell-docs: pnpm typecheck -> exit 0 showcase/shell-docs: pnpm lint -> exit 0 (pre-existing warnings only) showcase/shell-docs: pnpm build -> exit 0 examples/shadcn: tsc --noEmit / eslint / next build -> all clean, route ƒ /api/copilotkit/[[...slug]] structural audit -> every modified page, fence + JSX identical to HEAD ``` CI was green on the previous head (35 pass / 3 skip), including `doc-tests` and `format`. This validates that the pages build and that the one doctested snippet compiles. **It does not execute the remaining 32 fences.** Their correctness rests on Stage 0: the boilerplate they now contain is the text that was run in `examples/shadcn`, and each page's agent wiring is untouched. `LangGraphAgent` + v2 `CopilotRuntime` + `createCopilotRuntimeHandler` were typechecked together against published 1.68.3, since many pages depend on that combination. ## What could not be migrated, and why | Page | Why | | --- | --- | | `agentic-protocols/mcp.mdx` (self-hosting section) | Built on `createMCPClient`, which exists only in v1 (`packages/runtime/src/lib/runtime/copilot-runtime.ts`). v2's equivalent is `mcpApps`; converting is a content rewrite, not a mechanical migration. | | `snippets/self-hosting-copilot-runtime-create-endpoint.mdx` | The whole page is templated on v1 service adapters (`{{adapterImport}}`, `{{adapterSetup}}`). v2 has no service adapters. Needs a rewrite of the page's premise. | | Pages Router / NestJS tabs in the `self-hosting-*` snippets | v2 exports no equivalent factory — only `createCopilotRuntimeHandler` and the Hono/Express/Node handlers. The App Router tab on each page **is** migrated. | | Node HTTP / Express tabs | v2 equivalents exist (`createCopilotNodeHandler`, `createCopilotExpressHandler`) but I have not run them, and the rule here was not to write a snippet I have not run. | | `custom-agent.mdx` (both copies) | Three fences each still call `createCopilotEndpoint` as `export default copilotEndpoint` — the Hono-app deployment pattern, not a Next.js route. Predates this PR; the documented replacement is `createCopilotHonoHandler`, which I have not run. The two copies have also drifted from each other. | Deliberate v1 *prose* is left alone: `backend/copilot-runtime.mdx`'s v1→v2 mapping table and `auth.mdx`'s note that the v1 adapter does not forward `hooks` are correct as written. ## Other out-of-scope gaps, recorded so they can be filed - **Mastra docs name `CopilotKitIntelligence`** but never document constructor, project, thread, or user wiring. - **The A2UI fixed-schema guide** depends on showcase helpers not published as a package, so it cannot be followed standalone. - **`showcase/shared/starter-template` is not a runnable app** — no `package.json`, `next.config`, or `tsconfig`, so its route cannot be proved by running it. It was the plan's Stage 0 target on the grounds that "the CLI scaffolds from it"; nothing in CopilotKit `packages/**` or `Intelligence/apps/cli/src` references it, so that rationale does not hold. Its route is still v1 and still exports a hand-rolled `GET` that fetches the *agent's* `/health` and shadows `/info`. Queued behind a decision on where that status payload should live. - **`@copilotkit/cli@latest` (0.0.6) has no `verify` command**, so the `runtime_reachable: pass` evidence the plan asked for cannot be produced with the public CLI. The Intelligence CLI's `verify` is the one that probes `<runtimeUrl>/info` (`apps/cli/src/services/verify-probes.ts`), and the Stage 0 app satisfies that probe with a 200 — but the public-CLI artifact does not exist to paste. - **Two generators still emit v1** and will re-seed the problem: `showcase/scripts/create-integration/index.ts` and `examples/showcases/chatkit-studio/apps/playground/src/utils/codeGenerator.ts`. ## Corrected counts The plan's figures were all low, partly because they matched only double-quoted imports. Measured on `origin/main` at `43f1ef3039`: | Surface | Plan said | Actual | | --- | --- | --- | | v1 code files (`examples/` + `showcase/`, excl. `examples/v1/**` and `_legacy/`) | 244 | **352** | | `showcase/**` importing `@copilotkit/runtime` | 229 | **289** | | Docs files touching the v1 entrypoint | 44 (37 in scope) | **22 (12 in scope)** — the plan counted only `from "@copilotkit/runtime"`; the real set is smaller but includes single-quoted and factory-only files it missed | | Mixed v1-runtime + v2-frontend pages | 20 | **26** | | Files already on `createCopilotEndpoint` | 10 | **43 call sites** | ## Remaining - **Docs:** 52 route fences across 40 pages are on the v2 shape, **20 of them gated in CI**. The two Claude SDK quickstarts are migrated now that #6618 has landed. 7 pages still reference v1, every one for a reason in the tables above (several are deliberate prose). - **Code:** `showcase/integrations/**` (239 files) is handled in **#6618**. `examples/v1/**` (12 files) is deliberately v1 and never in scope. The rest of `examples/` is not in either PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Contributor
|
Closing as obsolete. The v1 reference deprecation banner already landed on main in be7427e / 06a461e, driven by the shared |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before and after
Before is the current production V1 Groq reference page. After is this PR branch.
Desktop
Mobile
Summary
Why
CPK-7914 includes two blog links that correctly need the legacy Groq and Google Generative AI adapter references. Keeping those valid V1 destinations requires an unmistakable migration path to the maintained V2 docs.
Validation
npm run lint(passes; existing unrelated warnings remain)npm run typechecknpm run build/reference/v2and the notice is absent on V2npm test(full shell-docs suite)