fix: retain paid usage from reasoning-ceiling retries - #1625
Closed
santoshkumarradha wants to merge 2 commits into
Closed
santoshkumarradha wants to merge 2 commits into
santoshkumarradha wants to merge 2 commits into
Conversation
santoshkumarradha
marked this pull request as ready for review
September 27, 2026 17:37
santoshkumarradha
added a commit
that referenced
this pull request
Sep 27, 2026
Member
Author
|
Superseded by aggregate PR #1627: #1627 . The exact reviewed green head is verified as an ancestor of published Santosh/dev; its issue details, validation, direct GitHub media attachments and limitations are preserved in the aggregate. Closing this source PR under the approved batch-1 workflow. Source branch retained; no merge into dev/main is implied. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Actual terminal capture 1 · Capture 2
These short recordings show the actual completed terminal state, not the full task execution. Exact revisions, accounting receipts and limits are below.
Problem and behavior
Fixes #1624. A successful reasoning-only response at the output ceiling teaches the adapter to retry with more room. The first response is paid, but the session previously saw only the final answer. A real OpenRouter DeepSeek V4.1 Flash run recorded $0.058953156 across 53 transport responses versus $0.058353756 across 52 ledger rows: the missing $0.0005994 exactly matched the discarded 718-input/320-output response.
The adapter now notifies accounting owners before retrying. The session records the discarded response, including cache usage, with its model/role and original inline-versus-detached turn ownership. Existing full per-transport billing owners retain sole ledger ownership. Composed budget observers update the applicable day, task, seat and helper totals without releasing the in-flight reservation twice. The final response content, error behavior, context size and one-retry limit stay unchanged.
This is a separate dev-based accounting fix. It contains no task-admission or broad restart-audit changes.
Verification
Limits
The existing adapter may spend one retry within an already admitted logical call; this change records that spend and makes subsequent budget decisions accurate. It does not add a new admission policy for internal retries. Current direct consolidation/sentinel roads send no output ceiling and cannot enter this specific ceiling-learning retry. Auxiliary call ownership is explicit at the existing seven detached request sites, rather than inferred from role names.
Final revision and real terminal acceptance
Exact PR head:
6105c01e8dddbf988eced24008ee83d5fbc84fa5(changelog identity only after independently reviewed production1f4f3c51fed3d9c5f8be109138eebca2c61b83c7). Clean build and changelog checks pass; build SHA2560085c71b3fd48b541ffd92e8c0440347d75fe7774dca80621ec5331f717e9858.Two bounded live workflows ran using only
deepseek/deepseek-v4.1-flash. Live source was the explicitly combined961c98c0d50860ab517f33a4e148628abd290965: focused #1619 head25893534b plus this reviewed production fix, without broad #1604. This is not isolated-head live evidence.Both runs naturally triggered a paid reasoning-ceiling response, which now appears immediately in the ledger. Their retries hit a provider-stream deadline; existing later reconciliation added the retry cost. No transport-cost parity or successful final live retry is claimed:
Both generated supplier CSVs contain Bolts:12 available/3 needed and Nuts:7 available/8 needed; all24 inventory tests pass in each. A separate reviewer checked the settled raw receipts, model IDs and artifacts. Successful-retry semantics are covered by the HTTP regression cases above.
All required exact-head checks pass in run36337200573, including the full affected-package gate (4m42s) and light gate (3m51s). Independent review and live receipt audit are complete. Ready for review; no production deployment or merge.
Review media below are direct PR attachments. Repository-hosted evidence links have been removed. Exact revisions, validation results and limitations remain in this description; original source recordings and generated examples are retained locally.