Skip to content

revert: drop estimated kiro-cli tokens from the usage tab (#16123) - #22497

Merged
kyleseaman merged 1 commit into
mainfrom
revert/estimated-tokens-16123
Oct 20, 2026
Merged

kyleseaman merged 1 commit into
mainfrom
revert/estimated-tokens-16123

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The Usage tab stops showing estimated Kiro CLI token figures; credits stay as they are.

#16123 added an "Estimated Tokens" card and an "Est. tokens" Daily History column to /settings/overview?view=usage. kiro-cli records no token counts, so every figure is a guess built from context-window percentages, request counts and reply length / 4. The owner does not want a guessed number on the Usage tab next to the credits, which are the real billed figure.

Why it matters

A guessed token count shaped like a measurement reads as one. Kiro bills in credits, and the tab already shows credits per day and per period, so the estimate adds a second, less reliable number for the same spend. Keeping it also keeps ~270 lines of session-document parsing running on every Usage refresh.

Not a goal

  • Changing the credits figures, the Billing card, the Spend over time chart or the Kiro Account modal.
  • Changing the real "Token usage" card or the daily token chart that non-Kiro harnesses fill from measured counts.
  • Proposing a different way to measure Kiro CLI tokens.

What changed (motivation → approach → change)

Owner request to remove the estimate → revert #16123 (7f60e451f6) → the card, the column and the backend estimator are gone.

git revert did not apply cleanly because #20835 later moved the estimator from handlers/usage.py into handlers/usage_sessions.py. So:

  • handlers/usage_sessions.py: removed _estimate_cli_tokens, _sum_estimate, _turn_window, _est_count, _est_percent and their constants; _parse_sessions goes back to iterdir() and no longer emits estimated_tokens or per-day est_tokens; _empty_session_summary drops the zero block.
  • handlers/usage.py: only the facade re-exports of those names are dropped. Everything added there after feat(usage): estimate Kiro CLI token use on the Usage tab #16123 is kept.
  • handlers/usage.py also stops serving FileTooLargeError and safe_read_file_bytes_nolink (only the removed estimator imported them), so test/campaign_facade_inventories/kiro_crew.dashboard.handlers.usage.json drops them too. No caller reads them through the facade on origin/main.
  • Frontend: UsageTab.tsx drops EstimatedTokensCard and the column; the phone line keeps the credits-only form. providers/adapters/acp.ts / types.ts / index.ts drop the mapping and the TokenEstimate type.
  • i18n: the ten keys feat(usage): estimate Kiro CLI token use on the Usage tab #16123 added are removed from all locales and en.context.json.
  • Docs: the estimate paragraph leaves learn-cron-dashboard.md; the later Kiro Account run-out paragraph that sits after it is kept. The feature-map Usage row goes back to its earlier text.
  • Removed the capture harness and the two test files feat(usage): estimate Kiro CLI token use on the Usage tab #16123 added.

This removes a user-facing capability. No RFC records it; it is the maintainer's own call, so the First Principles lane may need a maintainer /ai-review override.

Backwards compatibility

Compatible: the removed payload keys were only ever read by the frontend code this PR also removes; an older dashboard against this gateway already treats a missing estimated_tokens block as "no estimate" and shows nothing.

Reader: website/src/providers/adapters/acp.ts:estimatedTokens -- chat|crew page -- removed in this PR
Reader: website/src/pages/overview/UsageTab.tsx:EstimatedTokensCard -- chat|crew page -- removed in this PR
Reader: website/src/api/creditForecast.ts:forecastCreditRunOut -- chat -- reads daily_history[].credits only, untouched
Reader: src/kiro_crew/dashboard/handlers/usage.py facade re-exports -- release -- removed in this PR; no other importer on origin/main
Reader: test/test_usage.py, test/test_usage_daily_credits.py -- release -- estimated_tokens / est_tokens expectations removed

Tests

  • Removed test/test_usage_estimated_tokens.py, website/src/test/UsageTab.estimatedTokens.test.tsx and website/src/test/AcpAdapter.usageEstimatedTokens.test.ts (they pinned the removed feature).
  • test/test_usage.py and test/test_usage_daily_credits.py go back to the payload shape without estimated_tokens / est_tokens.
  • Local static gates only: black, isort, flake8, npm run typecheck, eslint on the touched files, npm run i18n:check, check_comment_history.py, check_brand_name.py. CI runs the tests.

Manual verification

Done on two isolated pods: main at b174436 (before) and this branch at 6467a21 (after). Both pods were given the same 15 real kiro-cli session documents, so both read the same data. On /settings/overview?view=usage, before shows the Estimated Tokens card and the Est. tokens column; after shows neither. Billing, Spend over time, Session activity and the Daily History credits columns render the same, with no gap where the card was.

Screenshots / video

Real builds on isolated pods, same 15 kiro-cli sessions in both.

Desktop, top of the Usage tab: before has the Estimated Tokens card between Billing and Spend over time; after goes straight from Billing to Spend over time.

Before After
before, desktop after, desktop

Desktop, Daily History: the Est. tokens column is gone; the credits columns stay.

Before After
before, desktop daily history after, desktop daily history

The before pod also shows a 2026-10-20 row (0.04 credits). That pod ran one background turn today and the after pod did not; it is pod data, not this change.

Phone (390px): page top and Daily History
Before After
before, phone after, phone
before, phone daily history after, phone daily history

On the phone the second line under each day goes from "Credits used · % · Est. tokens" back to "Credits used · %".

Related Issues

Reverts #16123.

Pattern harvest

Not generalizable: this reverts a feature by owner decision, not a defect.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

@CrysisDeu
CrysisDeu requested review from a team and KiroCrewCaptain as code owners October 20, 2026 15:09
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 20, 2026
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of f45d248cda7e7371f07f1a58903bad7531dfa2c2 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Nothing to check.

[UX-REVIEWED] f45d248

Description read

[DESCRIPTION-READ] 641a98e8bf7466935567cce238fc0eb6430125db7603066a662ff70932898b27

That sha256 names everything this verdict read: the PR description, plus the 11 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ human override accepted

@CrysisDeu overrode this lane for f45d248cda7e7371f07f1a58903bad7531dfa2c2 via /ai-review override (this commit only).

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of f45d248cda7e7371f07f1a58903bad7531dfa2c2 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] f45d248

Description read

[DESCRIPTION-READ] f8c0a08763bc9490f7bb3fd508b172872f15c46b31a937ec86f00329760ae6d2

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed f45d248cda7e7371f07f1a58903bad7531dfa2c2 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] f45d248

Verdict parsed from the review's SHA-scoped output markers for commit f45d248cda7e7371f07f1a58903bad7531dfa2c2.

False positive or not applicable? A repository writer can comment:
/ai-review override fable f45d248cda7e7371f07f1a58903bad7531dfa2c2: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of f45d248cda7e7371f07f1a58903bad7531dfa2c2 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] f45d248

False positive or not applicable? A repository writer can comment:
/ai-review override gpt f45d248cda7e7371f07f1a58903bad7531dfa2c2: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 20, 2026
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

/ai-review override first-principles 6467a21: Maintainer decision to revert #16123. The Usage tab keeps credits, the billed figure; the estimated token card and column are removed on purpose. No new surface is added.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@CrysisDeu marked the first-principles AI finding as false positive, not applicable, or explicitly accepted for 6467a21b8db98526ac3162e2a8e5616a3f02fe7d.

Maintainer decision to revert #16123. The Usage tab keeps credits, the billed figure; the estimated token card and column are removed on purpose. No new surface is added.

This decision applies only to this commit. A new push requires a new judgment.

This reverts commit 7f60e451f6d.

Removes the Estimated Tokens card, the Est. tokens Daily History
column and the backend estimator that fed them. Credits stay as they
were.

The estimator moved from handlers/usage.py into
handlers/usage_sessions.py after the original PR (#20835), so that
part is reverted by hand there; usage.py drops only the facade
re-exports. The docs keep the later credit run-out paragraph.
@CrysisDeu
CrysisDeu force-pushed the revert/estimated-tokens-16123 branch from 6467a21 to f45d248 Compare October 20, 2026 16:11
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 20, 2026
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

/ai-review override first-principles f45d248: Maintainer decision to revert #16123. The Usage tab keeps credits, the billed figure; the estimated token card and column are removed on purpose. No new surface is added.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@CrysisDeu marked the first-principles AI finding as false positive, not applicable, or explicitly accepted for f45d248cda7e7371f07f1a58903bad7531dfa2c2.

Maintainer decision to revert #16123. The Usage tab keeps credits, the billed figure; the estimated token card and column are removed on purpose. No new surface is added.

This decision applies only to this commit. A new push requires a new judgment.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 20, 2026
@kyleseaman
kyleseaman merged commit 6fd7c1f into main Oct 20, 2026
106 of 115 checks passed
@kyleseaman
kyleseaman deleted the revert/estimated-tokens-16123 branch October 20, 2026 19:56
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants