fix(recap): skip when there's no LLM conversation to summarize#149
Merged
Conversation
Reported: the recap card fires after slash commands like /commit and the model has nothing to summarize, so it hallucinates output like "I don't have access to any previous conversation — this appears to be the start of our session." Cause: useRecap watches streamingState transitions and counts UI-level tool_group entries to decide if a turn was tool-heavy. Slash commands do flip streamingState and do produce many tool_group entries, but they bypass GeminiChat — `geminiClient.getHistory()` is empty when the recap fires. generateRecap then ships its prompt with no prior context and the model can only hallucinate. Fix: gate the recap on the conversation containing at least one model-role AND one user-role entry. Slash-command-only turns short-circuit before the LLM call. Real LLM turns (single or multi-turn) still recap as before. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
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.
Bug
After a slash command like
/commitfinishes, the recap card fires with hallucinated output:Cause
`useRecap` watches `streamingState` Idle transitions and counts UI-level `tool_group` entries to decide if the turn was tool-heavy. Slash commands like `/commit` do flip streamingState (so the loading indicator works) and do produce many tool_group entries, but they bypass `GeminiChat` — `geminiClient.getHistory()` is empty when the recap fires. `generateRecap` then ships its prompt with no prior context and the model can only hallucinate.
Fix
Gate the recap on the conversation containing at least one model-role and at least one user-role entry. Slash-command-only turns short-circuit before the LLM call. Real LLM turns (single-turn or multi-turn) still recap as before.
Tests
3,767 cli tests pass.
🤖 Generated with Claude Code
Summary by CodeRabbit