Skip to content

Fix canceled buffered provider usage accounting - #2097

Closed
JAORMX wants to merge 6 commits into
fix/recovery-baseline-races-20261005from
fix/recovery-accounting-20261005
Closed

JAORMX wants to merge 6 commits into
fix/recovery-baseline-races-20261005from
fix/recovery-accounting-20261005

Conversation

@JAORMX

@JAORMX JAORMX commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Retains provider-neutral usage already accepted by the resilience wrapper when caller cancellation happens before or during buffered delivery. This fixes an inherited accounting defect used by the server-owned recovery work in #1920.

  • Consolidate known buffered usage ahead of semantic chunks; keep semantic ordering and suppress canceled output/tool dispatch.
  • Fold accounting before engine cancellation/error checks and reuse the existing session ledger.
  • Do not drain a live continuation to recover accounting or estimate unreported billing.
  • Do not record breaker success when cancellation occurs during buffered completion.

No exported API, new ledger, extended recovery policy, or raw-provider partial-usage change.

Verification

Real-engine regression first failed with 0/0 or partial 5/1 instead of 12 input / 4 output tokens. The fix now retains 12/4 exactly once in result and session, with successful no-double-count controls and no canceled dispatch.

Passed focused/full affected package tests and race tests: engine/agent, engine module, llmresilience, and app composition including Codex fixtures. Independent spec, standards, test-adequacy, security, architecture, duplication, and reuse reviews have no remaining blocking findings.

CI on 63197ab8c: 28 passed, 9 skipped. The initial gocyclo failure was fixed with one private buffered-handoff extraction; authoritative scoped lint and package/race tests passed, and closure review confirmed unchanged cancellation/cleanup semantics.

Remains draft pending complete local aggregate certification. Its earlier full-suite failures included the inherited long Unix-socket fixture path limit; the integrated candidate in #1920 now passes full local lint/docs/site/API/demo checks but has two separately triaged baseline test failures and an incomplete full race gate. Green CI and focused proofs are not being presented as a completed local aggregate run.

Relates to #1912 and #1920. This prerequisite can land independently of extended recovery. No PR merged or deployment performed.

JAORMX and others added 2 commits October 5, 2026 14:19
Preserve accounting-first delivery, cancellation checks, and cleanup ownership while reducing wrap complexity below the lint limit.

Co-authored-by: Mecatl <[email protected]>
@JAORMX
JAORMX changed the base branch from main to fix/recovery-baseline-races-20261005 October 5, 2026 13:13
@JAORMX

JAORMX commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #1920. The accounting fix and its regression tests are already integrated into that implementation; no code is being discarded. Consolidating the work to the original plan/implementation plus baseline repairs in #2108.

@JAORMX JAORMX closed this Oct 5, 2026

This branch was successfully deployed

1 active deployment
Preview — 07f28535 Deployed Oct 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant