Skip to content

Conversation

@marcusquinn
Copy link
Owner

Summary

  • Add stderr logging infrastructure (log_stderr, suppress_stderr, init_log_file) to shared-constants.sh and supervisor-specific log_cmd + SUPERVISOR_LOG to supervisor-helper.sh
  • Replace 67 blanket 2>/dev/null suppressions with log file redirects across 6 scripts, making errors debuggable without cluttering terminal output
  • Remaining ~1,209 occurrences are legitimate (command existence checks, process management, jq/DB reads with fallbacks)

Changes by Script

Script Fixes What Changed
supervisor-helper.sh 62 State transitions, DB writes, gh/git ops, notifications → ~/.aidevops/logs/supervisor.log
quality-loop-helper.sh 7 gh API calls now show errors (callers already handle failures)
speech-to-speech-helper.sh 3 git pull, docker compose → existing S2S log file
memory-helper.sh 3 DB writes now warn on failure instead of silent
mail-helper.sh 1 WAL setup now warns on failure
shared-constants.sh +53 lines New init_log_file(), log_stderr(), suppress_stderr() utilities

Categorization of 2>/dev/null Usage

Category Count Action
Keep: command -v, kill -0, pgrep, sysctl, /proc reads ~150 Expected noise, suppression correct
Keep: jq parsing with || echo fallback ~250 Fallback handles error
Keep: DB reads with || echo "" fallback ~100 Fallback handles error
Fixed: DB writes, state transitions, git push/commit 67 → log file or stderr warning
Keep: rm, mkdir with || true (race conditions) ~20 Suppression correct

Testing

  • bash -n syntax check: all 6 files pass
  • shellcheck -S error: zero violations
  • shellcheck -S warning: only pre-existing SC2034 (unused vars, not from this PR)

Closes #441

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 7, 2026

Warning

Rate limit exceeded

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/t144

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.

@gemini-code-assist
Copy link

Summary of Changes

Hello @marcusquinn, 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 error handling and logging capabilities across several core shell scripts. By replacing indiscriminate 2>/dev/null suppressions with a structured logging approach, it ensures that critical errors are captured in dedicated log files or surfaced as warnings, making debugging and troubleshooting much more efficient without cluttering standard output. This change improves the reliability and maintainability of the codebase by providing better visibility into command failures.

Highlights

  • Centralized Stderr Logging Infrastructure: Introduced new utilities (init_log_file, log_stderr, suppress_stderr) in shared-constants.sh to manage stderr output. log_stderr redirects command errors to a script-specific log file, while suppress_stderr explicitly silences expected noise.
  • Enhanced Supervisor Logging: Implemented a dedicated log_cmd function in supervisor-helper.sh to redirect stderr from critical operations (DB writes, Git commands, PR lifecycle transitions, notifications) to ~/.aidevops/logs/supervisor.log, significantly improving debuggability.
  • Improved Error Visibility in Core Scripts: Replaced 67 instances of blanket 2>/dev/null suppression across mail-helper.sh, memory-helper.sh, quality-loop-helper.sh, speech-to-speech-helper.sh, and supervisor-helper.sh. Errors from operations like database migrations, GitHub API calls, Git commands, and Docker compose are now either logged to a file or produce explicit warnings to stderr.
  • Differentiated Stderr Handling: Established clear guidelines for stderr handling: log_stderr for errors that matter (e.g., DB, API, Git), suppress_stderr for expected noise (e.g., command -v, kill -0), and retaining 2>/dev/null || true for race conditions (e.g., rm, mkdir).
Changelog
  • .agents/scripts/mail-helper.sh
    • Modified ensure_db function to output a warning to stderr if enabling WAL mode for the mail database fails, instead of silently failing.
  • .agents/scripts/memory-helper.sh
    • Updated ensure_db to warn on stderr if enabling WAL mode for the memory database fails.
    • Modified logic for adding auto_captured column to learning_access table to warn on stderr if the operation fails.
    • Changed access history transfer logic to warn on stderr if the UPDATE operation fails.
  • .agents/scripts/quality-loop-helper.sh
    • Removed 2>/dev/null from gh pr view calls in get_pending_checks and check_pr_status to allow stderr output.
    • Removed 2>/dev/null from gh api calls in get_pr_feedback for comments and check run annotations.
    • Removed 2>/dev/null from gh pr view calls in check_and_trigger_review for last push time and last AI review time.
  • .agents/scripts/shared-constants.sh
    • Added init_log_file function to initialize a script-specific log file path.
    • Added log_stderr function to execute a command and redirect its stderr to the script's log file, logging context and exit code.
    • Added suppress_stderr function to explicitly suppress stderr for commands where it's considered expected noise.
  • .agents/scripts/speech-to-speech-helper.sh
    • Redirected stderr from git pull --ff-only to $S2S_LOG_FILE during setup.
    • Redirected stderr from docker compose ps --quiet and docker compose ps --format to $S2S_LOG_FILE for status checks and stopping containers.
  • .agents/scripts/supervisor-helper.sh
    • Introduced SUPERVISOR_LOG variable and log_cmd function for supervisor-specific stderr logging to ~/.aidevops/logs/supervisor.log.
    • Migrated DB operations (adding columns, enabling WAL mode) to use log_cmd or explicit stderr redirection to SUPERVISOR_LOG.
    • Updated run_batch_retrospective to redirect stderr to SUPERVISOR_LOG.
    • Modified cleanup_task_worktree to redirect stderr from wt remove and git worktree remove to SUPERVISOR_LOG.
    • Changed evaluate_worker and check_pr_status to redirect stderr from gh pr list and gh pr view calls to SUPERVISOR_LOG.
    • Updated sqlite3 UPDATE operations for task PR URLs and retry counts to use log_cmd or redirect stderr to SUPERVISOR_LOG.
    • Modified run_postflight_for_task to redirect stderr from git pull commands to SUPERVISOR_LOG.
    • Updated cleanup_after_merge to redirect stderr from git push, git branch -d, wt prune, and git worktree prune to SUPERVISOR_LOG.
    • Changed cmd_pr_lifecycle to redirect stderr from cmd_transition, send_task_notification, and db updates to SUPERVISOR_LOG.
    • Modified cmd_pulse to redirect stderr from cmd_auto_pickup, cmd_transition, update_todo_on_complete, send_task_notification, store_success_pattern, store_failure_pattern, and cmd_reprompt to SUPERVISOR_LOG.
    • Updated update_todo_on_complete and update_todo_on_blocked to redirect stderr from git diff, git commit, and git push operations to SUPERVISOR_LOG.
Activity
  • The author, marcusquinn, initiated this pull request to address the issue of excessive 2>/dev/null usage, aiming to improve debugging capabilities.
  • A new logging infrastructure has been designed and implemented in shared-constants.sh to provide structured stderr handling.
  • The supervisor-helper.sh script has been significantly refactored to utilize the new logging utilities, redirecting numerous command errors to a dedicated log file.
  • Several other helper scripts (mail-helper.sh, memory-helper.sh, quality-loop-helper.sh, speech-to-speech-helper.sh) have been updated to either log errors or provide explicit warnings instead of silently discarding stderr.
  • The pull request description details the categorization of 2>/dev/null usage, distinguishing between legitimate suppressions and those that have been fixed, indicating a thorough analysis of the codebase.
  • Testing included bash -n syntax checks and shellcheck analysis, with all files passing syntax checks and zero new shellcheck violations at the error level.
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.

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 introduces a significant improvement by replacing widespread 2>/dev/null error suppression with structured logging. The new log_stderr and log_cmd utilities provide a robust way to capture previously hidden errors, which will greatly enhance debuggability. The changes are applied consistently across numerous scripts, targeting critical operations like database writes, git commands, and API calls. This is a high-quality contribution that makes the system more transparent and easier to maintain. I've found two minor inconsistencies where an error suppression was unintentionally kept, and my feedback focuses on removing these to fully align the changes with the PR's goal.

current_mode=$(db "$MAIL_DB" "PRAGMA journal_mode;" 2>/dev/null || echo "")
if [[ "$current_mode" != "wal" ]]; then
db "$MAIL_DB" "PRAGMA journal_mode=WAL;" 2>/dev/null || true
db "$MAIL_DB" "PRAGMA journal_mode=WAL;" 2>/dev/null || echo "[WARN] Failed to enable WAL mode for mail DB" >&2

Choose a reason for hiding this comment

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

medium

While it's good to add a warning message on failure, the 2>/dev/null still suppresses the original, more specific error message from the db command. Removing it would allow the actual SQLite error to be printed to stderr, which would be more helpful for debugging, while still providing your fallback warning. This would also make it consistent with other similar changes in this PR where 2>/dev/null was completely removed.

Suggested change
db "$MAIL_DB" "PRAGMA journal_mode=WAL;" 2>/dev/null || echo "[WARN] Failed to enable WAL mode for mail DB" >&2
db "$MAIL_DB" "PRAGMA journal_mode=WAL;" || echo "[WARN] Failed to enable WAL mode for mail DB" >&2

current_mode=$(db "$MEMORY_DB" "PRAGMA journal_mode;" 2>/dev/null || echo "")
if [[ "$current_mode" != "wal" ]]; then
db "$MEMORY_DB" "PRAGMA journal_mode=WAL;" 2>/dev/null || true
db "$MEMORY_DB" "PRAGMA journal_mode=WAL;" 2>/dev/null || echo "[WARN] Failed to enable WAL mode for memory DB" >&2

Choose a reason for hiding this comment

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

medium

Similar to the change in mail-helper.sh, the 2>/dev/null here suppresses the specific error from the db command. To improve debuggability, it's better to let the original error message be displayed. Other database-related changes in this same file (e.g., on line 293) have correctly removed the 2>/dev/null, and this line should follow that pattern for consistency.

Suggested change
db "$MEMORY_DB" "PRAGMA journal_mode=WAL;" 2>/dev/null || echo "[WARN] Failed to enable WAL mode for memory DB" >&2
db "$MEMORY_DB" "PRAGMA journal_mode=WAL;" || echo "[WARN] Failed to enable WAL mode for memory DB" >&2

Add stderr logging infrastructure to shared-constants.sh (init_log_file,
log_stderr, suppress_stderr) and supervisor-helper.sh (SUPERVISOR_LOG,
log_cmd).

Replace 67 blanket 2>/dev/null suppressions with log file redirects:
- supervisor-helper.sh: 62 fixes (state transitions, DB writes, gh/git
  operations, notifications, memory/pattern storage) now log to
  ~/.aidevops/logs/supervisor.log
- speech-to-speech-helper.sh: 3 fixes (git pull, docker compose) now
  log to existing S2S log file
- quality-loop-helper.sh: 7 fixes (gh API calls) now show errors
  directly since callers already handle failures
- memory-helper.sh: 3 fixes (DB writes) now warn on failure
- mail-helper.sh: 1 fix (WAL setup) now warns on failure

Remaining 1,209 occurrences are legitimate: command -v, kill -0, pgrep,
jq with || echo fallbacks, DB reads with fallbacks.

Closes #441
@marcusquinn marcusquinn merged commit 3b05888 into main Feb 7, 2026
8 of 10 checks passed
@github-actions
Copy link

github-actions bot commented Feb 7, 2026

🔍 Code Quality Report

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

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Sat Feb 7 19:25:18 UTC 2026: Code review monitoring started
Sat Feb 7 19:25:19 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 27
Sat Feb 7 19:25:19 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Sat Feb 7 19:25:21 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 27
  • VULNERABILITIES: 0

Generated on: Sat Feb 7 19:25:21 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 7, 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.

t144: quality: excessive 2>/dev/null suppresses real errors across supervisor and helpers

1 participant