werkrevisor 0.18.2: input and output tokens per model in the dashboard #23

Merged
ai-reviewer merged 3 commits from claude-code/token-statistics into main 2026-10-06 11:44:34 +02:00
Collaborator

See docs/prs/2026-10-06-PR#23-token-statistics.md.

🤖 Generated with Claude Code

See docs/prs/2026-10-06-PR#23-token-statistics.md. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claude-code added 1 commit 2026-10-06 11:32:50 +02:00
PR#23 doc: the dashboard shows input and output tokens per model
werkator/server build succeeded after 00:26
werkator build succeeded after 00:09
df1a4a962b
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude-code marked the pull request as ready for review 2026-10-06 11:37:21 +02:00
mi added 1 commit 2026-10-06 11:37:21 +02:00
werkrevisor 0.18.2: input and output tokens per model in the dashboard
ai-review/assessment human review required; a human approval unlocks the merge; review requested from mi; merge scheduled for when the checks succeed
ai-review/gate build succeeded after 00:15
werkator/server build succeeded after 00:33
werkator build succeeded after 00:09
78ffc42065
The service stores the LLM and Jev token counts of each run, adds the columns to an earlier database,
and the dashboard shows tokens and their ratio per model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
🟡 werkrevisor YELLOW for 78ffc42, superseded by the result for 912d505

🟡 werkrevisor: YELLOW / HUMAN_REVIEW

Change kind: mixed.

Reasons

  • YELLOW risky paths changed: server/build.gradle.kts (server/*.gradle.kts)
  • hint 3 finding(s) of low severity or rated minor by Jev: server/src/main/kotlin/de/hoennig/werkrevisor/server/UsageApiController.kt:100-118, docs/prs/2026-10-06-PR#23-token-statistics.md:17-20, docs/prs/2026-10-06-PR#23-token-statistics.md:70-74
  • hint model recommends merge with caution

Findings

  1. [medium] Jev token sum can mask partial data at server/src/main/kotlin/de/hoennig/werkrevisor/server/UsageApiController.kt:100-118, hint, as a line comment

  2. [medium] Document contradicts the code on the usage record at docs/prs/2026-10-06-PR#23-token-statistics.md:17-20, hint, as a line comment

  3. [low] Measurement section is unclear and unverifiable at docs/prs/2026-10-06-PR#23-token-statistics.md:70-74, hint, as a line comment

Classifier

8 of 8 units passed all questions (1 PR document(s)).
1 answer ignored because of a confidence below [classifier] min_confidence.

Usage: model `openrouter/anthropic/claude-sonnet-5.5`, LLM done, tokens counted before the call 37129, calls 1, tokens in 36323 / out 716 (reasoning included in out), duration 12.4 s, cost 0.0798 USD (reported), classifier `jev-1.13.0` calls 8, tokens in 6260, cost 0.0003 USD, finding judge `jev-1.13.0` calls 2, tokens in 2762, cost 0.0001 USD, config: defaults + host + repository (.werkrevisor.toml at base d7a8ffe).
Reviewed head `78ffc42065a72877d6788a336ee65b4500c8fd3f` against base `d7a8ffe825bfbba751916460486f905af1ad519a`, werkrevisor 0.18.1.
<!-- werkrevisor:78ffc42065a72877d6788a336ee65b4500c8fd3f --> <!-- werkrevisor-verdict:YELLOW --> <!-- werkrevisor-folded --> <details><summary>🟡 werkrevisor YELLOW for <code>78ffc42</code>, superseded by <a href="http://git.javagil.de/mi/werkrevisor/pulls/23#issuecomment-1136">the result for <code>912d505</code></a></summary> ## 🟡 werkrevisor: YELLOW / HUMAN_REVIEW Change kind: `mixed`. ### Reasons - **YELLOW** risky paths changed: server/build.gradle.kts (server/*.gradle.kts) - **hint** 3 finding(s) of low severity or rated minor by Jev: server/src/main/kotlin/de/hoennig/werkrevisor/server/UsageApiController.kt:100-118, docs/prs/2026-10-06-PR#23-token-statistics.md:17-20, docs/prs/2026-10-06-PR#23-token-statistics.md:70-74 - **hint** model recommends merge with caution ### Findings 1. **[medium] Jev token sum can mask partial data** at `server/src/main/kotlin/de/hoennig/werkrevisor/server/UsageApiController.kt:100-118`, hint, as a line comment 2. **[medium] Document contradicts the code on the usage record** at `docs/prs/2026-10-06-PR#23-token-statistics.md:17-20`, hint, as a line comment 3. **[low] Measurement section is unclear and unverifiable** at `docs/prs/2026-10-06-PR#23-token-statistics.md:70-74`, hint, as a line comment ### Classifier 8 of 8 units passed all questions (1 PR document(s)). 1 answer ignored because of a confidence below [classifier] min_confidence. <sub> Usage: model `openrouter/anthropic/claude-sonnet-5.5`, LLM done, tokens counted before the call 37129, calls 1, tokens in 36323 / out 716 (reasoning included in out), duration 12.4 s, cost 0.0798 USD (reported), classifier `jev-1.13.0` calls 8, tokens in 6260, cost 0.0003 USD, finding judge `jev-1.13.0` calls 2, tokens in 2762, cost 0.0001 USD, config: defaults + host + repository (.werkrevisor.toml at base d7a8ffe).<br> Reviewed head `78ffc42065a72877d6788a336ee65b4500c8fd3f` against base `d7a8ffe825bfbba751916460486f905af1ad519a`, werkrevisor 0.18.1. </sub> </details>
ai-reviewer left a comment
Collaborator

werkrevisor: YELLOW / HUMAN_REVIEW for 78ffc42065a72877d6788a336ee65b4500c8fd3f.
The result comment of werkrevisor holds the details.

werkrevisor: YELLOW / HUMAN_REVIEW for `78ffc42065a72877d6788a336ee65b4500c8fd3f`. The result comment of werkrevisor holds the details. <!-- werkrevisor-review:78ffc42065a72877d6788a336ee65b4500c8fd3f -->
@@ -0,0 +14,4 @@
which Werkator prunes after a while.
The usage record of every run already holds the token counts.
## Non-Goals
Collaborator

[medium] Document contradicts the code on the usage record (werkrevisor)

hint; Jev: real 0.88, severity 1.4 of 3

The Non-Goals state "No change of the command-line tool or of the usage record", but the PR changes the UsageRecord data class and its stored columns (llm_input_tokens, llm_output_tokens, jev_input_tokens). The statement is misleading; it should say the report format sent by the tool is unchanged.

**[medium] Document contradicts the code on the usage record** (werkrevisor) hint; Jev: real 0.88, severity 1.4 of 3 The Non-Goals state "No change of the command-line tool or of the usage record", but the PR changes the `UsageRecord` data class and its stored columns (`llm_input_tokens`, `llm_output_tokens`, `jev_input_tokens`). The statement is misleading; it should say the report format sent by the tool is unchanged.
@@ -0,0 +67,4 @@
the Web Component shows them in the table per model, with the ratio.
- werkrevisor 0.18.2.
## Measurement
Collaborator

[low] Measurement section is unclear and unverifiable (werkrevisor)

hint

The claim that the model table "showed 113 : 1 ... each in one line without wrapping" refers to a local run with 187 records that nobody can reproduce, and Scenario#23.02 is verified only by it. The ratios (e.g. "1 : 1" for DeepSeek) and the "about 94 %" claim in the Problem section have no derivation shown.

**[low] Measurement section is unclear and unverifiable** (werkrevisor) hint The claim that the model table "showed 113 : 1 ... each in one line without wrapping" refers to a local run with 187 records that nobody can reproduce, and Scenario#23.02 is verified only by it. The ratios (e.g. "1 : 1" for DeepSeek) and the "about 94 %" claim in the Problem section have no derivation shown.
@@ -88,6 +97,12 @@ class UsageApiController(
require(SHA.matches(headSha)) { "head_sha must be a hex commit id" }
val costStatus = text("cost_status")
require(costStatus == null || costStatus in COST_STATUSES) { "cost_status must be one of $COST_STATUSES" }
val jevTokens =
Collaborator

[medium] Jev token sum can mask partial data (werkrevisor)

hint; Jev: real 0.55, severity 2.1 of 3

jevTokens is the sum of the three Jev token fields, and is null only if all are absent. A run reporting only some of them is stored as a complete sum with no distinction. The sum stays unbounded by MAX_TOKENS, though each part is limited; the total is only up to 30M, which fits in a Long, so this is a minor accuracy concern.

**[medium] Jev token sum can mask partial data** (werkrevisor) hint; Jev: real 0.55, severity 2.1 of 3 `jevTokens` is the sum of the three Jev token fields, and is null only if all are absent. A run reporting only some of them is stored as a complete sum with no distinction. The sum stays unbounded by `MAX_TOKENS`, though each part is limited; the total is only up to 30M, which fits in a Long, so this is a minor accuracy concern.
ai-reviewer scheduled this pull request to auto merge when all checks succeed 2026-10-06 11:37:35 +02:00
ai-reviewer requested review from mi 2026-10-06 11:37:35 +02:00
mi added 1 commit 2026-10-06 11:38:06 +02:00
review: PR#23 doc derives the input share and names the usage record that the tool sends
werkator build succeeded after 00:09
werkator/server build succeeded after 00:26
ai-review/assessment human review required; a human approval unlocks the merge; a human review request is pending; merge already scheduled
ai-review/gate build succeeded after 00:15
912d505b17
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator

🟡 werkrevisor: YELLOW / HUMAN_REVIEW

Change kind: mixed.

Reasons

  • YELLOW risky paths changed: server/build.gradle.kts (server/*.gradle.kts)
  • hint 3 finding(s) of low severity or rated minor by Jev: server/src/main/kotlin/de/hoennig/werkrevisor/server/UsageApiController.kt:100-118, server/src/main/kotlin/de/hoennig/werkrevisor/server/UsageStore.kt:61-64, docs/prs/2026-10-06-PR#23-token-statistics.md:72-76
  • hint model recommends merge with caution

Findings

  1. [medium] Token sum can overflow Long at server/src/main/kotlin/de/hoennig/werkrevisor/server/UsageApiController.kt:100-118, hint, still open in an earlier line comment

  2. [low] Fragile schema migration with a concurrent start at server/src/main/kotlin/de/hoennig/werkrevisor/server/UsageStore.kt:61-64, hint, as a line comment

  3. [low] Measurement section is hard to verify at docs/prs/2026-10-06-PR#23-token-statistics.md:72-76, hint, still open in an earlier line comment

Classifier

8 of 8 units passed all questions (1 PR document(s)).
1 answer ignored because of a confidence below [classifier] min_confidence.

Usage: model `openrouter/anthropic/claude-sonnet-5.5`, LLM done, tokens counted before the call 37216, calls 1, tokens in 36400 / out 676 (reasoning included in out), duration 11.7 s, cost 0.0796 USD (reported), classifier `jev-1.13.0` calls 8, tokens in 6323, cost 0.0003 USD, finding judge `jev-1.13.0` calls 1, tokens in 1505, cost 0.0001 USD, config: defaults + host + repository (.werkrevisor.toml at base d7a8ffe).
Reviewed head `912d505b174eca93f0cd4465eb88ddc8133ba90a` against base `d7a8ffe825bfbba751916460486f905af1ad519a`, werkrevisor 0.18.1.
<!-- werkrevisor:912d505b174eca93f0cd4465eb88ddc8133ba90a --> <!-- werkrevisor-verdict:YELLOW --> ## 🟡 werkrevisor: YELLOW / HUMAN_REVIEW Change kind: `mixed`. ### Reasons - **YELLOW** risky paths changed: server/build.gradle.kts (server/*.gradle.kts) - **hint** 3 finding(s) of low severity or rated minor by Jev: server/src/main/kotlin/de/hoennig/werkrevisor/server/UsageApiController.kt:100-118, server/src/main/kotlin/de/hoennig/werkrevisor/server/UsageStore.kt:61-64, docs/prs/2026-10-06-PR#23-token-statistics.md:72-76 - **hint** model recommends merge with caution ### Findings 1. **[medium] Token sum can overflow Long** at `server/src/main/kotlin/de/hoennig/werkrevisor/server/UsageApiController.kt:100-118`, hint, still open in [an earlier line comment](http://git.javagil.de/mi/werkrevisor/pulls/23#issuecomment-1129) 2. **[low] Fragile schema migration with a concurrent start** at `server/src/main/kotlin/de/hoennig/werkrevisor/server/UsageStore.kt:61-64`, hint, as a line comment 3. **[low] Measurement section is hard to verify** at `docs/prs/2026-10-06-PR#23-token-statistics.md:72-76`, hint, still open in [an earlier line comment](http://git.javagil.de/mi/werkrevisor/pulls/23#issuecomment-1131) ### Classifier 8 of 8 units passed all questions (1 PR document(s)). 1 answer ignored because of a confidence below [classifier] min_confidence. <sub> Usage: model `openrouter/anthropic/claude-sonnet-5.5`, LLM done, tokens counted before the call 37216, calls 1, tokens in 36400 / out 676 (reasoning included in out), duration 11.7 s, cost 0.0796 USD (reported), classifier `jev-1.13.0` calls 8, tokens in 6323, cost 0.0003 USD, finding judge `jev-1.13.0` calls 1, tokens in 1505, cost 0.0001 USD, config: defaults + host + repository (.werkrevisor.toml at base d7a8ffe).<br> Reviewed head `912d505b174eca93f0cd4465eb88ddc8133ba90a` against base `d7a8ffe825bfbba751916460486f905af1ad519a`, werkrevisor 0.18.1. </sub>
ai-reviewer left a comment
Collaborator

werkrevisor: YELLOW / HUMAN_REVIEW for 912d505b174eca93f0cd4465eb88ddc8133ba90a.
The result comment of werkrevisor holds the details.

werkrevisor: YELLOW / HUMAN_REVIEW for `912d505b174eca93f0cd4465eb88ddc8133ba90a`. The result comment of werkrevisor holds the details. <!-- werkrevisor-review:912d505b174eca93f0cd4465eb88ddc8133ba90a -->
@@ -53,2 +58,4 @@
)
jdbc.execute("create index if not exists usage_ts on usage (ts)")
// A database of werkrevisor 0.18.1 or earlier lacks these columns; its records keep null token counts.
val columns = jdbc.queryForList("select name from pragma_table_info('usage')", String::class.java).toSet()
Collaborator

[low] Fragile schema migration with a concurrent start (werkrevisor)

hint

The columns are checked first and then added with alter table. If two instances start against the same SQLite file, one can hit "duplicate column name" and fail at startup. This is a narrow scenario.

**[low] Fragile schema migration with a concurrent start** (werkrevisor) hint The columns are checked first and then added with `alter table`. If two instances start against the same SQLite file, one can hit "duplicate column name" and fail at startup. This is a narrow scenario.
Author
Collaborator

Assessment of the review hints that were not implemented (head 912d505):

  1. Token sum can overflow Long (UsageApiController.kt:100-118): not a defect. Each of the three Jev token counts is limited to 10 million, so their sum is at most 30 million; a Long holds about 9.2 × 10^18.
    Also from the first round, Jev token sum can mask partial data: intended. A run without a DB schema judgment has no tokens there; the sum covers what ran.
  2. Fragile schema migration with a concurrent start (UsageStore.kt:61-64): not relevant in operation. The service runs as one systemd unit, and a restart stops the old process first; two instances never share the database.
  3. Measurement section is hard to verify (PR document): true, but inherent to a check of the display in a browser; the numbers are in the document, and the integration tests cover the sums below the display.

Implemented in this PR: the derivation of the input share and the wording on the usage record in the PR document.

🤖 Generated with Claude Code

Assessment of the review hints that were not implemented (head `912d505`): 1. **Token sum can overflow Long** (`UsageApiController.kt:100-118`): not a defect. Each of the three Jev token counts is limited to 10 million, so their sum is at most 30 million; a Long holds about 9.2 × 10^18. Also from the first round, **Jev token sum can mask partial data**: intended. A run without a DB schema judgment has no tokens there; the sum covers what ran. 2. **Fragile schema migration with a concurrent start** (`UsageStore.kt:61-64`): not relevant in operation. The service runs as one systemd unit, and a restart stops the old process first; two instances never share the database. 3. **Measurement section is hard to verify** (PR document): true, but inherent to a check of the display in a browser; the numbers are in the document, and the integration tests cover the sums below the display. Implemented in this PR: the derivation of the input share and the wording on the usage record in the PR document. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
mi approved these changes 2026-10-06 11:44:33 +02:00
ai-reviewer merged commit ae6c04395b into main 2026-10-06 11:44:34 +02:00
ai-reviewer deleted branch claude-code/token-statistics 2026-10-06 11:44:34 +02:00
Sign in to join this conversation.
No Reviewers
No labels
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mi/werkrevisor#23