Skip to content

Publish Claude request occupancy from assistant messages - #3221

Merged
SawyerHood merged 2 commits into
mainfrom
slopcop/issue-3220
Sep 14, 2026
Merged

SawyerHood merged 2 commits into
mainfrom
slopcop/issue-3220

Conversation

@bb-slop-cop

@bb-slop-cop bb-slop-cop Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

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-code passed: 56 parity tests, 359 Claude provider tests, and both typechecks (9 Turbo tasks successful).
  • Provider regressions cover immediate occupancy before turn completion, nested-agent isolation, and unknown context capacity. Recorded replay covers approvals, authentication failure, compaction, fork/resume, interruption, subagents, tools, questions, and web search.
  • Independently compared every changed replay message with its previous version and each added occupancy sample with captured SDK usage; only the intended context-window deltas were added.
  • git diff --check origin/main..HEAD passed.
  • CI run 34907419146 passed on 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

AGENT GENERATED

@SawyerHood
SawyerHood merged commit 0dabd30 into main Sep 14, 2026
16 checks passed
@SawyerHood
SawyerHood deleted the slopcop/issue-3220 branch September 14, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Claude Code context usage is only emitted at final result, leaving the meter stale during tool loops

1 participant