Skip to content

t2897: Remove blanket stderr suppression and fix macOS pgrep incompatibility#2945

Merged
marcusquinn merged 2 commits intomainfrom
bugfix/t2897-pre-edit-check-review-feedback
Mar 6, 2026
Merged

t2897: Remove blanket stderr suppression and fix macOS pgrep incompatibility#2945
marcusquinn merged 2 commits intomainfrom
bugfix/t2897-pre-edit-check-review-feedback

Conversation

@marcusquinn
Copy link
Owner

Summary

  • Remove blanket 2>/dev/null stderr suppression from session-count-helper.sh calls in pre-edit-check.sh and aidevops-update-check.sh, and from pgrep calls in session-count-helper.sh — retaining 2>/dev/null only on ps calls where PID race conditions justify it
  • Fix pgrep -c flag usage (not available on macOS) — replace with pgrep | wc -l for portable process counting
  • Extend list_sessions() to include Cursor, Windsurf, and Aider session details, matching the apps already counted by count_interactive_sessions()

Details

Addresses all 4 findings from Gemini Code Assist review on PR #2883:

  1. pre-edit-check.sh:422 — removed 2>/dev/null (medium)
  2. aidevops-update-check.sh:253 — removed 2>/dev/null (medium)
  3. session-count-helper.sh pgrep calls — removed 2>/dev/null from all pgrep invocations (medium)
  4. session-count-helper.sh list_sessions() — extended to list all 5 app types, not just OpenCode and Claude Code (medium)

Bonus fix: removing 2>/dev/null exposed a pre-existing bug — pgrep -c is not available on macOS, causing usage errors on every invocation. Replaced with portable pgrep | wc -l.

Extracted _print_session_detail() helper to reduce code duplication in list_sessions().

Testing

  • ShellCheck: clean (only SC1091 info for sourced files)
  • Functional: session-count-helper.sh count/check/list all produce correct output with no stderr errors on macOS

Closes #2897

…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
@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 pgrep compatibility fix ensures consistent behavior on macOS. Additionally, the changes expand the monitoring capabilities to include more interactive AI session types, providing a more comprehensive overview of active processes.

Highlights

  • Error Handling Refinement: Removed blanket 2>/dev/null stderr suppression from calls to session-count-helper.sh in aidevops-update-check.sh and pre-edit-check.sh, and from pgrep invocations within session-count-helper.sh. Explicitly retained 2>/dev/null only for ps commands where PID race conditions justify it.
  • macOS Compatibility Fix: Addressed macOS pgrep -c incompatibility by replacing it with pgrep | wc -l for portable process counting across different operating systems.
  • Expanded Session Detection: Extended the list_sessions() function to display details for Cursor, Windsurf, and Aider sessions, in addition to the previously supported OpenCode and Claude Code sessions.
  • Code Duplication Reduction: Introduced a new helper function, _print_session_detail(), to centralize and reduce code duplication in the list_sessions() function.
Changelog
  • .agents/scripts/aidevops-update-check.sh
    • Removed 2>/dev/null from the session-count-helper.sh call to allow stderr output.
  • .agents/scripts/pre-edit-check.sh
    • Removed 2>/dev/null from the session-count-helper.sh call to allow stderr output.
  • .agents/scripts/session-count-helper.sh
    • Removed 2>/dev/null from pgrep -f '\.opencode' calls.
    • Added a comment to ps -o args= call for macOS fallback, explaining 2>/dev/null retention.
    • Removed 2>/dev/null from pgrep -x claude calls.
    • Added a comment to another ps -o args= call for macOS fallback, explaining 2>/dev/null retention.
    • Replaced pgrep -c -f 'Cursor\.app' with pgrep -f 'Cursor\.app' | wc -l and added a comment about macOS incompatibility.
    • Replaced pgrep -c -f 'Windsurf' with pgrep -f 'Windsurf' | wc -l.
    • Replaced pgrep -c -f 'aider' with pgrep -f 'aider' | wc -l.
    • Modified the list_sessions() output format description, removing | DIR.
    • Extracted _print_session_detail() helper function to reduce code duplication.
    • Refactored OpenCode and Claude Code session detail printing to use _print_session_detail.
    • Added new sections to list_sessions() to detect and list Cursor, Windsurf, and Aider sessions, utilizing _print_session_detail.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 6, 2026

Warning

Rate limit exceeded

@marcusquinn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 22 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.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4dc29a51-e730-40ee-bbd1-560ee4e7b6fe

📥 Commits

Reviewing files that changed from the base of the PR and between bf6fda2 and a701f8f.

📒 Files selected for processing (3)
  • .agents/scripts/aidevops-update-check.sh
  • .agents/scripts/pre-edit-check.sh
  • .agents/scripts/session-count-helper.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/t2897-pre-edit-check-review-feedback

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.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 108 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Fri Mar 6 02:22:01 UTC 2026: Code review monitoring started
Fri Mar 6 02:22:01 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 108

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 108
  • VULNERABILITIES: 0

Generated on: Fri Mar 6 02:22:03 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This normalization step is redundant. The subsequent arithmetic expansion count=$((count + cursor_count)) on the next line automatically handles any leading whitespace from the wc -l output. Removing this line would make the code more concise.

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))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the comment above, this normalization step is redundant because the arithmetic expansion on the next line handles whitespace from wc -l.

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))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the comments above, this normalization step is redundant because the arithmetic expansion on the next line handles whitespace from wc -l.

…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.
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 108 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Fri Mar 6 02:32:45 UTC 2026: Code review monitoring started
Fri Mar 6 02:32:46 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 108

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 108
  • VULNERABILITIES: 0

Generated on: Fri Mar 6 02:32:48 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 6, 2026

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.

quality-debt: .agents/scripts/pre-edit-check.sh — PR #2883 review feedback (medium)

1 participant