Files
magpie/internal/sessions/testdata/agy-db
yetone 6bcdc6468d sessions: agy's own calls name the model its conversation database names (DvnT662 on X)
Usage → Requests showed every call read from a local agy-cli session with
no model (v0.1.3996). The calls reader read only agy's transcript,
brain/<id>/.system_generated/logs/transcript_full.jsonl, which carries
tokens but no model. agy keeps the model in conversations/<id>.db, the
Antigravity app's layout: gen_metadata field 1.19 is the served model,
and a step's metadata field 20.3 names its generator (0 when left out, as
antigravityRead reads it). A generator's "last_step_index" n in 1.20 names
step n+1 for steps the steps table doesn't hold.

- calls_agy.go: agyStepModels reads the db read-only and gives each
  transcript step its model (through agAppModel, so -n deployment
  suffixes go as on the app's rows). The call file's stat folds in the
  db and its -wal, so a model written after the step is read again.
- agy.go: the Sessions page counts each step's tokens under that model
  (still "agy" when the db names none), and its rev folds in the db too.
- parseVersions / callParseVersions "agy": 1, so cached parses are redone.

Fixture: gen 0 is parkavenue9639's real agy 1.5.6 gen_metadata row from
#3147 (matching its transcript step 1, 11519 in / 781 out); steps.tsv is
the real steps.metadata agy 1.5.7 wrote on this Mac. Generator 1 is made
in the test.

Run (mote): go test -count=1 ./internal/sessions ./internal/usage ok;
go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok; gofmt -l clean.

Broken by hand, each red: calls given no model; no last_step_index
fallback; Sessions not moving counted tokens to the model; call files
ignoring the db's stat; Sessions rev ignoring the db.

Not tried: a live successful agy turn (this Mac's only agy account is
refused, so its db has no answered step); agy in WSL; conversations with
a db and no transcript still count nothing (#5432); tok/s and stripping
-trial (#4805).

Refs #3147, #4805, #5432
2026-11-13 13:53:05 +08:00
..