Repository navigation
fix(core): include provider wait in token throughput timing - #47125
Closed
opencode-agent[bot] wants to merge 1 commit into
Closed
opencode-agent[bot] wants to merge 1 commit into
opencode-agent[bot] wants to merge 1 commit into
Conversation
3 of 6 tasks
dukebw
added a commit
to dukebw/opencode
that referenced
this pull request
Sep 17, 2026
# What/why Include reasoning tokens in the tok/s indicator and measure their full request window. Provider stream events can arrive after hidden reasoning, and retaining an earlier attempt's creation timestamp includes retry backoff in the rate. # How Align request timing with anomalyco#47125: capture the request-start timestamp after snapshot preparation, carry epoch milliseconds on Step.Started, and project it into time.created in both durable and live client state. Reset it for each physical retry and preserve the existing fallback for historical events without a start timestamp. Keep lazy assistant creation and the response-body end boundary before local tool settlement. Sum visible output and reasoning over streamed - created. # Testing 316 focused tests passed across core runner/projector/publisher, live client projection, schema/protocol event, TUI row, and rendered footer regression suites. Full bun run check passed. Regenerated clients and verified stable output. stack-pr-branch: dukebw/stack/0681e582ab9d4b2ab73deedf3a7b43a8
Contributor
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
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.
Summary
Fix inflated TUI output-token throughput for responses that arrive in a burst after waiting on the provider.
The denominator is the sum of
time.streamed - time.createdacross the assistant's model steps. Previously,time.createdcame from the lazily published step-start event, which can arrive only after the provider has already spent most of the request generating the response. A deterministic 12-token fixture with 2,690 ms of provider wait and 10 ms of response delivery therefore reports 1,200 tok/s instead of about 4.4 tok/s across the request.startedtimestamp on the existing step-start event.Validation
Schema.Anyusage. Confirmed the same failure with the schema source byte-identical to the base commit; not changed in this patch.Requested by: @rekram1-node (Aiden via Slack)