fix(v1): preserve cache usage in train responses - #2542
Draft
hallerite wants to merge 1 commit into
Draft
Conversation
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.
Stacked on the compact-eval-overrides branch to preserve the frozen research base.
Change
Consume optional generate-endpoint usage through CompletionUsage and the existing
Usage.from_openai conversion. This keeps cached prompt tokens out of Usage.prompt_tokens and
preserves optional reasoning details. Responses without usage still use exact token lengths.
The existing serialize_completion already forwards those details to the harness SDK.
Requires renderers' companion
fix/forward-generate-usagechange for live metadata forwarding.Without it the existing exact-length fallback remains. No sampling, rendering, graph, numerical
budget, or optimizer changes. The server already reports usage; no serving restart is needed.
Validation
Repeated 1,045-token prompt: 1,040 cached + 5 uncached; with 3 output, charge is 8 new tokens.
remains in
verifiers/v1/harnesses/hermes_agent/program.py:16.tyis not installed in the active research environment.Isolated commits are frozen for fresh local canaries. Existing full comparisons still use their
original dependencies; no result is silently resumed under the fix. Unsigned commit.
Note
Fix
response_from_generateto preserve providerCompletionUsagein train responsesCompletionUsageand converts it viaUsage.from_openai, preserving cache and reasoning-token fields from the provider.Macroscope summarized e4f51c0.