Commit graph

2 commits

Author SHA1 Message Date
Resham Joshi
756511e8ea
fix(copilot): count agent-host requests and their output (#1651)
Some checks are pending
CI / semgrep (push) Waiting to run
Tests / test (22) (push) Waiting to run
Tests / test (22.13.0) (push) Waiting to run
Tests / test (24) (push) Waiting to run
Tests / test (26) (push) Waiting to run
Tests / test-platforms (macos-latest) (push) Waiting to run
Tests / test-platforms (windows-latest) (push) Waiting to run
Tests / desktop (push) Waiting to run
* fix(copilot): count VS Code agent-host requests and their output

VS Code now runs Copilot's agent through the Copilot CLI engine. Its
assistant.message events carry no outputTokens (CLI 1.0.8x writes the same
shape), so every request was skipped and the shutdown rollup, which assumed
per-turn events own output, dropped it: 0 calls and 0 output.

Tokenless messages now count as calls with zero tokens, and a leg with no
per-turn output takes its output from the rollup. The rollup also carries
modelMetrics totalNanoAiu, so the session's credits are exact. Tokens and
credits appear when the session ends.

* test(copilot): serve an open agent-host session

* fix(copilot): serve store-session output via the residual, count credit requests

CLI 1.0.8x sessions with session-store rows lost their output: the rows
replace the rollup and carry output only for compaction requests. The
per-leg residual now carries rollup output minus compaction-row output.

The credits note counted store rows, rollups and per-turn twins as separate
requests. It now counts requests by behavioral weight, rated when the
session carries an exact figure.

* fix(copilot): keep paired store-row credits, running nanoAiu delta

A behavioral store row (compaction or crash tail) made the credit sum drop
every paired row. Store rows now always count; a rollup counts only when
nothing behavioral carries nanoAiu.

totalNanoAiu is a running bill that does not reset at compaction, so its
per-leg delta uses its own sentinel instead of the token reset.

copilot's PENDING_REDERIVE contract moves to 56: a store row and its
message straddling midnight can move one call to the next day.
2026-10-06 18:03:51 +02:00
Uttam Deb
09778253a5
Restore input usage in Copilot chat-session journals (#1607)
* Add regressions for request-level Copilot journal usage

* Read request-level input tokens from Copilot journals

* Refresh cached Copilot journal usage and settled days

* Use local date keys in the journal cache regression
2026-10-03 23:32:28 +02:00