-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(context-window-monitor): add progressive warnings at 50%, 60%, 70%, 80% #1333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
feat(context-window-monitor): add progressive warnings at 50%, 60%, 70%, 80% #1333
Conversation
|
All contributors have signed the CLA. Thank you! ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 1 file
Confidence score: 4/5
- This PR looks safe to merge with low risk; the single issue is moderate severity (4/10) and mainly affects warning ordering rather than core functionality.
- In
src/hooks/context-window-monitor.ts, skipped thresholds can lead to lower-urgency warnings firing after a critical warning, which may confuse users monitoring usage levels. - Pay close attention to
src/hooks/context-window-monitor.ts- threshold notification order and backfilled warnings.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/hooks/context-window-monitor.ts">
<violation number="1" location="src/hooks/context-window-monitor.ts:122">
P2: Only the highest threshold is marked as notified, so if usage skips thresholds (e.g., 40% → 80%), subsequent runs will emit lower-urgency warnings after the critical warning. This creates out-of-order backfilling of alerts and likely defeats the intended progressive warning behavior.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
da08a63 to
0706e36
Compare
d52d829 to
1584137
Compare
|
Thanks @cubic-dev-ai for catching this issue! Fixed in the latest commit - now when a threshold is triggered, all lower thresholds are also marked as notified. This prevents out-of-order warnings when usage jumps (e.g., 40% → 80%). |
…0%, 80% - Replace single 70% threshold with progressive warnings - Add ANSI color coding for visual urgency (blue → yellow → orange → red) - Track notified thresholds per session to avoid duplicate alerts - Mark all lower thresholds as notified to prevent out-of-order warnings - Each threshold triggers once with appropriate urgency level: - 50% INFO: checkpoint notification - 60% NOTICE: awareness notification - 70% WARNING: caution notification - 80% CRITICAL: urgent action needed
1584137 to
a0ded61
Compare
Summary
Add stepped context window warnings instead of a single 70% threshold notification.
Changes
Motivation
Previously, users only received a single notification at 70% context usage. By the time they noticed, it was often too late to wrap up work before hitting the 80%+ limit where sessions can become unresponsive.
With progressive warnings, users get early awareness (50%, 60%) and can plan accordingly, with increasingly urgent notifications as context fills up.
Testing
bun run typecheckpassesbun run buildsucceedsScreenshots
N/A (terminal color output)
Summary by cubic
Replace the single 70% context alert with progressive warnings at 50%, 60%, 70%, and 80% to give earlier, clearer signals. Adds color-coded urgency and triggers each level only once per session.
Written for commit a0ded61. Summary will update on new commits.