agy-cli 0.1.23: thinking is not counted twice on the SQLite path (#1032)

measuredUsage summed field 3 (output) and field 9 (thinking) of SQLite gen_metadata, but field 3 already carries the thinking, so the SQLite path billed thinking twice. Each step now counts max(output, thinking), as promptUsage does since #1023.

Run at b3873f84 on mica (Bun, temp HOME): bun test packages/agy-cli 14 pass 0 fail; bun scripts/check.mjs exit 0.
Broken by hand: putting back item.output + item.thinking turns 4 tests red, including the PR's new one.
Not tried: a real Antigravity CLI session.
This commit is contained in:
tungloong
2026-11-12 12:03:47 +08:00
committed by GitHub
parent 4e3a786814
commit b64dfb91cb
4 changed files with 155 additions and 19 deletions
+3 -2
View File
@@ -4,8 +4,9 @@
// `gen_metadata`, written when generation ends, before client tools return.
// Older stores record each completed model call in table `steps`, with
// step_type 15 and status 3 (done), the counts in Protobuf field 9 of
// `metadata` (2 uncached input, 3 output, 4 cache write, 5 cache read,
// 9 thinking). Summed over a prompt they equal the ACP total exactly.
// `metadata` (2 uncached input, 3 output including thinking, 4 cache write,
// 5 cache read, 9 thinking). Summed over a prompt they equal the ACP total
// exactly.
// Protobuf layout first decoded by lili-luo/dsh-plugin-bundle
// (dsh-llm-antigravity-acp, MIT); SQLite reader adapted from
// DylanLIiii/opencode-antigravity-bridge (MIT). Any failure here returns null