Files
dsh-context/tests/host
Bowen Liang 5fdf8f6908 fix(host): fold provider usage through a deep billed-count read (#44)
A nonconforming provider figure (fractional token counts, or a gateway
reporting cached_tokens above prompt_tokens driving the disjoint uncached
input below zero) rode the state raw and failed the unit's strict
`.int().nonnegative()` wire/state gates on EVERY later delivery - the
registry drive throws per event, so the contextTimeline push feed dies and
every unit registered after it starves: the Context tab froze mid-session
while the agent kept running (issue #44: stats stuck at round 26 step 5 of
97, cost 3.49 of ~30 CNY).

- fold: every usage bucket passes a deep billed-count read - finite numbers
  and numeric strings accepted, fractions rounded, negatives clamped to 0,
  non-finite/garbage read as absent; the request record and the
  session-cost totals stay complete instead of freezing
- semantics change: any readable bucket is now a billing sample (official
  token-meter parity) - an output-only usage object bills prompt 0 with its
  output split, where the previous shallow guard dropped the sample whole
- stateVersion 13: cached rows refold from the durable log, which recovers
  the steps the frozen feed never showed (cost/timing are running sums and
  were never trimmed); upgrade and rollback both discard mismatched rows
  and refold clean

Closes #44
2026-09-04 00:19:10 +08:00
..