Skip to content

fix: status bar accumulation and percentage display#19

Merged
tuanhung303 merged 2 commits intomasterfrom
fix/status-bar-accumulation-and-percentage
Feb 8, 2026
Merged

fix: status bar accumulation and percentage display#19
tuanhung303 merged 2 commits intomasterfrom
fix/status-bar-accumulation-and-percentage

Conversation

@tuanhung303
Copy link
Owner

Summary

  • Fix status bar not accumulating prune counts from 5 missing categories (url, stateQuery, snapshot, retry, purgeErrors)
  • Fix percentage intermittently absent when sendAttemptedNotification() bypassed formatStatsHeader()
  • Extract shared sumAutoSupersede()/sumToolPruneStats() utilities to prevent future drift between status bar and /acp stats

Changes

File Change
lib/state/stats-utils.ts (new) Shared utilities: sumAutoSupersede() (dynamic via Object.values with type guards), sumToolPruneStats()
lib/state/index.ts Barrel export for stats-utils
lib/ui/utils.ts formatStatsHeader() uses sumToolPruneStats() — all 8 autoSupersede + purgeErrors
lib/commands/stats.ts /acp stats uses sumAutoSupersede() + data-driven breakdown for all 8 categories
lib/ui/notification.ts sendAttemptedNotification() prepends formatStatsHeader(state) with null-guard

Testing

  • 557 unit tests passed
  • 188 E2E tests passed
  • 0 failures

- Add MODEL_CONTEXT_WINDOWS map with known model context sizes (Claude, GPT, Gemini, DeepSeek)
- Compute context pressure per turn: rawWindow × 70% threshold, status labels (🟢🟡🟠🔴)
- Add contextPressure to SessionState (transient, recomputed each turn)
- Status bar: replace ₊ with | separator, show status emoji + percent (e.g. 🟡 59%)
- Reasoning notifications: show 🧠 (xN) instead of 🧠 "—" for thinking blocks
- Reminder checkpoint: show model info, remaining tokens, savings from pruning
- Replace static maxContextTokens with fallbackContextWindow + warningThresholdPercent
- Remove outputBufferPercent — use raw context window directly
- Add shared sumAutoSupersede/sumToolPruneStats utilities (lib/state/stats-utils.ts)
- Include all 8 autoSupersede categories + purgeErrors in status bar totals
- Fix sendAttemptedNotification bypassing formatStatsHeader on no-op paths
- Replace duplicated summation in /acp stats with shared utility
- Data-driven breakdown loop for all auto-supersede sub-categories

Fixes: status not accumulating (5 categories missing), percentage intermittently
absent (no-op notification path skipped stats header)
@tuanhung303 tuanhung303 merged commit cc348b0 into master Feb 8, 2026
3 checks passed
@tuanhung303 tuanhung303 deleted the fix/status-bar-accumulation-and-percentage branch February 9, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant