fix(task): report emergency condense like the automatic path - #1838
PierrunoYT wants to merge 1 commit into
Conversation
The emergency condense in handleContextWindowExceededError duplicated the automatic path's result handling and had diverged: - Its condense_context event carried no condenseId, so rewind cleanup could not remove the emergency summary; deleting the condense row cut after the summary and left it in place. - A condense error returned by manageContext was dropped instead of being shown as condense_context_error. - It ignored the custom CONDENSE prompt and did not pass filesReadByRoo, cwd, or rooIgnoreController. Both paths now report through one reportContextManagementResult helper, and the emergency call passes the same condense settings. The profile threshold overriding the forced 75% is left for a follow-up. Fixes Zoo-Code-Org#1769 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 14 minutes. View limit detailsLimit details: You’ve used all 4 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository: Zoo-Code-Org/Zoo-Code/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review statusThanks for contributing. This comment tracks the review sequence and the next action. Current step: Required CI passed. Waiting for automated review of the latest commit. If automated review does not start, a maintainer must restart it. Review-state labels are managed by this workflow; do not edit them manually. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Related GitHub Issue
Closes: #1769
Description
The emergency condense in
handleContextWindowExceededErrorcopied the automatic path's result handling instead of sharing it, and the copy had drifted. This PR fixes the two defects from the issue and one of the argument divergences.condenseIdon the event. The emergencycondense_contextevent had nocondenseId, soMessageManager's id-based rewind cleanup could never remove the emergency summary. Deleting the condense row cut the history after the summary (summary at last message + 1, row emitted later), which left the summary in place.manageContextwas dropped. It now shows ascondense_context_error, as on the automatic path.reportContextManagementResulthelper (error row, then the condense event or the truncation row), so the fields can't drift apart again. For the automatic path this is a pure move with no behaviour change.manageContextcall now also passes the customCONDENSEprompt,filesReadByRoo,cwd, androoIgnoreController, so a recovery summary is built like an automatic one.The manual
condenseContext()path is unchanged. It callssummarizeConversationdirectly, returns early on error, and already emittedcondenseIdand the error row.Not included: divergence 4, where a profile threshold can override the forced 75% during recovery. It changes recovery behaviour, so it belongs in a separate follow-up (Open question 2 in the issue).
Test Procedure
New regression tests:
Task.spec.ts→emergency condense reporting (#1769). These call the realhandleContextWindowExceededError, not a mock:contextCondense.condenseIdequal to the summary's id, and summarizes with the custom prompt andcwd.condense_context_error, followed by the fallbacksliding_window_truncationrow.Task.ts.message-manager/index.spec.ts: deleting the emergency condense row removes the summary when the event carries acondenseId. A second case shows the summary survives when the id is missing, which was the pre-fix behaviour.Commands:
Results: 378 tests passed; type checking and ESLint passed (also via the commit hook). ESLint suppression counts are unchanged.
Pre-Submission Checklist
Visual Snapshots
Not applicable; no UI changes.
Videos (interaction / animation only)
Not applicable.
Documentation Updates
Additional Notes
Follow-up candidate from the issue's open questions: let recovery take precedence over
profileThresholds(an empty threshold map on the emergency call, or aforceThresholdflag onmanageContext). With a profile threshold of 95%, today's emergency call can return the history unchanged with no event at all.🤖 Generated with Claude Code