Publish Claude request occupancy from assistant messages - #3221
Merged
Merged
Conversation
SawyerHood
force-pushed
the
slopcop/issue-3220
branch
from
September 14, 2026 23:08
6168deb to
1b9df02
Compare
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.
Human comments
What was wrong
Claude assistant translation stored request-context samples without publishing them until result translation, so intermediate assistant messages could not update context occupancy. Nested assistant usage could also overwrite the parent sample. See the verified reproduction and root-cause report. The initial implementation left 13 Claude replay expectations at the previous behavior, causing the packages CI job to fail.
What changed
Top-level Claude assistant messages immediately emit estimated context-window usage using the current model-capacity hint, preserving unknown capacity as null. Nested assistant usage is excluded from parent context state. Regression tests and scripted bridge calibration cover the new behavior.
Updated 13 derived Claude replay lanes and their event-count pins to include the 64 intermediate occupancy events. Each added value was checked against the captured top-level SDK input and cache-token totals; the nested-agent sample adds no parent occupancy event. Existing deltas, recording metadata, row counts, and grammar-drop counts are preserved. No wire or protocol fields changed. Rebased to resolve conflicts with the provider-context breakdown feature on main, preserving its deltas and counts alongside the new occupancy events.
How you verified
pnpm exec turbo run test typecheck --filter=@bb/provider-parity --filter=bb-plugin-provider-claude-codepassed: 56 parity tests, 359 Claude provider tests, and both typechecks (9 Turbo tasks successful).git diff --check origin/main..HEADpassed.1b9df0207e51126c826df0a8a36760ef9413a9b8: all nine active CI jobs green, including packages and Linux/macOS package smoke. Gate and version checks also passed; iOS and Node compatibility workflows were skipped by their conditions.Fixes #3220