Record what a turn cost, and name the model by its identifier Reading back an export turned up two things it was not saying. `agent.model_name` carried "Ollama qwen3.8:27b-mtp-q8_0", which is the label written for a narrow status bar. A record has to name something a reader could run again, so `ReplySource` now reports an identifier alongside the label and the export prefers it: `qwen3.8:27b-mtp-q8_0`. `final_metrics` carried only a step count, though Ollama reports `prompt_eval_count` and `eval_count` on the final chunk of every round and this was reading past them. A turn may take several rounds -- a model that asks for tools and then answers -- so the counts are summed across the turn and reported once at the end of it with the number of calls they aggregate, rather than the last round's figures presented as the turn's. The export puts them on the step the turn ended on, with `llm_call_count`, which is what the account-side exporter does for the same reason. The same export now reads: model `qwen3.8:27b-mtp-q8_0`, 2334 prompt and 114 completion tokens, and `llm_call_count: 2` on the answer that followed a skill call. Totals are omitted rather than zeroed when no source measured anything: a `total_prompt_tokens` of 0 on a session that never measured would itself be a measurement. 328 tests pass.
Record what a turn cost, and name the model by its identifier
Deploy story
What this commit did to the running system — joined from the forge receipt chain, the part a commit page elsewhere cannot show.
Not deployed through the forge lane
No push, promotion, build, or deploy receipt references this commit (receipts are scanned over a bounded recent window). Changes shipped by full node replacement carry their proof in the release gate receipt instead.
Changed files
-
modified
packages/openagents-cli/src/coder-export.ts -
modified
packages/openagents-cli/src/coder-ollama.ts -
modified
packages/openagents-cli/src/coder-session.ts -
modified
packages/openagents-cli/test/coder-export.test.ts -
modified
packages/openagents-cli/test/coder-ollama.test.ts -
modified
packages/openagents-cli/test/coder-session.test.ts
Diff
6 files changed, +208 -10
packages/openagents-cli/src/coder-export.ts modified +47 -2
@@ -44,6 +44,8 @@ interface AtifStep {
| 44 | 44 |
|
| 45 | 45 |
|
| 46 | 46 |
|
| 47 |
|
|
| 48 |
|
|
| 47 | 49 |
|
| 48 | 50 |
|
| 49 | 51 |
|
@@ -52,6 +54,27 @@ interface AtifStep {
| 52 | 54 |
|
| 53 | 55 |
|
| 54 | 56 |
|
| 57 |
|
|
| 58 |
|
|
| 59 |
|
|
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
| 63 |
|
|
| 64 |
|
|
| 65 |
|
|
| 66 |
|
|
| 67 |
|
|
| 68 |
|
|
| 69 |
|
|
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
| 73 |
|
|
| 74 |
|
|
| 75 |
|
|
| 76 |
|
|
| 77 |
|
|
| 55 | 78 |
|
| 56 | 79 |
|
| 57 | 80 |
|
@@ -87,6 +110,22 @@ const argumentsOf = (source: string): Record<string, unknown> => {
| 87 | 110 |
|
| 88 | 111 |
|
| 89 | 112 |
|
| 113 |
|
|
| 114 |
|
|
| 115 |
|
|
| 116 |
|
|
| 117 |
|
|
| 118 |
|
|
| 119 |
|
|
| 120 |
|
|
| 121 |
|
|
| 122 |
|
|
| 123 |
|
|
| 124 |
|
|
| 125 |
|
|
| 126 |
|
|
| 127 |
|
|
| 128 |
|
|
| 90 | 129 |
|
| 91 | 130 |
|
| 92 | 131 |
|
@@ -99,7 +138,8 @@ const stepsOf = (entries: ReadonlyArray<CoderEntry>, model: string): ReadonlyArr
| 99 | 138 |
|
| 100 | 139 |
|
| 101 | 140 |
|
| 102 |
|
|
| 141 |
|
|
| 142 |
|
|
| 103 | 143 |
|
| 104 | 144 |
|
| 105 | 145 |
|
@@ -124,6 +164,7 @@ const stepsOf = (entries: ReadonlyArray<CoderEntry>, model: string): ReadonlyArr
| 124 | 164 |
|
| 125 | 165 |
|
| 126 | 166 |
|
| 167 |
|
|
| 127 | 168 |
|
| 128 | 169 |
|
| 129 | 170 |
|
@@ -140,6 +181,7 @@ const stepsOf = (entries: ReadonlyArray<CoderEntry>, model: string): ReadonlyArr
| 140 | 181 |
|
| 141 | 182 |
|
| 142 | 183 |
|
| 184 |
|
|
| 143 | 185 |
|
| 144 | 186 |
|
| 145 | 187 |
|
@@ -212,7 +254,10 @@ export function exportTrajectory(
| 212 | 254 |
|
| 213 | 255 |
|
| 214 | 256 |
|
| 215 |
|
|
| 257 |
|
|
| 258 |
|
|
| 259 |
|
|
| 260 |
|
|
| 216 | 261 |
|
| 217 | 262 |
|
| 218 | 263 |
|
packages/openagents-cli/src/coder-ollama.ts modified +28 -2
@@ -143,6 +143,16 @@ export class OllamaReplySource implements ReplySource {
| 143 | 143 |
|
| 144 | 144 |
|
| 145 | 145 |
|
| 146 |
|
|
| 147 |
|
|
| 148 |
|
|
| 149 |
|
|
| 150 |
|
|
| 151 |
|
|
| 152 |
|
|
| 153 |
|
|
| 154 |
|
|
| 155 |
|
|
| 146 | 156 |
|
| 147 | 157 |
|
| 148 | 158 |
|
@@ -200,6 +210,10 @@ export class OllamaReplySource implements ReplySource {
| 200 | 210 |
|
| 201 | 211 |
|
| 202 | 212 |
|
| 213 |
|
|
| 214 |
|
|
| 215 |
|
|
| 216 |
|
|
| 203 | 217 |
|
| 204 | 218 |
|
| 205 | 219 |
|
@@ -252,7 +266,15 @@ export class OllamaReplySource implements ReplySource {
| 252 | 266 |
|
| 253 | 267 |
|
| 254 | 268 |
|
| 255 |
|
|
| 269 |
|
|
| 270 |
|
|
| 271 |
|
|
| 272 |
|
|
| 273 |
|
|
| 274 |
|
|
| 275 |
|
|
| 276 |
|
|
| 277 |
|
|
| 256 | 278 |
|
| 257 | 279 |
|
| 258 | 280 |
|
@@ -268,7 +290,10 @@ export class OllamaReplySource implements ReplySource {
| 268 | 290 |
|
| 269 | 291 |
|
| 270 | 292 |
|
| 271 |
|
|
| 293 |
|
|
| 294 |
|
|
| 295 |
|
|
| 296 |
|
|
| 272 | 297 |
|
| 273 | 298 |
|
| 274 | 299 |
|
@@ -282,6 +307,7 @@ export class OllamaReplySource implements ReplySource {
| 282 | 307 |
|
| 283 | 308 |
|
| 284 | 309 |
|
| 310 |
|
|
| 285 | 311 |
|
| 286 | 312 |
|
| 287 | 313 |
|
packages/openagents-cli/src/coder-session.ts modified +44 -1
@@ -37,6 +37,19 @@ export type ReplyChunk =
| 37 | 37 |
|
| 38 | 38 |
|
| 39 | 39 |
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
|
|
| 40 | 53 |
|
| 41 | 54 |
|
| 42 | 55 |
|
@@ -54,6 +67,14 @@ export interface CoderToolCall {
| 54 | 67 |
|
| 55 | 68 |
|
| 56 | 69 |
|
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
| 73 |
|
|
| 74 |
|
|
| 75 |
|
|
| 76 |
|
|
| 77 |
|
|
| 57 | 78 |
|
| 58 | 79 |
|
| 59 | 80 |
|
@@ -71,6 +92,8 @@ export interface CoderEntry {
| 71 | 92 |
|
| 72 | 93 |
|
| 73 | 94 |
|
| 95 |
|
|
| 96 |
|
|
| 74 | 97 |
|
| 75 | 98 |
|
| 76 | 99 |
|
@@ -118,6 +141,14 @@ export interface CoderDelegation {
| 118 | 141 |
|
| 119 | 142 |
|
| 120 | 143 |
|
| 144 |
|
|
| 145 |
|
|
| 146 |
|
|
| 147 |
|
|
| 148 |
|
|
| 149 |
|
|
| 150 |
|
|
| 151 |
|
|
| 121 | 152 |
|
| 122 | 153 |
|
| 123 | 154 |
|
@@ -405,7 +436,7 @@ export class CoderSession {
| 405 | 436 |
|
| 406 | 437 |
|
| 407 | 438 |
|
| 408 |
|
|
| 439 |
|
|
| 409 | 440 |
|
| 410 | 441 |
|
| 411 | 442 |
|
@@ -500,6 +531,18 @@ export class CoderSession {
| 500 | 531 |
|
| 501 | 532 |
|
| 502 | 533 |
|
| 534 |
|
|
| 535 |
|
|
| 536 |
|
|
| 537 |
|
|
| 538 |
|
|
| 539 |
|
|
| 540 |
|
|
| 541 |
|
|
| 542 |
|
|
| 543 |
|
|
| 544 |
|
|
| 545 |
|
|
| 503 | 546 |
|
| 504 | 547 |
|
| 505 | 548 |
|
packages/openagents-cli/test/coder-export.test.ts modified +31
@@ -183,6 +183,37 @@ describe("exporting a conversation as ATIF", () => {
| 183 | 183 |
|
| 184 | 184 |
|
| 185 | 185 |
|
| 186 |
|
|
| 187 |
|
|
| 188 |
|
|
| 189 |
|
|
| 190 |
|
|
| 191 |
|
|
| 192 |
|
|
| 193 |
|
|
| 194 |
|
|
| 195 |
|
|
| 196 |
|
|
| 197 |
|
|
| 198 |
|
|
| 199 |
|
|
| 200 |
|
|
| 201 |
|
|
| 202 |
|
|
| 203 |
|
|
| 204 |
|
|
| 205 |
|
|
| 206 |
|
|
| 207 |
|
|
| 208 |
|
|
| 209 |
|
|
| 210 |
|
|
| 211 |
|
|
| 212 |
|
|
| 213 |
|
|
| 214 |
|
|
| 215 |
|
|
| 216 |
|
|
| 186 | 217 |
|
| 187 | 218 |
|
| 188 | 219 |
|
packages/openagents-cli/test/coder-ollama.test.ts modified +40 -5
@@ -70,10 +70,13 @@ describe("an ollama reply", () => {
| 70 | 70 |
|
| 71 | 71 |
|
| 72 | 72 |
|
| 73 |
|
|
| 73 |
|
|
| 74 |
|
|
| 75 |
|
|
| 74 | 76 |
|
| 75 | 77 |
|
| 76 | 78 |
|
| 79 |
|
|
| 77 | 80 |
|
| 78 | 81 |
|
| 79 | 82 |
|
@@ -115,7 +118,8 @@ describe("an ollama turn that calls a tool", () => {
| 115 | 118 |
|
| 116 | 119 |
|
| 117 | 120 |
|
| 118 |
|
|
| 121 |
|
|
| 122 |
|
|
| 119 | 123 |
|
| 120 | 124 |
|
| 121 | 125 |
|
@@ -129,6 +133,33 @@ describe("an ollama turn that calls a tool", () => {
| 129 | 133 |
|
| 130 | 134 |
|
| 131 | 135 |
|
| 136 |
|
|
| 137 |
|
|
| 138 |
|
|
| 139 |
|
|
| 140 |
|
|
| 141 |
|
|
| 142 |
|
|
| 143 |
|
|
| 144 |
|
|
| 145 |
|
|
| 146 |
|
|
| 147 |
|
|
| 148 |
|
|
| 149 |
|
|
| 150 |
|
|
| 151 |
|
|
| 152 |
|
|
| 153 |
|
|
| 154 |
|
|
| 155 |
|
|
| 156 |
|
|
| 157 |
|
|
| 158 |
|
|
| 159 |
|
|
| 160 |
|
|
| 161 |
|
|
| 162 |
|
|
| 132 | 163 |
|
| 133 | 164 |
|
| 134 | 165 |
|
@@ -146,7 +177,10 @@ describe("an ollama turn that calls a tool", () => {
| 146 | 177 |
|
| 147 | 178 |
|
| 148 | 179 |
|
| 149 |
|
|
| 180 |
|
|
| 181 |
|
|
| 182 |
|
|
| 183 |
|
|
| 150 | 184 |
|
| 151 | 185 |
|
| 152 | 186 |
|
@@ -175,8 +209,9 @@ describe("an ollama turn that calls a tool", () => {
| 175 | 209 |
|
| 176 | 210 |
|
| 177 | 211 |
|
| 178 |
|
|
| 179 |
|
|
| 212 |
|
|
| 213 |
|
|
| 214 |
|
|
| 180 | 215 |
|
| 181 | 216 |
|
| 182 | 217 |
|
packages/openagents-cli/test/coder-session.test.ts modified +18
@@ -392,3 +392,21 @@ describe("the /export command", () => {
| 392 | 392 |
|
| 393 | 393 |
|
| 394 | 394 |
|
| 395 |
|
|
| 396 |
|
|
| 397 |
|
|
| 398 |
|
|
| 399 |
|
|
| 400 |
|
|
| 401 |
|
|
| 402 |
|
|
| 403 |
|
|
| 404 |
|
|
| 405 |
|
|
| 406 |
|
|
| 407 |
|
|
| 408 |
|
|
| 409 |
|
|
| 410 |
|
|
| 411 |
|
|
| 412 |
|