You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cockpit-chat-debug): give the devtools State tab real state to show
The dock has two tabs and only one of them demonstrated anything. Its graph
was a plain MessagesState, and agent.state() projects messages out into the
transcript, so the State inspector printed an empty object no matter what the
run did — the page still promised it 'pretty-prints the agent's current state'.
The process node already computed the metrics; it just buried them in a
message. DebugState widens MessagesState with an analysis dict, so those
numbers land in state where the inspector can render them.
The fixture is now recorded from a real run rather than authored, and the
State spec asserts the analysis keys instead of merely asserting the
inspector renders some object — the shape the old comment said should widen
this tab's coverage rather than fail it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: apps/website/content/docs/chat/components/chat-debug.mdx
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,19 +22,25 @@ Before the first turn the Timeline tab shows its empty state: "No checkpoints ye
22
22
23
23
## How it is built
24
24
25
-
Three files carry the example: the graph that produces the checkpoints, the provider that points Angular at it, and the component that mounts the panel. Open the Code tab to read them in place.
25
+
The example is three files: the graph that produces the checkpoints, the provider that points Angular at it, and the component that mounts the panel. Open the Code tab to read them in place.
26
26
27
27
### A graph with several nodes per turn
28
28
29
-
The backend is deliberately multi-step, because one node per turn produces one checkpoint and very little to look at. `generate` answers with the model, `process`appends a synthetic message derived from the answer, and `summarize` asks the model for a one-sentence summary of the conversation so far. The system prompt read by `generate` frames the assistant as an aviation helper; the graph binds no tools, so every answer comes from the model alone.
29
+
The backend is deliberately multi-step, because one node per turn produces one checkpoint and very little to look at. `generate` answers with the model, `process`measures that answer and records the result, and `summarize` asks the model for a one-sentence summary of the conversation so far. The system prompt read by `generate` frames the assistant as an aviation helper; the graph binds no tools, so every answer comes from the model alone.
30
30
31
31
<ExampleCodefile="graph.py"region="pipeline-nodes"title="graph.py — the three pipeline nodes" />
32
32
33
33
Each node returns a partial state update, and each of those updates becomes a checkpoint on the thread.
34
34
35
+
### State the inspector can show
36
+
37
+
`agent.state()` is the LangGraph values bag with `messages` projected out into the transcript, so a graph that carries nothing but its messages leaves the State tab printing an empty object. This graph widens `MessagesState` with the metrics `process` computes, which is what gives the second tab something to inspect.
38
+
39
+
<ExampleCodefile="graph.py"region="debug-state"title="graph.py — the state the panel inspects" />
40
+
35
41
### Wiring the nodes into a linear pipeline
36
42
37
-
The nodes are registered on a `StateGraph` over `MessagesState` and chained: `generate` to `process` to `summarize` to `generate_title`, then to the end. `generate_title` is a background node that summarizes the first user message into a thread title; it returns an empty update, so it changes the message list not at all while still adding a step to the run.
43
+
The nodes are registered on a `StateGraph` over `DebugState` and chained: `generate` to `process` to `summarize` to `generate_title`, then to the end. `generate_title` is a background node that summarizes the first user message into a thread title; it returns an empty update, so it changes the message list not at all while still adding a step to the run.
38
44
39
45
<ExampleCodefile="graph.py"region="graph-wiring"title="graph.py — the compiled pipeline" />
0 commit comments