Defend against ACP server reporting used > size#364
Draft
timvisher-dd wants to merge 1 commit intoxenodium:mainfrom
Draft
Defend against ACP server reporting used > size#364timvisher-dd wants to merge 1 commit intoxenodium:mainfrom
timvisher-dd wants to merge 1 commit intoxenodium:mainfrom
Conversation
e528a97 to
3e99679
Compare
3e99679 to
6d914d4
Compare
Open
1 task
Add comprehensive ERT tests for agent-shell-usage.el covering notification updates, context indicator scaling/colors, compaction replay, token saving, and number formatting. The ACP server has a bug where model switches cause used to exceed size in session/update notifications. Rather than clamping, signal unreliable data: indicator shows ? with warning face, format shows (?) instead of a bogus percentage. A regression test replays real observed traffic from the Opus 1M -> Sonnet 200k switch scenario. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6d914d4 to
c98e427
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.
The ACP server (claude-agent-acp) has a bug where model switches cause
usedto exceedsizeinsession/updatenotifications. For example, switching from Opus 1M to Sonnet 200k dropssizeto 200000 whileusedkeeps growing past it (observed: 419574/200000 = 209.8%). This results in nonsensical context indicators and percentages e.g. (from a real session)While I intend to get a fix for this improper reporting into claude-agent-acp, agent-shell should be robust against it. To that end, when the garbage usage data is observed, the UI now signals unreliable data instead of showing nonsense:
?with warning face whenused > size(?)instead of a bogus percentageThis also adds comprehensive ERT test coverage for
agent-shell-usage.el: notification updates, indicator scaling/colors, compaction replay, token saving, and number formatting.For the
claude-agent-acpside of this see zed-industries/claude-agent-acp#412Test plan