Repository navigation
Conversation
Afloat16
marked this pull request as ready for review
October 14, 2026 13:37
Preserve the existing usage-iteration patch and upstream fast-speed handling; resolve the release-note conflict. AI assistance: OpenAI Codex (gpt-6.1-sol).
Merge current upstream main and leave its generated CHANGELOG.md intact. Keep the original middleware and regression-test contents, and let the release process collect the independent bug-fix entry.
mangeshraut712
left a comment
There was a problem hiding this comment.
Keeping the serving hop's tool-loop and compaction records makes sense. Two edge cases in the new splice:
Backfill the serving model on every reported entry while preserving explicit model labels. Only relabel the final sampling entry. If a hop reports no sampling entry, replace the partial breakdown with the aggregate so compaction and advisor tokens are not counted twice. Validate through synchronous and asynchronous public streams: 142 tests pass with Pydantic 2; 141 pass and one existing compatibility test skips with Pydantic 1. The updated cases fail on the previous implementation.
mangeshraut712
approved these changes
Nov 14, 2026
mangeshraut712
left a comment
There was a problem hiding this comment.
LGTM! The revisions in f5cfb8fc address both previous feedback points thoroughly:
- Model Label Backfilling: Every entry from the serving hop now has
splice.modelbackfilled when lacking a model (entry.get("model") or splice.model), preserving any explicit model labels while ensuring entries inusage.iterationscan be identified by model. - Double-Counting Prevention on Non-Sampling Breakdowns: When no sampling record is present (e.g. compaction-only or advisor-only hops), the self-reported breakdown is replaced with a single aggregate
fallback_messageentry, preventing compaction/advisor tokens from being counted twice against the cumulative total. - Union Alignment & Test Coverage:
test_serving_iteration_types_track_generated_unionensuresSAMPLING_ITERATION_TYPESremains synchronized with the generated Pydantic union, and the parametrized sync/async test cases thoroughly cover tool-loop turns, compaction, and advisor records.
Author
|
Thanks for the review and approval. The current head remains The CI run for this revision is still awaiting maintainer approval and has not executed. Could a maintainer approve that run and take the required code-owner review so the normal merge checks can finish? |
This branch has not been deployed
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.
Problem
Streaming refusal fallback currently replaces the serving hop's reported usage breakdown with only its last record. Earlier tool-loop and compaction records are then lost from
usage.iterations.Changes
fallback_message..changelog/.Validation
The sync and async public-stream tests cover missing/empty breakdowns, multiple tool-loop turns, compaction before and after the final sampling record, explicit and missing model labels, and compaction/advisor-only breakdowns.
On Python 3.12.14,
tests/lib/streaming/test_beta_messages.pyandtests/lib/test_refusal_fallback_streaming.pypass 142 tests with Pydantic 2, and 141 tests with Pydantic 1 (one existing compatibility skip). The updated review cases fail on the previous implementation. Ruff lint and formatting checks pass for both changed files. Pyright reports 0 errors and 0 warnings when checking those two files.Current revision:
f5cfb8fcb70578d71d399388d3b1b0b34bcb64b6, based on upstream4c7b598466b88559583f98216139be8e9b34c1fc. The latest upstream CI run awaits maintainer approval.Related implementations: TypeScript #1260 and Go #477.