fix(desktop): align usage statistics with Daily Review - #3761
Conversation
Astro-Han
left a comment
There was a problem hiding this comment.
I reviewed this head and found no blocking code issues.
Usage statistics are now aligned to the Host projection (single window for summary/buckets/logs, paginated fetch, host-switch stale guard). The fix correctly reuses the Daily Review projection and handles aborts/tool counts.
Machine gate: test is failure on session-effect-two-client-uds (likely environmental flake, unrelated to desktop usage IPC), so not green — not mergeable yet. No P0-P2 in code.
简体中文
代码无阻断,CI 红待作者重跑。|
Investigated the red CI check on this PR. The failure is in the pre-existing I rebuilt 简体中文这次 CI 红灯来自主干已有的 Runtime Host recap 双客户端测试,与本 PR 的 usage 改动无关。本地构建并压力运行 360 次均通过,建议直接重跑该 check。Generated-by: OpenAI Codex |
|
Follow-up fix pushed in The recap coordinator now rechecks the durable result when it finds an intent but no in-memory active effect. This closes the small race where the first result probe observes the result before publication, the intent is then visible, and an exact retry could otherwise be classified as Local verification: The original CI log also contained an unrelated Host registration/startup race in another test, so the full CI result still needs to be observed after this head. 简体中文在发现 intent 但内存中没有 active effect 时重新读取 durable result,避免结果刚写入期间的精确重试被误判为 outcome_unknown。provider 不会重复调用,冲突仍然 fail closed。Generated-by: OpenAI Codex |
Astro-Han
left a comment
There was a problem hiding this comment.
I reviewed this head and found a blocking issue.
[P1] settings.usageStats() forwards wrapped Result as raw stats — crashes Settings → Usage
runtime-host-usage-ipc-main.ts:87-92 returns {ok:true, data:UsageStats} via tryReconnectableReadResult, but preload.ts:2629-2633 declares Promise<UsageStats> and returns the wrapper unwrapped. Renderer reads stats.logs.length on the wrapper → Cannot read properties of undefined and crash. Hosted test: FAILURE (32920709908) on Settings accessibility.
Fix: unwrap success Result in preload (keep reconnectable error semantics) or change contract to Result and handle in renderer; add regression test.
简体中文
设置页的 Usage 数据被包了一层导致崩溃。Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
da77a7c to
c415d99
Compare
|
Fixed the P1 in The Runtime Host Added regression coverage for:
Verification:
The full workspace dependency build still reports pre-existing 简体中文已修复 P1:Host usage IPC 返回的 Result 包装现在由 preload 正确解包,Settings 收到真正的 UsageStats;普通错误会转成异常,可重连传输错误仍保持 reject 语义。设置页无障碍 E2E 已通过。Generated-by: OpenAI Codex |
Generated-by: OpenAI Codex
Generated-by: OpenAI Codex
The Runtime Host usage IPC intentionally returns a reconnectable Result envelope. Unwrap successful host reads in preload and surface projected failures as errors so Settings receives UsageStats instead of the envelope. Add regression coverage for both result handling and the preload contract. Generated-by: OpenAI Codex
c415d99 to
428fd04
Compare
Summary
Fixes #3695
Usage Statistics now reads the selected Runtime Host's unified usage projection, matching Daily Review's legacy + canonical model-call accounting.
usage:statsIPC projection.中文摘要
使用统计现在直接读取当前选中的 Runtime Host 统一用量投影,与 Daily Review 使用相同的 legacy + canonical 统计口径;同时补齐分页读取、Host 切换防旧数据回写、未知字段展示和中止工具调用的独立统计,不改变 Runtime Host 权威或定价逻辑。
Verification
npm run format:checknpm run lintnpm --workspace @maka/core run buildnpm --workspace @maka/runtime-host run buildnpm --workspace @maka/storage run buildnpm --workspace @maka/desktop run build:mainruntime-host-usage-stats.test.js(passed)git diff --checkThe repository-wide typecheck still reports existing unrelated errors in
packages/uiand the CLI's@maka/evalresolution. The storage SQLite test suite was not runnable with the available Node v20 runtime becausenode:sqliteis unavailable; the repository requires Node >=22.19.0.AI use
Tool(s) and scope: OpenAI Codex analyzed issue #3695, designed the bounded Host-scoped projection, implemented the IPC/renderer changes, added regression coverage, and ran the listed verification. The human contributor remains responsible for review and submission.
Checklist
Does this PR entail a change in behavior?