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
After closing and reopening the Reasonix desktop app, session stats (session cost, currency, cache hit rate) show as 0 or dash (-). Only after sending a new message do the correct stats appear. The telemetry data IS persisted to .jsonl.telemetry.json files, but it's never loaded into the frontend State on session resume.
What was happening
The backend ContextUsageForTab returned sessionTokens from persisted telemetry (correct), but sessionCost, sessionCurrency, and cache stats were never included. The frontend State only received these from live usage events during turns. On resume (before the first message), no usage events have fired, so these fields stay at their zero defaults.
StatusBar displayed:
sessionCost: ¥0.00 (should be actual cost from telemetry)
sessionCurrency: ¥ (should be actual currency from telemetry)
Cache hit rate (avg): - (should be computed from telemetry's cumulative cache tokens)
Changes
1. desktop/app.go — Extended ContextInfo struct
Added SessionCost, SessionCurrency, CacheHitTokens, CacheMissTokens fields. Populated from tab.telemetrySnapshot().Usage in ContextUsageForTab.
When no live WireUsage is available (resume before first message), the cache hit rate (avg) is now computed from context.cacheHitTokens and context.cacheMissTokens (loaded from telemetry), instead of showing "-".
Files Changed
File
Change
desktop/app.go
Extended ContextInfo with 4 new fields, populated from telemetry snapshot
desktop/frontend/src/lib/types.ts
Added 4 optional fields to ContextInfo interface
desktop/frontend/src/lib/useController.ts
Updated case "context" reducer to load sessionCost/sessionCurrency
desktop/frontend/src/components/StatusBar.tsx
Added contextAvgRate helper, used as fallback for cache hit rate
Note on CI test failures: The 6 failing tests (TestUpdateMCPServerSplitsPastedCommandLine, TestProjectHooksSettingsUseActiveWorkspaceRootAndTrust, TestTrustProjectHooksForRootUsesDisplayedProjectRoot, TestSkillRootsViewDedupesConfiguredConventionRoot, TestSkillRootsViewDedupesConfiguredProjectConventionRoot, TestAddSkillPathRestoresConventionRootWithoutCustomPath) are pre-existing on main-v2 and unrelated to this PR.
Verified by checking out the latest main-v2 commit (5dac4f6d) and running the same tests — identical failures, identical error messages. These are Windows-specific test issues (TempDir cleanup races, backslash path handling in TOML parsing) in the desktop/ module.
Our changes only touch app.go (ContextInfo struct + ContextUsageForTab), types.ts, useController.ts, and StatusBar.tsx — none of which are related to MCP command parsing, project hooks, or skill roots.
The failures are only visible when running go test ./... from within the desktop/ directory (separate Go module). They don't appear in the root module test suite.
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
desktopWails desktop app (desktop/**)v2Go rewrite (1.x) — main-v2 branch, active development
1 participant
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.
Closes #3450
Problem
After closing and reopening the Reasonix desktop app, session stats (session cost, currency, cache hit rate) show as 0 or dash (-). Only after sending a new message do the correct stats appear. The telemetry data IS persisted to
.jsonl.telemetry.jsonfiles, but it's never loaded into the frontendStateon session resume.What was happening
The backend
ContextUsageForTabreturnedsessionTokensfrom persisted telemetry (correct), butsessionCost,sessionCurrency, and cache stats were never included. The frontendStateonly received these from liveusageevents during turns. On resume (before the first message), nousageevents have fired, so these fields stay at their zero defaults.StatusBar displayed:
¥0.00(should be actual cost from telemetry)¥(should be actual currency from telemetry)-(should be computed from telemetry's cumulative cache tokens)Changes
1.
desktop/app.go— ExtendedContextInfostructAdded
SessionCost,SessionCurrency,CacheHitTokens,CacheMissTokensfields. Populated fromtab.telemetrySnapshot().UsageinContextUsageForTab.2.
desktop/frontend/src/lib/types.ts— ExtendedContextInfointerfaceAdded matching optional fields to the TypeScript interface.
3.
desktop/frontend/src/lib/useController.ts— Updatedcase "context"reducerThe reducer now loads
sessionCostandsessionCurrencyfrom the context payload (backed by telemetry) when the values are present and positive.4.
desktop/frontend/src/components/StatusBar.tsx— AddedcontextAvgRatefallbackWhen no live
WireUsageis available (resume before first message), the cache hit rate (avg) is now computed fromcontext.cacheHitTokensandcontext.cacheMissTokens(loaded from telemetry), instead of showing "-".Files Changed
desktop/app.goContextInfowith 4 new fields, populated from telemetry snapshotdesktop/frontend/src/lib/types.tsContextInfointerfacedesktop/frontend/src/lib/useController.tscase "context"reducer to load sessionCost/sessionCurrencydesktop/frontend/src/components/StatusBar.tsxcontextAvgRatehelper, used as fallback for cache hit rate