Skip to content

Commit 6053570

Browse files
Ben SmithGLM-5.3 (Z.ai ACP)
andcommitted
fix(server): record ACP prompt response turn usage
Resurrects #15233 on current main (adapter moved to packages/provider-acp by #17354). ACP session/prompt responses carry session-cumulative usage; record per-session baselines and attribute non-negative deltas to the terminal provider turn as turnTokenUsage for all ACP-driven providers (Z.ai GLM registry, Grok, Antigravity, Kimi CLI). - Store returned usage and the pre-prompt baseline before completing promptWireSettled, so settled-soft Stop/interrupt finalization always observes stored usage; a hard-Stop that wins the race still advances the session baseline so the next turn deltas correctly. - Clear the baseline map after restartAcpRuntime; zero-seed fresh sessions; null on load/resume/snapshot/fork; zero on rollback replacement. - Continuation turns that never dispatch a prompt report unavailable without poisoning the baseline (promptDispatched gate); injected/wake traffic accrues into the next real prompt's delta by design. - One-sided required-counter regression or a usage-less response stores a null baseline; optional counters (cached read/write, thought) delta with missing-as-zero and are emitted when present on either side. Co-authored-by: GLM-5.3 (Z.ai ACP) <[email protected]>
1 parent d09a9ea commit 6053570

2 files changed

Lines changed: 816 additions & 2 deletions

File tree

0 commit comments

Comments
 (0)