Split usage accounting end to end, retry by default, and take the WP6 pins (N3 WP6) #96

Merged
weichen merged 1 commits from feature/n3-usage-retry-wp6 into main 2026-10-07 17:19:27 +00:00
Owner

Why: subagent runs recorded zero tokens, cache hits were invisible in run records, the usage event skipped terminal paths, and stream retry existed only on the direct-chat path (audit N20 residual).

What: usage split fields flow through direct/subagent/squad paths into run.Usage; subagent token accounting lands in finishChild; runtime.llmRetries maps onto the library default (0 disables via -1); verifier wraps retry+fallback; auto_retry events surface as process parts; pins carry the full WP6 chain.

Evidence: go test -count=1 ./... green; accounting and mapping tests.

Impact: every run record carries Last*/cache; retries are uniform across paths.

Refs: Agent-Native#35-#39, Agent-Squad#41, Agent-System-Documents#43

Why: subagent runs recorded zero tokens, cache hits were invisible in run records, the usage event skipped terminal paths, and stream retry existed only on the direct-chat path (audit N20 residual). What: usage split fields flow through direct/subagent/squad paths into run.Usage; subagent token accounting lands in finishChild; runtime.llmRetries maps onto the library default (0 disables via -1); verifier wraps retry+fallback; auto_retry events surface as process parts; pins carry the full WP6 chain. Evidence: go test -count=1 ./... green; accounting and mapping tests. Impact: every run record carries Last*/cache; retries are uniform across paths. Refs: Agent-Native#35-#39, Agent-Squad#41, Agent-System-Documents#43
weichen added 1 commit 2026-10-07 17:18:11 +00:00
Why: subagent runs recorded zero tokens, cache hits were invisible in
run records, the usage event skipped terminal paths, and stream retry
existed only on the direct-chat path (audit N20 residual).
Evidence: go test -count=1 ./... green; TestRetryAttemptsMapping
(setting 0=off→-1, N→N), TestDirectRunUsageSplitOnRecord (Last* and
cache land in the run usage), TestSubRunAccountsTokens (subagent
accounting), TestAddUsageAccumulatesSplitFields (handle chain); pins
carry Agent-Native#35/#37/#38/#39, Agent-Squad#41, Core Usage fields.
Impact: run.Usage carries Last*/cache on every path; subagent runs are
accounted; runtime.llmRetries maps onto the library default (setting 0
disables via -1); the verifier wraps retry+fallback explicitly; retry
events surface as process parts.
Refs: Agent-Native#35-#39, Agent-Squad#41, N3 plan WP6
weichen merged commit e59b25c816 into main 2026-10-07 17:19:27 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Backend#96