Repository navigation
fix(a2a): render pi-go tool calls as kagent tool cards - #473
Conversation
The kagent UI classifies a data part as a tool call or result only by the
kagent.dev/a2a/part-type metadata key. pi-go wrote only the legacy adk_type
key, so every tool call and result rendered as unrecognized data rather than
a tool card. Emit the parts kagent's Claude and Codex harnesses emit
(go/harness/runtime/a2a/executor.go):
- tag tool parts with kagent.dev/a2a/part-type and thinking with
kagent.dev/a2a/thought, keeping the adk_* keys for ADK clients
- name the card by the registered tool name, carried from the ACP adapter
in _meta["pi.dev/tool-name"], falling back to the display title
- result shape {id, name, response: {result, isError}}
- emit a result only for a terminal update: a running subagent's
per-nested-call card refresh produced a nameless result card each time
and orphaned the real result's name
- set kagent.dev/a2a/timeline-position on every artifact (repeated on the
closing replacement, which overwrites artifact metadata) in a fixed-width
format, since the UI sorts positions as strings and RFC3339Nano trims
trailing zeros
- convert tool inputs and outputs to plain JSON values for the gRPC Struct
Signed-off-by: pi <dimetron@me.com>
dimetron
left a comment
There was a problem hiding this comment.
Reviewed git diff main...HEAD at 4f7525f, including the inherited model-documentation and release changes, against the local kagent reference.
Standards: no actionable findings.
Spec: no actionable findings. Checked tool metadata, registered names, result envelopes, terminal update filtering, JSON normalization, and timeline reconstruction against kagent's harness and UI consumer.
Validation: go test ./internal/a2a/... ./internal/acp/server/adapter ./hack/modelsdoc passed. Live Substrate behavior was not exercised. Tracked files remain unchanged.
— Codex review
govulncheck —
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #473 +/- ##
==========================================
- Coverage 91.60% 91.58% -0.03%
==========================================
Files 390 390
Lines 50146 50197 +51
==========================================
+ Hits 45937 45971 +34
- Misses 4203 4220 +17
Partials 6 6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Problem
In KAgent Substrate, pi-go's tool calls and results rendered as unrecognized data rather than as tool cards, unlike the Claude and Codex harnesses.
The kagent UI classifies a data part only by the
kagent.dev/a2a/part-typemetadata key (ui/src/api/chat/a2aGrpcChatClient.ts,dataKindOf). pi-go wrote only the legacyadk_typekey.Fix
Emit the same parts kagent's own harness emits (
go/harness/runtime/a2a/executor.go,go/api/a2a/tool_activity.go):kagent.dev/a2a/part-type; thinking carrieskagent.dev/a2a/thought. Theadk_*keys are kept for ADK clients.bash) with args in the body, as Claude/Codex do, instead of by the display title. The ACP adapter passes the name in_meta["pi.dev/tool-name"](ACP clients ignore unknown_meta). The title remains the fallback.{id, name, response: {result, isError}}. A failed call is now visibly failed.completed/failedupdates now emit a result.kagent.dev/a2a/timeline-position. It is repeated on the closing text replacement (a replacement overwrites artifact metadata). It uses a fixed-width nanosecond format, because the UI sorts positions as strings andRFC3339Nanotrims trailing zeros (.33171Z<.331709Z).Struct.Verification
_metatool name.TestServeStreamingEventsandTestToolPartsMatchKagentShape; dropping the terminal-status check failsTestNonTerminalToolUpdateIsNotAResult. The timeline test caught theRFC3339Nanoordering bug.go testpasses forinternal/a2a/...,internal/acp/...,internal/cli/...andinternal/kagent/....make lintreports 0 issues andmake vetis clean.