Skip to content

Conversation

@linw1995
Copy link
Owner

Summary

Implements idle timeout notification feature for TUI chat as described in #162.

Changes

  • IdleTracker module: New module to track user inactivity and trigger periodic notifications
  • Notification config refactor:
    • Replaced only_when_unfocused boolean with flexible NotificationWhen enum (Focused/Unfocused/Always)
    • Added granular notification rules for different events (reply_ready, action_required)
  • Idle notification settings: Configurable timeout (default 5min), max notifications (default 1), and interval (default 1min)
  • Chat component integration: Polls idle tracker and sends reminders when response is needed

Key Features

✅ Idle timeout detection with configurable duration
✅ Periodic reminders with max limit
✅ Resets on user activity (keyboard input)
✅ Focus-aware (Focused/Unfocused/Always modes)
✅ Backward compatible (disabled by default)

Default Config

[ui.notifications]
enabled = true

[ui.notifications.reply_ready]
enabled = true
when = "unfocused"  # focused, unfocused, always

[ui.notifications.action_required]
enabled = true
when = "unfocused"

[ui.notifications.idle]
enabled = true
timeout_seconds = 300    # 5 minutes
max_notifications = 1
interval_seconds = 60    # 1 minute
when = "always"

Closes #162

- Add IdleTracker module to track user inactivity and trigger periodic notifications
- Refactor notification config to support granular rules (reply_ready, action_required)
- Replace only_when_unfocused boolean with flexible NotificationWhen enum (Focused/Unfocused/Always)
- Add idle notification configuration with timeout, max notifications, and interval settings
- Update chat component to poll idle tracker and send reminders when response is needed
- Export new notification types (NotificationRule, IdleNotification, NotificationWhen) from config
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 75.55556% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.08%. Comparing base (c3970cb) to head (d4cb347).
⚠️ Report is 4 commits behind head on dev.

Files with missing lines Patch % Lines
crates/coco-tui/src/components/chat.rs 0.00% 51 Missing ⚠️
crates/coco-tui/src/idle_tracker.rs 95.78% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #167      +/-   ##
==========================================
+ Coverage   47.59%   48.08%   +0.49%     
==========================================
  Files         100      105       +5     
  Lines       27316    27896     +580     
==========================================
+ Hits        13000    13413     +413     
- Misses      14316    14483     +167     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@linw1995 linw1995 merged commit 193535d into dev Jan 31, 2026
3 checks passed
@linw1995 linw1995 deleted the feature/tui-idle-timeout-notify branch January 31, 2026 04:37
@linw1995 linw1995 added the enhancement New feature or request label Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add idle timeout notification when terminal is focused

3 participants