Repository navigation
Conversation
The Claude adapter dropped the compact_boundary system frame, so a /compact turn ended with no transcript content and the ring kept the pre-compaction size until the next reply. Emit a "Context compacted." note (as Codex does) and ContextUsage from post_tokens (as Pi does). Fixes zeronsh#801
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.
Fixes #801.
Problem
In a Claude Code chat,
/compactcompacts the session, but Zeron shows nothing. The turn ends with no transcript content, and the context ring keeps the old size until the next reply. The Claude normalizer drops thecompact_boundarysystem frame. A/compactturn also has no assistant frame, which is the only place the Claude adapter setsContextUsage.tokens.Change
On
system/compact_boundary, the Claude normalizer now emits:TextDelta("Context compacted."), thenAssistantMessageCompleted, so the note is its own message and any text after an auto-compaction starts fresh. This matches Codex'scontextCompactionnote.ContextUsage { tokens: compact_metadata.post_tokens }when the CLI sends it. This matches Pi'scompaction_end.No protocol or UI change.
wire.rsgains an optionalcompact_metadata.post_tokensfield.Testing
compact_boundary_shows_a_note_and_resets_context, using frames captured from Claude Code 2.1.289. It also covers older CLIs that send nopost_tokens: the note still shows and the ring is left alone.cargo test -p zeron-harness --liband--test claudepass./compactthroughClaudeHarness::runto the real CLI on a resumed session. It producedTextDelta "Context compacted."→AssistantMessageCompleted→ContextUsage { tokens: Some(1266) }→Done Completed.#800 also touches
claude/normalize.rs. This change sits in theFrame::Systemarm, so any conflict should be small.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.