Skip to content

Commit 39b4ea6

Browse files
committed
docs: clarify client-side debug prop behavior
Updated JSDoc and troubleshooting docs to accurately describe that the client-side debug prop forwards config to the AG-UI transport layer, not CopilotKit's own logging. Removed fabricated console.debug output examples that don't exist.
1 parent 295a1e6 commit 39b4ea6

3 files changed

Lines changed: 15 additions & 32 deletions

File tree

.claude/docs/architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ debug: {
106106

107107
**Runtime:** Agent run started, SSE stream opened/completed/errored, every AG-UI event emitted (with Pino structured logger).
108108

109-
**Client:** SSE events received, event validation, chunk transformation, event verification, subscriber dispatch, run lifecycle. Uses `console.debug` via a centralized `DebugLogger`.
109+
**Client:** The debug configuration is forwarded to the AG-UI transport layer (`transformChunks`). CopilotKit itself does not currently emit client-side `console.debug` calls — the flag configures the underlying AG-UI event pipeline for transport-level debug output.
110110

111111
### Architecture
112112

docs/snippets/shared/troubleshooting/debug-mode.mdx

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,7 @@ Pass `debug={true}` to the `<CopilotKit>` provider:
6262
</CopilotKit>
6363
```
6464

65-
This produces `console.debug` output in the browser devtools, showing the event pipeline at each stage:
66-
67-
```
68-
[SSE] Event received: { type: "TEXT_MESSAGE_START" }
69-
[HTTP] Event validated: { type: "TEXT_MESSAGE_START", valid: true }
70-
[VERIFY] { type: "TEXT_MESSAGE_START" }
71-
[APPLY] Event applied: { type: "TEXT_MESSAGE_START", subscribers: 2 }
72-
```
65+
This forwards the debug configuration to the AG-UI client transport layer (`transformChunks`), which may produce transport-level debug output depending on the AG-UI library version. Note that the richest debug logging comes from the **server-side** `CopilotRuntime` — enable `debug: true` there for full structured Pino logs of every AG-UI event.
7366

7467
<Callout type="info">
7568
The server and client debug toggles are independent. Enabling debug on the client does not affect the server, and vice versa.
@@ -117,26 +110,21 @@ debug: { events: true, lifecycle: false, verbose: true }
117110

118111
### Events Not Reaching the Client
119112

120-
Enable debug on both sides:
113+
Enable debug on the server side for the most detailed visibility:
121114
1. Check server logs for `Event emitted` — are the expected events being sent?
122-
2. Check client logs for `[SSE] Event received` — are they arriving?
123-
3. Check `[HTTP] Event validated` — are any events failing validation?
124-
4. Check `[VERIFY]` — are events being rejected by the state machine?
125-
126-
### Events Being Dropped
127-
128-
Look for `[APPLY] Event dropped` in the client logs. This means a subscriber called `stopPropagation`, preventing the event from being applied to state.
115+
2. Verify `SSE stream completed` shows the expected `eventCount`.
116+
3. Use the browser Network tab to confirm SSE events are arriving over the wire.
129117

130118
### Tool Calls Not Executing
131119

132-
Enable debug and look for:
120+
Enable server-side debug and look for:
133121
1. `TOOL_CALL_START` events being emitted on the server
134122
2. `TOOL_CALL_ARGS` and `TOOL_CALL_END` events following correctly
135-
3. The events being validated and applied on the client
123+
3. Confirm the events appear in the SSE stream via the browser Network tab
136124

137125
### State Not Updating
138126

139-
Look for `STATE_SNAPSHOT` or `STATE_DELTA` events in both server and client logs. If they appear on the server but not the client, there may be a connection issue. If they appear on the client but state isn't updating, check for `stopPropagation` in the apply stage.
127+
Look for `STATE_SNAPSHOT` or `STATE_DELTA` events in server logs. If they appear on the server but not in the browser's SSE stream, there may be a connection issue.
140128

141129
## What Gets Logged
142130

@@ -152,18 +140,9 @@ Look for `STATE_SNAPSHOT` or `STATE_DELTA` events in both server and client logs
152140

153141
In **summary mode** (verbose off), event logs include key identifiers like `messageId`, `toolCallId`, `toolCallName`, `role`, and content lengths instead of full payloads.
154142

155-
### Client-Side Logs
156-
157-
Events pass through several pipeline stages. Debug mode logs at each one:
143+
### Client-Side
158144

159-
| Stage | Prefix | What's Logged |
160-
|-------|--------|---------------|
161-
| SSE Parser | `[SSE]` | Raw events received from the server |
162-
| HTTP Transform | `[HTTP]` | Stream format detection, event validation (valid/invalid) |
163-
| Chunk Transform | `[TRANSFORM]` | Chunk events expanded into START/CONTENT/END sequences |
164-
| Event Verification | `[VERIFY]` | Each event passing through the state machine validator |
165-
| Event Application | `[APPLY]` | Events applied to state, or dropped via `stopPropagation` |
166-
| Agent Lifecycle | `[LIFECYCLE]` | Run started, finished, or errored |
145+
On the client, the `debug` configuration is passed through to the AG-UI transport layer. The AG-UI client library controls what (if any) debug output is produced. CopilotKit itself does not emit `console.debug` calls — the debug flag configures the underlying AG-UI event pipeline.
167146

168147
<Callout type="warn">
169148
Debug mode can produce a large volume of log output, especially in verbose mode. Use it during development and debugging, not in production.

packages/react-core/src/components/copilot-provider/copilotkit-props.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ export interface CopilotKitProps extends Omit<
197197
enableInspector?: boolean;
198198

199199
/**
200-
* Enable debug logging for the client-side event pipeline.
200+
* Enable debug logging. On the server (`CopilotRuntime`), this enables
201+
* structured Pino logging of the AG-UI event pipeline. On the client,
202+
* this configuration is forwarded to the AG-UI transport layer
203+
* (`transformChunks`) for transport-level debug output.
204+
*
201205
* Pass `true` for full output, or an object for granular control:
202206
*
203207
* ```tsx

0 commit comments

Comments
 (0)