Repository navigation
fix: stale useCoAgent node name, silent content-part drops, and the LangGraph docs gaps - #6520
Conversation
|
Size Change: +980 B (+0.07%) Total Size: 1.32 MB 📦 View Changed
ℹ️ View Unchanged
|
Production Digest-Pinning AuditAll 41 services digest-pinned. Run 2026-08-17 15:29:47 PDT — 0 finding(s). |
c16f413 to
f6f3a5d
Compare
|
Size Change: +345 B (+0.03%) Total Size: 1.32 MB 📦 View Changed
ℹ️ View Unchanged
|
f6f3a5d to
24ed6f0
Compare
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@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: |
MikeRyanDev
left a comment
There was a problem hiding this comment.
Requesting changes for two material documentation correctness issues. The runtime changes and their tests look sound, but the new AWS guide is built around an obsolete platform limitation, and the thread-authorization section misstates the current Intelligence runtime ownership contract.
| ## Start here: pick the right front door | ||
|
|
||
| <Callout type="warn" title="API Gateway cannot stream"> | ||
| Neither API Gateway REST APIs nor HTTP APIs support response streaming. They buffer the |
There was a problem hiding this comment.
Blocker: this is no longer true. API Gateway REST APIs added response streaming in November 2025, and the current Lambda docs explicitly support streaming through an API Gateway proxy integration using InvokeWithResponseStream. REST streaming also supports timeouts up to 15 minutes and payloads larger than 10 MB, so the table and the entire “API Gateway (no streaming)” section (including its 10 MB/29-second constraints) now recommend the wrong architecture. HTTP APIs are a separate case. Please split REST from HTTP and document the REST streaming configuration. AWS sources: https://aws.amazon.com/about-aws/whats-new/2025/11/api-gateway-response-streaming-rest-apis/ and https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html
There was a problem hiding this comment.
Correct, and the whole section was built on the pre-November-2025 limitation. Rewritten in 91b3e63: REST and HTTP are now split, with REST documented as a streaming front door — responseTransferMode: STREAM on an AWS_PROXY integration pointed at 2021-11-15/.../response-streaming-invocations, plus a payload-format-1.0 event adapter since REST proxy does not send the 2.0 shape a Function URL does. The buffered serverless-http section is now scoped to HTTP APIs and ALB, which still have no streaming path.
Added the constraints that matter for chat specifically: the 30-second idle timeout on edge-optimized endpoints (5 minutes Regional/private), the integration timeout going to 15 minutes, and the console Test tab always buffering so a working config looks broken there.
|
|
||
| ### Filter the thread list | ||
|
|
||
| `threads/list` has no `threadId` to check — it returns whatever the configured store holds. On the Enterprise Intelligence Platform, threads are scoped to a project, so every user of one project sees that project's threads. If your product needs per-user thread lists, either give each user their own project scope, or build the list from your own ownership table and drive the chat with the selected id rather than rendering the platform list directly. |
There was a problem hiding this comment.
Blocker: this is not the current Intelligence contract. The runtime resolves identifyUser(request) server-side, then passes that resolved user id to listThreads, message/event/state reads, mutations, and the thread subscription token; list is also filtered by agentId. In other words, the platform path is already user-scoped by the runtime rather than exposing every project thread to every user. Please scope the DIY ownership-table/onBeforeHandler pattern to non-Intelligence or custom stores, and document identifyUser as the platform binding instead of telling Intelligence users to reimplement ownership. Relevant paths: packages/runtime/src/v2/runtime/handlers/shared/resolve-intelligence-user.ts and packages/runtime/src/v2/runtime/handlers/intelligence/threads.ts.
There was a problem hiding this comment.
Correct. Verified in resolve-intelligence-user.ts and intelligence/threads.ts: identifyUser is required for the web surface, resolved server-side per request, and the id flows to run, connect, the message/event/state reads, the mutations, and the subscription join token, with listThreads scoped by user and filtered by agentId. The "every user of one project sees that project's threads" line was simply wrong.
Rewritten in 91b3e63 to lead with a runtime routing table, document identifyUser as the platform binding (linking to the canonical /threads-lifecycle#scope-rich-threads-to-the-signed-in-user rather than duplicating it), and scope the ownership-table/onBeforeHandler pattern to SSE runtimes, custom stores, and the local in-memory runner — the one path where listThreads really does filter by agentId alone.
MikeRyanDev
left a comment
There was a problem hiding this comment.
The API Gateway correction is accurate and resolves the AWS blocker. One security-critical correctness issue remains in the revised thread-authorization guidance: the current event/state read path resolves the user but does not pass that identity to the Intelligence platform. The docs must not promise complete per-user scoping until those routes are actually scoped or explicitly guarded.
| }); | ||
| ``` | ||
|
|
||
| That resolved id is applied to `agent/run`, `agent/connect`, the thread message, event, and state reads, `threads/update`, `threads/archive`, `threads/delete`, and the token minted for the thread subscription. `threads/list` is scoped by the resolved user *and* filtered by `agentId`, so `useThreads` returns the caller's threads rather than every thread in the project. |
There was a problem hiding this comment.
Blocker — correction to my earlier review: identifyUser does not currently scope the event and state reads. handleGetThreadEvents and handleGetThreadState resolve the user, but then discard it and call getThreadEvents({ threadId }) / getThreadState({ threadId }); the client hits project-authenticated /api/_inspect/threads/:id/{events,state} endpoints with no userId. The tests explicitly assert that threadId-only call shape. As written, this security guide tells Intelligence users there is no ownership check to build while a caller who learns another user thread ID can still reach these two routes. Please either carry the resolved user through and enforce ownership platform-side (with tests), or explicitly exclude/guard these inspector routes in the documented onBeforeHandler pattern. The blanket every thread-bearing route / no ownership table guarantee is not safe to publish yet.
There was a problem hiding this comment.
Confirmed, and the guarantee was mine to get right — good catch before it published. Verified: handleGetThreadEvents and handleGetThreadState resolve the caller and then drop it, and the platform client takes no userId on either method (client.ts:1113/1135), unlike getThreadMessages at 1063 which appends it as a query param. So the _inspect endpoints are project-scoped and the exposure is broader than one leaked id — any caller identifyUser accepts can read any thread in the project given its id.
Fixed in 240672f with your second option: the blanket claim is replaced by a per-route table marking threads/events and threads/state explicitly unscoped, plus a warn callout carrying the onBeforeHandler guard narrowed to those two routes. I did not take the first option — carrying the user through needs a platform-side _inspect change plus matching runtime/client work and tests, which is a runtime security fix rather than something to land inside a docs PR. Happy to open a ticket for it if one does not exist.
One correction while verifying: there is no threads/delete route (delete is DELETE on threads/update), and the table reflects that.
MikeRyanDev
left a comment
There was a problem hiding this comment.
The event/state correction is accurate, but the revised security guidance still omits another user-unscoped thread operation: agent/stop. Because the documented guard covers only event and state reads, one caller can still stop another user active run by thread ID.
|
|
||
| ```ts | ||
| onBeforeHandler: async ({ route }) => { | ||
| if (route.method !== "threads/events" && route.method !== "threads/state") return; |
There was a problem hiding this comment.
Blocker: the unscoped-route list is still incomplete. agent/stop never calls identifyUser or resolveIntelligenceUser. handleStopAgent goes directly to runtime.runner.stop({ threadId }), and IntelligenceAgentRunner.stop aborts its locally tracked run by threadId alone. Therefore any authenticated user who learns another user thread ID can stop that active run; if an application incorrectly relies on identifyUser as its only authentication backstop, this route does not invoke it at all. That also makes the statement that every route resolves the caller false. Please add agent/stop to the No row and to the targeted ownership guard (or scope it in the runtime), and clarify that onRequest is the universal authentication gate. Guarding only threads/events and threads/state leaves a real cross-user operation exposed.
useAgentNodeName tracked the current node in a ref and returned nodeNameRef.current. Mutating a ref schedules no render, so a component reading useCoAgent().nodeName kept showing whichever node was current at its last render and never updated on its own -- it only appeared to work when something unrelated happened to re-render it. Backing the value with state fixes that. Adds the coverage the hook never had: transitions, run-start reset, run-error, and unsubscribe on unmount. Note this does NOT explain GH #1426 (interrupt agentMetadata.nodeName reporting the previous node). useInterrupt only evaluates the `enabled` predicate from a useEffect/useMemo keyed on its `pending` state, so the interrupt's own state update always forces a render before the predicate runs -- and the pre-fix code reads the ref correctly at that point. That report needs a different explanation; it is left open. Refs #1426 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
normalizeMessageContent maps array content and handles only "text" and
"binary" parts. Any other part -- the {"type": "image", ...} case from
#1748 -- maps to "" and is filtered out with no signal at all, so an
agent emitting structured content sees its output silently vanish.
Carrying those parts through needs an AssistantMessage schema change and
is tracked separately in OSS-767. This makes the current drop visible in
the meantime, once per unrecognised part type so streaming does not flood
the log.
Refs #1748
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The generic adapter guide covers Lambda only by implication, and the part that actually bites is undocumented: API Gateway and ALB buffer responses, so a chat runtime behind either appears to hang for the whole agent run and then dumps the reply at once. Documents the Function URL + RESPONSE_STREAM path as the default, with the awslambda.streamifyResponse wiring that bridges the runtime's Fetch Response into the Lambda response stream, and keeps the serverless-http/API Gateway path for the cases that genuinely do not stream. Closes #1151 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
auth.mdx covered token forwarding and the onRequest gate but stopped at authentication. Nothing tied a threadId to a user, so a caller who learned another user's thread id could reach it through every thread route. Adds the ownership-table pattern and the onBeforeHandler enforcement point, including which routes carry threadId on `route` versus in the request body, and why the thread list has to be filtered server-side. Closes #2241 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
#6090 asked how to point CopilotKit threads at a different database. There is no such extension point, and nothing said so — the honest answer is that Rich Threads are an Enterprise Intelligence Platform capability, and the DIY path is own-the-threadId plus framework-layer persistence. Documents that path and what it costs relative to Rich Threads. Body lives in a shared snippet with the usual per-framework wrappers, since the nav parity contract requires every authored framework to publish the page and every React destination to map to an Angular one. Closes #6090 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Only adjacent coverage existed — the AG-UI middleware guide and a third-party governance cookbook — so #3414's question about input/output screening had no first-class answer. Covers the built-in PIIMiddleware first, then custom AgentMiddleware for input screening (before_model + jump_to), output and DLP screening (wrap_model_call), and tool-call screening, plus why guardrails must be ordered ahead of CopilotKitMiddleware. Closes #3414 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
mcp.mdx treated all non-App MCP servers generically, leaving #5991's question unanswered: readers could not tell whether their server needed a UI resource at all. Separates the three cases — read-only context servers (no renderer needed), action servers (renderer plus human-in-the-loop approval), and interactive MCP Apps — with the test for choosing between them. Closes #5991 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Two review corrections. API Gateway REST APIs gained Lambda response streaming in November 2025 via responseTransferMode: STREAM, which also lifts the 10 MB payload cap and the 29-second integration timeout. The guide claimed no API Gateway type can stream and steered readers to a buffered serverless-http setup. Split REST from HTTP, document the REST streaming path (payload format 1.0 adapter, AWS_PROXY integration on the response-streaming-invocations URI, CLI/CDK/SAM config), and scope the buffered fallback to HTTP APIs and ALB, which still have no streaming path. The thread-authorization section told every reader to build an ownership table and enforce it in onBeforeHandler. On the Intelligence path the runtime already resolves identifyUser(request) server-side and passes that user id to run, connect, the thread reads, the mutations, and the subscription token; listThreads is scoped by user and filtered by agentId. Document identifyUser as the platform binding and scope the DIY pattern to SSE runtimes, custom stores, and the local in-memory runner. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The revised thread-authorization section claimed the Intelligence runtime
scopes every thread-bearing route to the resolved user. It does not.
handleGetThreadEvents and handleGetThreadState resolve the caller through
identifyUser and then discard the result, calling getThreadEvents({
threadId }) / getThreadState({ threadId }). The platform client takes no
userId on either method — both hit project-authenticated _inspect
endpoints — so any caller identifyUser accepts can read the event log and
agent state of any thread in the project given its id.
Replace the blanket guarantee with a per-route table, and document the
onBeforeHandler guard narrowed to those two routes so the Intelligence
path is not told there is nothing to build.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
240672f to
383c3f6
Compare
The previous commit claimed every route resolves the caller through
identifyUser. It does not. handleStopAgent never resolves a user at all:
it calls runtime.runner.stop({ threadId }) directly, and
IntelligenceAgentRunner.stop looks the run up by threadId alone. Any
caller who learns an active threadId can abort that run mid-flight, and
an application relying on identifyUser as its authentication backstop is
not covered on this route because the callback is never invoked.
Audited every route on the Intelligence path rather than patching the one
that was reported. agent/stop is the only additional gap: agent/suggest
deliberately skips thread persistence, and threads/clear is a no-op off
the in-memory runner, which is the only runner exposing local thread
endpoints.
Drop the false universal-resolution claim, add agent/stop to the No row
and the targeted guard, and state plainly that onRequest is the
authentication gate while identifyUser only names an already
authenticated caller. The guard uses a switch rather than an array
membership test so route narrows and route.threadId type-checks; the
includes form fails with TS2339, verified against the real RouteInfo.
Refs OSS-851
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
MikeRyanDev
left a comment
There was a problem hiding this comment.
Re-reviewed the rebased exact head. All previous blockers are resolved: the AWS REST streaming guidance is current, Intelligence thread scoping is described accurately, the three unscoped thread operations (events, state, and stop) are explicitly guarded, and onRequest is correctly identified as the universal authentication gate. The rebased commit series is otherwise semantically unchanged. Focused docs tests and typecheck pass, and all current-head checks are successful or skipped.
|
Retroactive correction to this PR's description: the |
Bundles the CopilotKit-side work from OSS-769, OSS-767 (partial), and the unshipped remainder of OSS-609.
OSS-769 —
useCoAgent().nodeNamenever updatesuseAgentNodeNametracked the current node in a ref and returnednodeNameRef.current. Mutating a ref schedules no render, so a component readinguseCoAgent().nodeNamekept showing whichever node was current at its last render and never updated on its own — it only appeared to work when something unrelated happened to re-render it.Backing the value with state fixes it. Five lines, no API change.
Credit: this fix was diagnosed and submitted first by @aartisonigra in #4620 (2026-05-03), and this PR landed the same change without attributing it. The merged commit can't be rewritten to add a
Co-Authored-Bytrailer, so the credit is recorded here. The shipped version is @aartisonigra's change with two cosmetic follow-ups I'd asked for (dead ref removed, trailing newline) plus the tests the hook was missing.OSS-767 (partial) — silent content-part drops (#1748)
normalizeMessageContenthandles onlytextandbinaryparts; anything else — the{"type": "image", ...}case from the report — maps to""and is filtered out with no signal, so an agent emitting structured content sees its output vanish silently.This makes the drop visible, once per unrecognised part type so streaming doesn't flood the log. Deliberately not the schema change: carrying structured assistant content needs an
AssistantMessagedecision upstream inag-ui, which stays open on OSS-767.OSS-609 — the five docs gaps that never shipped
Gap #2 shipped in #6403; gaps 1, 3, 4, 5 and 6 did not.
docs/deploy/aws-lambda.mdxdocs/auth.mdx(new section)docs/threads-self-managed.mdxdocs/integrations/langgraph/guardrails.mdxdocs/agentic-protocols/mcp.mdx(new section)The Lambda guide leads with the constraint that actually bites — streaming is opt-in on every front door, so a chat runtime deployed with the defaults appears to hang for the whole run and then dumps the reply at once. It documents the Function URL +
RESPONSE_STREAMpath as the default, and API Gateway REST +responseTransferMode: STREAMfor anyone who needs a REST API in front.threads-self-managedfollows the existing shared-snippet pattern with per-framework wrappers, because two nav contracts require it: every authored framework must publish the page, and every React destination must map to an Angular one (ANGULAR_DOC_REDIRECTS). All nine wrappers were confirmed necessary by deleting one and watching the suite fail.Review corrections
Two blockers from @MikeRyanDev, both verified against primary sources before changing anything.
API Gateway REST APIs can stream (
91b3e632d5). The guide was built on the pre-November-2025 limitation and claimed no API Gateway type supports response streaming, steering readers to a bufferedserverless-httpsetup. REST gained it viaresponseTransferMode: STREAM, which also lifts the 10 MB cap and 29-second timeout. REST and HTTP are now split; REST is documented as a streaming front door (payload-format-1.0 event adapter,AWS_PROXYintegration on the2021-11-15/.../response-streaming-invocationsURI, CLI/CDK/SAM config), and the buffered fallback is scoped to HTTP APIs and ALB, which still have no streaming path. Added the constraints that actually matter for chat: the 30-second idle timeout on edge-optimized endpoints (5 min Regional), and the console Test tab always buffering so a working config looks broken.identifyUseris the platform's thread-scoping binding (91b3e632d5). The section told every reader to build an ownership table and enforce it inonBeforeHandler. On the Intelligence path the runtime already resolvesidentifyUser(request)server-side and carries that id to the platform;listThreadsis scoped by user and filtered byagentId, so the "every user of one project sees that project's threads" claim was wrong.identifyUseris now documented as the binding, and the DIY pattern is scoped to SSE runtimes, custom stores, and the local in-memory runner.Follow-up correction — two routes are genuinely unscoped (
240672ff56). My rewrite then over-claimed.handleGetThreadEventsandhandleGetThreadStateresolve the caller and discard it, and the platform client takes nouserIdon either method (client.ts:1113/1135) — unlikegetThreadMessagesat1063. Both hit project-authenticated_inspectendpoints, so any calleridentifyUseraccepts can read the event log and agent state of any thread in the project given its id. The blanket guarantee is replaced by a per-route table marking those two explicitly unscoped, plus anonBeforeHandlerguard narrowed to them.That is a live gap in shipped runtime code, not a docs error, and it is tracked as OSS-851 — a platform-side
_inspectchange plus matching runtime/client work and tests, out of scope for a docs PR. The interim callout inauth.mdxcomes out when OSS-851 lands.Not in this PR
OSS-772 and OSS-773 are already merged in
oss-path-to-production(#237, #238). Both are telemetry-sink changes with no CopilotKit-side component. OSS-773's remaining half — re-keying runtimedistinct_idfrom email to the Clerk subject — is recorded on the ticket as an open decision, not a task.Testing
OSS-769. New
use-agent-nodename.test.tsx, 5 tests. Against unmodifiedorigin/main, 4 of 5 fail:With the fix:
Tests 5 passed (5). These assert only re-render behaviour under normalact()flushing — no manufactured intra-batch window.Full react-core suite:
Tests 7 failed | 1496 passed (1503). All 7 failures are pre-existingResizeObserver is not a constructorunder jsdom, confined toCopilotChatView.pinToSendanduse-pin-to-send— neither of which this PR touches.Typecheck:
packages/react-core→tsc --noEmitexit 0, no output.OSS-767: 3 new tests covering the warn, warn-once-per-type, and no-warn-for-supported-types.
src/graphql/message-conversion/→Tests 125 passed (125).Docs:
showcase/shell-docs→Tests 1 failed | 373 passed (374). The single failure (channels-docs > publishes the Channels overview only through provider navigation) is pre-existing; baselining with all changes stashed reproduces it and nothing else. Re-run unchanged after both review-correction commits.Review corrections. The AWS rewrite was checked against the AWS sources rather than written from memory — the REST streaming announcement,
configuration-response-streaming,response-transfer-mode(endpoint-type idle timeouts, unsupported buffered-only features),response-streaming-lambda-configure(CLI/OpenAPI shapes), the CFNIntegrationreference, and the CDKResponseTransferModeenum. Two details corrected in passing:InvokeWithResponseStreamauthorizes against plainlambda:InvokeFunction(no new grant, contrary to what the streaming URI suggests), and ALB still has no Lambda streaming path.The auth corrections were verified by reading the handlers and the platform client, not the tests —
resolve-intelligence-user.ts,intelligence/threads.ts(everyresolveIntelligenceUsercall site), andintelligence-platform/client.ts. The existing tests assert thethreadId-only call shape, so they pass under the defect and could not have surfaced it. Also corrected: there is nothreads/deleteroute — delete isDELETEonthreads/update(fetch-handler.ts:606).Both edited pages MDX-compile clean, and all inbound
#thread-authorizationanchors still resolve after the h3→h4 demotions.Two nav tests broke during this work and are fixed rather than papered over — adding a page to the Rich Threads group violated the cross-framework ordering contract and the React→Angular parity contract:
All 15 internal links in the new pages resolve against the content tree.
Closes #1151, #2241, #3414, #5991, #6090
Refs #1748, OSS-851