Skip to content

fix: preserve Anthropic stream input usage - #23

Closed
0disoft wants to merge 1 commit into
lidge-jun:devfrom
0disoft:task/anthropic-stream-usage
Closed

0disoft wants to merge 1 commit into
lidge-jun:devfrom
0disoft:task/anthropic-stream-usage

Conversation

@0disoft

@0disoft 0disoft commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • accumulate Anthropic stream usage from message_start and message_delta
  • emit a single terminal done on message_stop, with EOF fallback when usage was already seen
  • add coverage for streamed input/cache usage plus output usage merging

Tests

  • bun test tests/adapter-usage.test.ts
  • bun test tests
  • bun run typecheck

@lidge-jun

Copy link
Copy Markdown
Owner

놀러갔다 오겠습니다 ㅎㅎ..

@lidge-jun

Copy link
Copy Markdown
Owner

Merged into local dev with a follow-up commit that changes mergeAnthropicUsage from spread-override to additive merge — prevents silent overwrite if Anthropic ever sends overlapping keys across message_start and message_delta. All 167 tests pass including your two new usage tests. Thanks!

@lidge-jun

Copy link
Copy Markdown
Owner

Merged into dev manually with a follow-up should-fix (additive usage merge). Thanks for the contribution!

@lidge-jun lidge-jun closed this Jun 23, 2026
lidge-jun added a commit that referenced this pull request Jun 24, 2026
Cherry-pick PR #23 by @0disoft. Accumulate message_start input usage
and message_delta output usage into a single terminal done event on
message_stop, with EOF fallback when message_stop is missing.

Co-Authored-By: ZeroDi <0disoft@users.noreply.github.com>
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
Cherry-pick PR lidge-jun#23 by @0disoft. Accumulate message_start input usage
and message_delta output usage into a single terminal done event on
message_stop, with EOF fallback when message_stop is missing.

Co-Authored-By: ZeroDi <0disoft@users.noreply.github.com>
lidge-jun added a commit that referenced this pull request Sep 28, 2026
…) (#6172)

* fix(devin): resolve models through catalog family metadata

Parse ClientModelConfig #23 ModelInfo, #30 ModelFamilyMetadata and #31
default flag. A family id with no effort now selects the family's default
member (swe-1-7 -> swe-1-7-medium, not the Max row), an effort moves only
the effort axis to the nearest rung, Fast Mode and 1M Context follow only
explicit requests, and resolution never leaves the family. The suffix
fallback's variant scan matches the collapsed base instead of a string
prefix, so claude-opus-5 no longer lands on claude-opus-5-5-*.

The picker collapses by family, reads ladders from the effort axis, and
advertises the family default as defaultReasoningEffort; swe-1-6-fast
stays its own row. swe-1-6 is marked text-only (live: it drops images
silently) so the vision fallback applies.

Uncapped turns send the selected row's catalog maxOutputTokens instead of
8192. CompletionConfiguration #3 is max_newlines, now a fixed value; the
input-ceiling plumbing that fed it a context window is removed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 09b9e6d)

* fix(devin): round a missing effort rung up, never down

An effort a family lacks now selects the lowest rung at or above it, then
the highest below. Nearest-rung sent `high` on SWE-1.7 (Medium, Max) to
Medium; it now selects the Max row. A disabled default rounds up the same
way and falls back down only when nothing above it is enabled.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
(cherry picked from commit ed6449e)

* fix(devin): keep a named disabled row and never lower effort for a toggle

A disabled exact uid asked for with an effort that still selects it (swe-2-max
at max) is now sent as named, so the preflight reports that row's refusal
instead of quietly serving swe-2-high. Family selection now ranks "effort not
lowered" ahead of the non-effort axes: a Fast anchor asked for at a rung the
Fast rows lack falls back to the regular row at or above that rung, and an
unranked member counts as lower. none is exempt, so Thinking-off still wins.

Co-authored-by: Sayo <hi@sayo.wtf>

* fix(devin): advertise minimal family effort

Co-authored-by: Sayo <hi@sayo.wtf>

* fix(devin): publish effective family default effort

Co-authored-by: Sayo <hi@sayo.wtf>

---------

Co-authored-by: Sayo <hi@sayo.wtf>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.

2 participants