Repository navigation
fix(render): carry session stats in the AG-UI RUN_FINISHED result - #1187
Merged
Merged
Conversation
RenderAGUI now receives the conversation repository and attaches the per-session totals (inputTokens, outputTokens, cacheReadTokens, totalToolCalls, cost, lastInputTokens, contextWindow) to RUN_FINISHED.result, mirroring RenderJSON's session_stats line. A run with no model requests emits no result, matching RenderJSON's gating.
This was referenced Sep 12, 2026
inference-gateway-maintainer
Bot
marked this pull request as ready for review
September 12, 2026 16:45
inference-gateway-maintainer
Bot
requested a review
from a team
as a code owner
September 12, 2026 16:45
edenreich
added a commit
to inference-gateway/desktop
that referenced
this pull request
Sep 12, 2026
The CLI (inference-gateway/cli#1187) puts the stats under result, not stats, and the totals are cumulative for the whole session, so the reducer now replaces the conversation's usage instead of adding to it.
Contributor
|
🎉 This PR is included in version 0.190.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
edenreich
added a commit
to inference-gateway/desktop
that referenced
this pull request
Sep 12, 2026
…and tools count (#216) * feat(status-bar): mirror CLI status bar with per-conversation tokens and tools count Fold TokenReadout into StatusBar as one dim, dot-separated row (Tools, in, out, cached, tool calls). Token usage now lives in the per-conversation chat reducer so it switches with the active chat and drops on delete. The tools list is fetched once the CLI is ready (and after Restart CLI) instead of lazily on the !! picker. Settings gets a Show status bar checkbox backed by chat.status_bar.enabled in the CLI config, so one toggle drives both. Closes #213 * Apply suggestion from @edenreich * fix(status-bar): read session totals from RUN_FINISHED result The CLI (inference-gateway/cli#1187) puts the stats under result, not stats, and the totals are cumulative for the whole session, so the reducer now replaces the conversation's usage instead of adding to it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #1186
Summary
RUN_FINISHEDnow carries the per-session token, cost, and tool-call totals in itsresult, asdocs/ag-ui-output.mdalready promised.RenderAGUIreceives the conversation repository and reads the same statsRenderJSONreports in itssession_statsline, so AG-UI consumers (the desktop sidecar, inference-gateway/desktop#216) see real usage instead of zeros.Changes
RenderAGUInow takes the conversation repository; after a successful run it attachessessionResultto the terminalRUN_FINISHEDthrough the AG-UI SDK'sWithResultoption.resultkeys:inputTokens,outputTokens,cacheReadTokens,totalToolCalls(counted from the session's assistant messages),cost,lastInputTokens,contextWindow(omitted when the model's window is unknown).RenderJSON: a run with no model requests (e.g. a shortcut answer) emitsRUN_FINISHEDwithoutresult.renderStreamand the browser extension bridge (which now passes its repo, so the desktop panel's AG-UI path benefits too).render_test.go:TestRenderAGUI_RunFinishedCarriesSessionStatsasserts every field is present and non-zero for a run with at least one request, plus the zero-request case;docs/ag-ui-output.mddocuments the exact key names.Affected repos
result(desktop#216, desktop#217, desktop#218); follow-up tracking issue filed there.