-
Notifications
You must be signed in to change notification settings - Fork 5
fix: replace excessive 2>/dev/null with log file redirects (t144) #463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
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. ✨ 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 |
Summary of ChangesHello @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 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
|
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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
9ccc620 to
d5c793d
Compare
🔍 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: Sat Feb 7 19:25:21 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|



Summary
log_stderr,suppress_stderr,init_log_file) toshared-constants.shand supervisor-specificlog_cmd+SUPERVISOR_LOGtosupervisor-helper.sh2>/dev/nullsuppressions with log file redirects across 6 scripts, making errors debuggable without cluttering terminal outputChanges by Script
supervisor-helper.sh~/.aidevops/logs/supervisor.logquality-loop-helper.shghAPI calls now show errors (callers already handle failures)speech-to-speech-helper.shmemory-helper.shmail-helper.shshared-constants.shinit_log_file(),log_stderr(),suppress_stderr()utilitiesCategorization of 2>/dev/null Usage
command -v,kill -0,pgrep,sysctl,/procreadsjqparsing with|| echofallback|| echo ""fallbackrm,mkdirwith|| true(race conditions)Testing
bash -nsyntax check: all 6 files passshellcheck -S error: zero violationsshellcheck -S warning: only pre-existing SC2034 (unused vars, not from this PR)Closes #441