You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
call log: a whole-body call's end row carries cost but no token counts #345
Part of the debug-record epic. Corrected after investigation (PR #364): the record was never lossy; the original measurement filtered the JSON keys and dropped the token fields itself. Every headless end row carries both token figures. The real loss was in the reader, which printed the completion tokens alone as N tok and never the prompt tokens. The sections below are kept as filed; the acceptance is the reader's.
What a debugger hits today
In a headless run on dev, every non-streamed end row (the compile, the grounding pass, the leaf calls, the gate) carries a cost and no prompt or completion token counts. The same log holds forty-two older non-streamed rows that do carry both. The row says how much was paid and not for how many tokens, which is the one figure a person uses to check a bill or a context size.
The law
A finished call's row carries its token counts whenever the provider reported them.
Fix shape
Find where the whole-body path's usage loses its counts between the decode and the record, and fix it there; if the provider genuinely did not report them, the row says nothing, as the emptiness law demands, and the trace body holds the raw usage object so the omission is checkable.
Replication
aforge do"count the lines in notes.txt and write the count to count.txt" --model deepseek/deepseek-v4-flash
aforge logs --tail 12
Today: the compile, ground, leaf and gate end rows show a cost and no token figures.
Acceptance (functional)
After the run above, every line aforge logs prints for an end row with a cost shows both figures (N in N out), and they match the raw rows.
A row for a provider reply with no usage object shows neither cost nor tokens.
Drafted with CodeAF · reviewed and owned by the author
Investigation result (PR #364): the premise of this issue was a measurement error on my side, not a defect in the record. When I printed the headless run's rows I filtered the JSON keys and dropped prompt_tokens, completion_tokens, stream and ttft_ms myself. The lane proved with scripted and real runs that every headless end row carries both token figures, and that every completion is streamed, so there is no whole-body end row with a response on dev.
What was genuinely lost was in the reader: aforge logs printed the completion tokens alone as N tok and never the prompt tokens, which is the figure a person uses to check a context size. #364 fixes that at the one line builder: 4142 in 304 out 4096 cached $0.0001, each half absent when the row does not carry it.
Acceptance is unchanged in spirit and now reads: after a headless run, every line aforge logs prints for an end row with a cost shows both figures, and they match the raw rows.
Landed inside #359 (dev 3379e15): the log line shows N in N out (N thinking) N cached $cost, each half absent when the row does not carry it. The record itself was never lossy; see the corrected body.
Activity
santoshkumarradha commentedon Sep 2, 2026
Investigation result (PR #364): the premise of this issue was a measurement error on my side, not a defect in the record. When I printed the headless run's rows I filtered the JSON keys and dropped
prompt_tokens,completion_tokens,streamandttft_msmyself. The lane proved with scripted and real runs that every headless end row carries both token figures, and that every completion is streamed, so there is no whole-body end row with a response on dev.What was genuinely lost was in the reader:
aforge logsprinted the completion tokens alone asN tokand never the prompt tokens, which is the figure a person uses to check a context size. #364 fixes that at the one line builder:4142 in 304 out 4096 cached $0.0001, each half absent when the row does not carry it.Acceptance is unchanged in spirit and now reads: after a headless run, every line
aforge logsprints for an end row with a cost shows both figures, and they match the raw rows.logs: a call's line shows its prompt tokens beside its completion tok…
logs: a call's line shows its prompt tokens beside its completion tok…
logs: a call's line shows its prompt tokens beside its completion tok…
logs: the reader shows the whole row, filters by run, call, tag, mode…
santoshkumarradha commentedon Sep 3, 2026
Landed inside #359 (dev 3379e15): the log line shows
N in N out (N thinking) N cached $cost, each half absent when the row does not carry it. The record itself was never lossy; see the corrected body.