mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-07 10:45:59 -10:00
Problem: Anthropic error, EOF and cancellation exits could discard usage already reported by message_start or message_delta. Bounded consumers lost the counts, while normal recovery reconstructed counts it already knew. Root cause: the cumulative usage emitter was reachable only after message_stop; consumers may stop immediately upon receiving ChunkError. Fix: give each response one cumulative accumulator and delivery attempt. Flush partial usage before explicit errors with existing Estimated identity, retain cancellation-aware best-effort delivery on other exits, and compute the original error classification before accounting changes sink state. Keep exact committed usage, request construction and retry policy unchanged. Verification: required builtin/boot plus disjoint rest cover all239 root packages once,23966 test/subtest passes215 existing skips. Six full owner race suites2615pass10skip; actualBoot4race events0skip. Exact preceding decoder compiles and fails14events with4controls passing. Native-step contract18events/2pkg passes locally;4Win/Linux binaries compile only. Rootvet/full lint/makecheck/gofmt/diff pass; baseline2663 byte-identical. Refs #14025