Repository navigation
Description
Problem
opencode quota (human-readable mode) prints each window's usedPercent with raw JavaScript number interpolation — no rounding anywhere in the render path. Most quota providers compute the percent as an unrounded division, so ordinary usage prints with full float noise:
OpenCode Go (opencode-go)
weekly: 33.33333333333333% used, resets Mon, Dec 31, 6:00 PM
Evidence (verified this run on origin/main aa2fe24, laptop probe importing the real modules)
Probe (~/git/fleet/probe-2026-11-05-quota-render/probe2.ts, kept on the laptop) fed the real parseConsoleGoUsage (packages/ai/src/quota/providers/opencode-go.ts:81, clampPercent((used / limit) * 100)) a console meter of used 100 / limit 300 micro-cents and passed the result to the real renderQuotaResults:
parser windows: {"weekly":{"usedPercent":33.33333333333333, ...}}
rendered: " weekly: 33.33333333333333% used, resets Mon, Dec 31, 6:00 PM"
The render sites interpolate the number verbatim:
packages/cli/src/commands/handlers/quota.ts— window line:${window.usedPercent}% used- same file, per-model parts:
${label} ${window.usedPercent}%
Unrounded producers (grep on main): command-code.ts:67,87; groq.ts:108,120; meta.ts:91; opencode-go.ts:81; opendesign.ts:99; openrouter.ts:131 — all (used / limit) * 100 with clamping only. Turso is the exception: it rounds via its pct3 helper (turso.ts:47), so providers already disagree about percent precision. The existing CLI render tests (packages/cli/test/quota.test.ts:59-60) only use pre-rounded fixtures (4.66, 0.04), so the noise never shows in tests.
Why it matters
This is the human-facing surface of the quota subcommand — the number a user reads to decide whether a pool is spent. Sixteen-digit floats are noise, they differ per provider for no reason, and the JSON shape (which should keep full precision for machines) is not the place to fix it: the render layer owns presentation.
Acceptance criteria
- Human-readable quota output rounds percents to at most 2 decimal places, trailing zeros trimmed (33.33333333333333 → 33.33; 4.66 stays 4.66; 100 stays 100), in both the window lines and the per-model parts of
renderQuotaResults. -
--jsonoutput is unchanged (full-precision numbers for machine consumers). - Regression tests in packages/cli/test/quota.test.ts with an unrounded percent (e.g. 100/300) for a window line and a model part.
- packages/cli quota tests pass.
Activity
developing-today commentedon Nov 6, 2026
🤖 Agent note · picked up
Merge pull request #1798 from developing-today-forks/creator/1797-quo…
developing-today commentedon Nov 6, 2026
🤖 Agent note · done