fix(slash): preserve /compact ordering and resume state#80
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
Hardens
/compactafter review so compact boundaries flush before queued writes, summarization keeps every streamed text fragment, and resume reconstructs the compact tail without replaying stale pre-compact messages.The pass also normalizes prompt / comment prose around instruction text, removes avoidable lint suppressions through smaller helpers, and tightens shared TUI rendering code that the compact block depends on.
Design decisions
SessionCmd::Compactnow forces the actor batch to flush before later queued commands run, so prompts typed during compaction cannot share the same buffered write after the boundary.CompactInfofor resume display, resets sidecars at the boundary, and only accepts messages from the new compact tail. This preserves archival JSONL while keeping the active replay chain compact-aware.content_block_startandcontent_block_delta, matching the wire protocol rather than assuming all text arrives as deltas.#[expect]use where the code was reducible.Changes
agent/compaction.rssession/actor.rs,session/state.rs,session/handle.rssession/entry.rs,session/store.rsCompactInfo, load compact boundaries explicitly, filter stale old-chain writes, and extract the compact-aware loader builder.agent/event.rs,main.rs,tui/app.rs,tui/components/chat.rstui/components/chat/blocks*,tui/components/input.rsprompt/sections.rs,prompt/instructions.rs,session/title_generator.rs,slash/init.rs,docs/design/slash/compact.mdTest plan
cargo fmt --all --checkcargo buildcargo clippy --all-targets -- -D warnings: zero warningscargo test: 1919 tests passcargo llvm-cov --ignore-filename-regex 'main\.rs': 98.62% line coveragepnpm lintpnpm spellcheck