t2897: Remove blanket stderr suppression and fix macOS pgrep incompatibility#2945
Conversation
…p -c incompatibility Address PR #2883 review feedback (Gemini Code Assist): - Remove 2>/dev/null from session-count-helper.sh calls in pre-edit-check.sh and aidevops-update-check.sh to surface diagnostic errors - Remove 2>/dev/null from pgrep calls in session-count-helper.sh (retain only on ps calls where PID race conditions justify suppression) - Fix pgrep -c flag usage (not available on macOS) — replace with pgrep | wc -l - Extend list_sessions() to include Cursor, Windsurf, and Aider details, matching the apps already counted by count_interactive_sessions() - Extract _print_session_detail() helper to reduce duplication Closes #2897
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the robustness and cross-platform compatibility of the session counting and listing scripts. By refining stderr suppression, it allows for better error visibility, while the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Fri Mar 6 02:22:03 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
There was a problem hiding this comment.
Code Review
This pull request effectively removes blanket stderr suppression from several shell scripts, improving error visibility and diagnostics. It also commendably fixes a pgrep portability issue for macOS by replacing the -c flag with a wc -l pipe. The refactoring in session-count-helper.sh to introduce a helper function and extend session listing is a great improvement for maintainability. I have a few minor suggestions to further streamline the code by removing some redundant normalization steps.
Note: Security Review did not run due to the size of the PR.
| local cursor_count=0 | ||
| cursor_count=$(pgrep -c -f 'Cursor\.app' 2>/dev/null || true) | ||
| cursor_count=$(pgrep -f 'Cursor\.app' | wc -l || true) | ||
| cursor_count=$((cursor_count + 0)) # normalize whitespace from wc |
| local windsurf_count=0 | ||
| windsurf_count=$(pgrep -c -f 'Windsurf' 2>/dev/null || true) | ||
| windsurf_count=$(pgrep -f 'Windsurf' | wc -l || true) | ||
| windsurf_count=$((windsurf_count + 0)) |
| local aider_count=0 | ||
| aider_count=$(pgrep -c -f 'aider' 2>/dev/null || true) | ||
| aider_count=$(pgrep -f 'aider' | wc -l || true) | ||
| aider_count=$((aider_count + 0)) |
…lper.sh Arithmetic expansion already handles leading whitespace from wc -l output, making the $((var + 0)) normalization steps unnecessary. Addresses Gemini Code Assist review feedback on PR #2945.
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Fri Mar 6 02:32:48 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|



Summary
2>/dev/nullstderr suppression from session-count-helper.sh calls inpre-edit-check.shandaidevops-update-check.sh, and frompgrepcalls insession-count-helper.sh— retaining2>/dev/nullonly onpscalls where PID race conditions justify itpgrep -cflag usage (not available on macOS) — replace withpgrep | wc -lfor portable process countinglist_sessions()to include Cursor, Windsurf, and Aider session details, matching the apps already counted bycount_interactive_sessions()Details
Addresses all 4 findings from Gemini Code Assist review on PR #2883:
2>/dev/null(medium)2>/dev/null(medium)2>/dev/nullfrom allpgrepinvocations (medium)Bonus fix: removing
2>/dev/nullexposed a pre-existing bug —pgrep -cis not available on macOS, causing usage errors on every invocation. Replaced with portablepgrep | wc -l.Extracted
_print_session_detail()helper to reduce code duplication inlist_sessions().Testing
session-count-helper.sh count/check/listall produce correct output with no stderr errors on macOSCloses #2897