Skip to content

Conversation

@wkramme
Copy link
Contributor

@wkramme wkramme commented Feb 9, 2026

This PR adds two features to the console spinner:

Features

1. Elapsed Time Display

Shows how long the spinner has been running in the format [M:SS] or [H:MM:SS] for longer operations. This helps users understand how long they've been waiting.

2. Optional Alert Bell

When enabled via config, rings the system bell after a configurable threshold (default 30 seconds) to alert users that a long-running task needs attention. The bell only rings once per spinner session.

Configuration

/set alert_bell_enabled=true
/set alert_bell_threshold=30

Changes

  • code_puppy/config.py: Added config keys and getter/setter functions
  • code_puppy/messaging/spinner/console_spinner.py: Added elapsed time display and bell alert logic
  • tests/messaging/spinner/test_console_spinner_elapsed.py: Added unit tests

Summary by CodeRabbit

  • New Features

    • Configurable alert bell notifications with enable/disable and adjustable threshold (default 30s).
    • Real-time elapsed-time display in [M:SS] or [H:MM:SS] during long-running operations.
    • Bell emits at most once per operation when enabled and threshold is exceeded.
  • Tests

    • Added unit tests for elapsed-time formatting and bell alert behavior (thresholding, single-alert, disabled state).

@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

Warning

Rate limit exceeded

@wkramme has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 17 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

Adds alert-bell configuration and APIs plus elapsed-time tracking and a one-shot audible bell to the console spinner; includes unit tests for elapsed formatting and bell behavior. Duplicate insertion of the alert-bell APIs is present in config.py.

Changes

Cohort / File(s) Summary
Alert Bell Configuration
code_puppy/config.py
Adds default config keys alert_bell_enabled (default false) and alert_bell_threshold (default 30). Adds public APIs: get_alert_bell_enabled(), set_alert_bell_enabled(enabled), get_alert_bell_threshold(), set_alert_bell_threshold(seconds). Note: the new APIs appear duplicated in the file.
Console Spinner Enhancement
code_puppy/messaging/spinner/console_spinner.py
Adds private _start_time and _bell_triggered, _get_elapsed_str() for [M:SS]/[H:MM:SS] formatting, and _check_bell_alert() to emit a one-shot system bell when elapsed >= configured threshold and enabled. Integrates elapsed text into spinner output and invokes bell check during updates; _generate_spinner_panel now returns text content including elapsed.
Tests — Spinner Elapsed & Bell
tests/messaging/spinner/test_console_spinner_elapsed.py, tests/test_config.py
Adds tests for elapsed formatting (empty, seconds, minutes, hours) and bell behavior (disabled, before threshold, triggers once after threshold, no repeated triggers). Updates config tests to expect new keys alert_bell_enabled and alert_bell_threshold.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Spinner as ConsoleSpinner
participant Config as Config API
participant Stdout as Stdout
rect rgba(200,230,201,0.5)
Spinner->>Spinner: start() sets _start_time, _bell_triggered = False
end
rect rgba(187,222,251,0.5)
loop update loop
Spinner->>Spinner: compute elapsed = now - _start_time
Spinner->>Config: get_alert_bell_enabled()
Spinner->>Config: get_alert_bell_threshold()
alt enabled AND elapsed >= threshold AND not _bell_triggered
Spinner->>Stdout: write("\a") and flush
Spinner->>Spinner: set _bell_triggered = True
else
Spinner->>Spinner: update display with elapsed text
end
end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I hopped in to time the spin,
A tiny bell to nudge and grin,
One ring only when minutes grow,
I thumped my paw — the bell said "go",
Spinner hums; the rabbit's win! 🐇🔔

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding spinner elapsed time display and optional alert bell functionality.
Docstring Coverage ✅ Passed Docstring coverage is 91.30% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@wkramme wkramme force-pushed the feature/spinner-elapsed-time branch from 441b46f to fb79f6d Compare February 9, 2026 15:21
@wkramme
Copy link
Contributor Author

wkramme commented Feb 9, 2026

The Ubuntu test failures are pre-existing issues with test_grep_basic_search and test_grep_multiple_matches in tests/tools/test_file_operations_coverage.py - they appear to be environment-dependent (likely ripgrep installation/configuration in the CI runner) and unrelated to my changes.

✅ Quality checks pass
✅ macOS tests pass
❌ Ubuntu fails only on pre-existing grep tests

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