Mobile session cost + per-message model - #4727
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe only incremental change since the last review (pluralizing the accessibility label in the cost sheet's model row) correctly fixes the previously-flagged issue, and no new issues were introduced. Files Reviewed (1 file)
Previous Review Summaries (5 snapshots, latest commit 459effb)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 459effb)Status: 1 Issue Found | Recommendation: Address before merge Executive SummaryThe only incremental change since the last review (XDG isolation added to the mobile E2E remote-CLI script) introduces no new issues; one previously-flagged accessibility pluralization mismatch in the cost sheet's model row remains open. Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (34 files)
Fix these issues in Kilo Cloud Previous review (commit c54a2ca)Status: 1 Issue Found | Recommendation: Address before merge Executive SummaryThe previously-flagged cost-reconciliation clamp is now correctly fixed with the documented epsilon-bounded residual; the only new finding is a minor accessibility-label pluralization mismatch in the cost sheet's model row. Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (33 files, note: this run used the full PR diff since the recorded previous-review base commit does not correspond to this PR's history)
Fix these issues in Kilo Cloud Previous review (commit 1c3e4df)Status: No Issues Found | Recommendation: Merge Executive SummaryThe only changes since the last review fix the previously flagged reconciliation-clamp issue with an explicit, epsilon-bounded residual calculation and matching test coverage; no new issues were introduced. Files Reviewed (2 files)
Previous review (commit db0792c)Status: No Issues Found | Recommendation: Merge Executive SummaryThe two files changed since the last review are purely formatter-applied line-wrap changes with no behavioral difference; no new issues were introduced. Files Reviewed (2 files)
Previous review (commit 1fb55b2)Status: 1 Issue Found | Recommendation: Address before merge Executive SummaryThe session cost breakdown's subagent-residual reconciliation can silently drift from the displayed session total in Overview
Issue Details (click to expand)WARNING
Files Reviewed (34 files)
Reviewed by claude-sonnet-5 · Input: 18 · Output: 2.6K · Cached: 318.7K Review guidance: REVIEW.md from base branch |
…t drift Make the subagent residual clamp explicit and documented via an epsilon so negligible floating-point drift never emits a spurious sub-cent Subagents row, addressing a Kilobot review remark. Add tests that distinguish the epsilon logic from the prior Math.max clamp.
1c3e4df to
c54a2ca
Compare
The disposable per-worktree remote CLI read the machine-global kilo OAuth
login at $XDG_DATA_HOME/kilo/auth.json and used that production credential
for AI-gateway calls, ignoring the minted local KILO_API_KEY. The local
gateway then rejected it ("You need to sign in to use this model"). Point
XDG_DATA_HOME and XDG_CONFIG_HOME into the disposable CLI home so the CLI
falls back to the minted local token against this worktree's stack.
The Models row accessibilityLabel always said "N steps", so VoiceOver read "1 steps" while the visible label singularized to "1 step". Mirror the existing visible-label pluralization in the accessibility label.
Summary
Adds session cost visibility and per-message model context to the mobile cloud-agent UI, in three product areas:
$X.XXfolded into the row's meta line ($0.12 · 5m ago); null/zero/in-progress sessions are unchanged. Screen-reader users hear a humanized form (cost 12 cents, …).Backend / contract changes
packages/db,services/session-ingest): adds a nullabletotal_cost_microdollarscolumn tocli_sessions_v2and best-effort persists the already-computed session total at close (dedup-bounded, wrapped in try/catch so a Postgres failure never breaks metrics). No backfill of historical sessions.packages/session-ingest-contracts): adds an optionalmodelfield to the step-finish part ofkiloSdkPartSchemaso the concrete routed model survives the history-load path (the live-stream path already preserved it). A small type-safe accessor in the cloud-agent-sdk layer reads it; the externally generatedopencode.gen.tsis not modified.Notable design decisions
totalCost; per-model step costs plus a Subagents residual always reconcile to it, because subagent cost is folded into the parent message but never onto a step-finish part.modelfield.Testing
pnpm format,pnpm typecheck,pnpm lint,pnpm check:unused, and the full test suite pass inapps/mobile; typecheck/lint/tests pass for the changedpackages/db,packages/session-ingest-contracts,services/session-ingest, and the web router;drizzle checkis clean.Risks
SessionIngestDOis a new access pattern for that DO; it is bounded to a single write per session close by the existingmetricsEmitteddedup and is best-effort (failures logged, not thrown).