Summary
The TypeScript client's AgentResponse interface and the agentStreaming() switch still use the legacy chunk_type field, but the backend renamed it to message_type on 2026-04-13 in trustgraph-ai/trustgraph PR #795 ("Add agent explainability instrumentation and unify envelope field naming", commit d2751553).
Effect: every released trustgraph-flow from v2.3.1 onward (including v2.3.21 and all of v2.4.x) emits agent stream frames as {message_type: "thought" | "observation" | "answer" | …, content: …}. The client's switch on resp.chunk_type falls through the default case, so callbacks (think, observe, answer) are never invoked. Consumers like workbench-ui:1.8.2 get a stream of frames that silently produce no UI updates — the Assistant Agent / Graph RAG / Document RAG modes hang on "Processing chat message…" forever even though the backend completes the request with end_of_dialog=true.
Affected files
src/models/messages.ts:130-154 — AgentResponse declares both chunk_type (the active field used in the switch) and message_type?: \"chunk\" | \"explain\" (the old envelope distinguisher). They now collide semantically because the backend uses message_type for the full set thought | action | observation | answer | final-answer | explain | error.
src/socket/trustgraph-socket.ts:1400, 1406, 1426 — agentStreaming():
- error check: `if (resp.chunk_type === "error" || resp.error)`
- explain branch: `if ((resp.chunk_type === "explain" || resp.message_type === "explain") …)`
- main switch: `switch (resp.chunk_type) { case "thought": … case "answer": case "final-answer": … }`
Backend evidence
Backend trustgraph-base/trustgraph/messaging/translators/agent.py:
def encode(self, obj: AgentResponse) -> Dict[str, Any]:
result = {}
if obj.message_type:
result[\"message_type\"] = obj.message_type
...
Backend trustgraph-base/trustgraph/schema/services/agent.py:
@dataclass
class AgentResponse:
message_type: str = \"\" # \"thought\", \"action\", \"observation\", \"answer\", \"explain\", \"error\"
...
Grep across trustgraph-ai/trustgraph master: chunk_type is absent from all .py sources; only present in two design-doc translations under docs/tech-specs/{he,sw}/*.md.
Reproduction
- Deploy
trustgraph/trustgraph-flow:2.3.21 (post-rename) + trustgraph/workbench-ui:1.8.2 (bundles @trustgraph/client@1.7.x pre-rename).
- Open Workbench → Assistant → switch mode to Agent → send any question.
- Browser shows "Processing chat message…" indefinitely. Browser DevTools WS frames show 100+ messages each with
{message_type: ...} but no chunk_type field. Server-side gateway logs show the agent completed with end_of_dialog=true.
Suggested fix
Rename chunk_type → message_type consistently across AgentResponse and agentStreaming(), and drop the now-redundant message_type?: \"chunk\" | \"explain\" slot from AgentResponse (the values fold into the same union).
Minimal diff (verified locally — full test suite (66 tests) passes, typecheck clean):
```diff
--- a/src/models/messages.ts
+++ b/src/models/messages.ts
@@ export interface AgentResponse {
- // Streaming response format (new protocol)
- chunk_type?: "thought" | "action" | "observation" | "answer" | "final-answer" | "explain" | "error";
- // Streaming response format — unified envelope field (trustgraph PR #795)
- message_type?: "thought" | "action" | "observation" | "answer" | "final-answer" | "explain" | "error";
message_id?: string;
…
- // Explainability fields
- message_type?: "chunk" | "explain";
- // Explainability fields (carried when message_type === "explain")
explain_id?: string;
explain_graph?: string;
explain_triples?: Triple[];
}
```
```diff
--- a/src/socket/trustgraph-socket.ts
+++ b/src/socket/trustgraph-socket.ts
@@
-
if (resp.chunk_type === \"error\" || resp.error) {
-
if (resp.message_type === \"error\" || resp.error) {
error(resp.error?.message || \"Unknown agent error\");
return true;
}
-
if ((resp.chunk_type === \"explain\" || resp.message_type === \"explain\") && resp.explain_id && resp.explain_graph) {
-
if (resp.message_type === \"explain\" && resp.explain_id && resp.explain_graph) {
…
}
-
switch (resp.chunk_type) {
-
switch (resp.message_type) {
case \"thought\": …
case \"observation\": …
case \"answer\":
case \"final-answer\": …
case \"action\": …
}
```
Workaround
We are running a locally-built @trustgraph/client with the rename and a custom workbench-ui:1.8.2-msgtype image rebuilt from sources — happy to upstream as a PR if it'd help.
Refs
Summary
The TypeScript client's
AgentResponseinterface and theagentStreaming()switch still use the legacychunk_typefield, but the backend renamed it tomessage_typeon 2026-04-13 in trustgraph-ai/trustgraph PR #795 ("Add agent explainability instrumentation and unify envelope field naming", commitd2751553).Effect: every released
trustgraph-flowfromv2.3.1onward (includingv2.3.21and all ofv2.4.x) emits agent stream frames as{message_type: "thought" | "observation" | "answer" | …, content: …}. The client's switch onresp.chunk_typefalls through thedefaultcase, so callbacks (think,observe,answer) are never invoked. Consumers likeworkbench-ui:1.8.2get a stream of frames that silently produce no UI updates — the Assistant Agent / Graph RAG / Document RAG modes hang on "Processing chat message…" forever even though the backend completes the request withend_of_dialog=true.Affected files
src/models/messages.ts:130-154—AgentResponsedeclares bothchunk_type(the active field used in the switch) andmessage_type?: \"chunk\" | \"explain\"(the old envelope distinguisher). They now collide semantically because the backend usesmessage_typefor the full setthought | action | observation | answer | final-answer | explain | error.src/socket/trustgraph-socket.ts:1400, 1406, 1426—agentStreaming():Backend evidence
Backend
trustgraph-base/trustgraph/messaging/translators/agent.py:Backend
trustgraph-base/trustgraph/schema/services/agent.py:Grep across
trustgraph-ai/trustgraphmaster:chunk_typeis absent from all.pysources; only present in two design-doc translations underdocs/tech-specs/{he,sw}/*.md.Reproduction
trustgraph/trustgraph-flow:2.3.21(post-rename) +trustgraph/workbench-ui:1.8.2(bundles@trustgraph/client@1.7.xpre-rename).{message_type: ...}but nochunk_typefield. Server-side gateway logs show the agent completed withend_of_dialog=true.Suggested fix
Rename
chunk_type→message_typeconsistently acrossAgentResponseandagentStreaming(), and drop the now-redundantmessage_type?: \"chunk\" | \"explain\"slot fromAgentResponse(the values fold into the same union).Minimal diff (verified locally — full test suite (66 tests) passes, typecheck clean):
```diff
--- a/src/models/messages.ts
+++ b/src/models/messages.ts
@@ export interface AgentResponse {
message_id?: string;
…
explain_id?: string;
explain_graph?: string;
explain_triples?: Triple[];
}
```
```diff
--- a/src/socket/trustgraph-socket.ts
+++ b/src/socket/trustgraph-socket.ts
@@
```
Workaround
We are running a locally-built
@trustgraph/clientwith the rename and a customworkbench-ui:1.8.2-msgtypeimage rebuilt from sources — happy to upstream as a PR if it'd help.Refs
d2751553(2026-04-13)trustgraph-flowtag still emittingchunk_type:v2.3.0