GH#3605: fix critical quality-debt from PR #796 review — unsafe echo -e in supervisor log functions#4369
Conversation
PR #796 redirected log_info/success/warn/error/verbose to stderr, but the Gemini review flagged two remaining issues: 1. Unsafe argument handling: echo -e with $* can interpret backslash sequences in log messages (e.g. \n, \t) as escape codes, corrupting output. Switching to printf "%b %s\n" passes the message as a separate "%s" argument, preventing interpretation of backslash sequences in caller-supplied strings. 2. Explicit return 0 statements are already present in the multi-line form in _common.sh (added during the supervisor modularisation). This commit preserves them and documents the printf rationale in the block comment. Closes #3605
|
Important Review skippedAuto reviews are limited based on label configuration. 🚫 Review skipped — only excluded labels are configured. (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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, 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 resolves a critical quality debt by refactoring the supervisor's logging functions to use 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
|
🔍 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 13 07:20:24 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a critical security issue by replacing the unsafe echo -e with printf for logging. This prevents potential log corruption or unexpected behavior from special characters in log messages. My review includes suggestions to further improve the robustness of these logging functions by ensuring they don't cause a script to exit on a logging failure, and to improve consistency across all the logging functions.
| printf "%b %s\n" "${BLUE}[SUPERVISOR]${NC}" "$*" >&2 | ||
| return 0 |
There was a problem hiding this comment.
For improved robustness, consider adding || true to the printf command. This prevents the script from exiting on a logging failure (e.g., a broken pipe on stderr) when set -e is active. This change also makes the explicit return 0 redundant, as the command will always succeed.
| printf "%b %s\n" "${BLUE}[SUPERVISOR]${NC}" "$*" >&2 | |
| return 0 | |
| printf "%b %s\n" "${BLUE}[SUPERVISOR]${NC}" "$*" >&2 || true |
References
- When
set -eis active, using|| truefor non-critical commands like logging prevents the script from exiting prematurely on minor failures (e.g., broken pipe), ensuring robustness.
| printf "%b %s\n" "${GREEN}[SUPERVISOR]${NC}" "$*" >&2 | ||
| return 0 |
There was a problem hiding this comment.
For consistency and robustness, consider adding || true here as well. This prevents script termination on logging failures and makes the return 0 redundant.
| printf "%b %s\n" "${GREEN}[SUPERVISOR]${NC}" "$*" >&2 | |
| return 0 | |
| printf "%b %s\n" "${GREEN}[SUPERVISOR]${NC}" "$*" >&2 || true |
References
- When
set -eis active, using|| truefor non-critical commands like logging prevents the script from exiting prematurely on minor failures (e.g., broken pipe), ensuring robustness.
| printf "%b %s\n" "${YELLOW}[SUPERVISOR]${NC}" "$*" >&2 | ||
| return 0 |
There was a problem hiding this comment.
For consistency and robustness, consider adding || true here as well. This prevents script termination on logging failures and makes the return 0 redundant.
| printf "%b %s\n" "${YELLOW}[SUPERVISOR]${NC}" "$*" >&2 | |
| return 0 | |
| printf "%b %s\n" "${YELLOW}[SUPERVISOR]${NC}" "$*" >&2 || true |
References
- When
set -eis active, using|| truefor non-critical commands like logging prevents the script from exiting prematurely on minor failures (e.g., broken pipe), ensuring robustness.
| printf "%b %s\n" "${RED}[SUPERVISOR]${NC}" "$*" >&2 | ||
| return 0 |
There was a problem hiding this comment.
For consistency and robustness, consider adding || true here as well. This prevents script termination on logging failures and makes the return 0 redundant.
| printf "%b %s\n" "${RED}[SUPERVISOR]${NC}" "$*" >&2 | |
| return 0 | |
| printf "%b %s\n" "${RED}[SUPERVISOR]${NC}" "$*" >&2 || true |
References
- When
set -eis active, using|| truefor non-critical commands like logging prevents the script from exiting prematurely on minor failures (e.g., broken pipe), ensuring robustness.



Summary
Fixes the two issues flagged by the Gemini code review on PR #796:
Unsafe argument handling (
echo -ewith$*):echo -einterprets backslash sequences in the message string. If a log message contains\n,\t, or other escape sequences, they would be silently transformed, corrupting log output. Switching toprintf "%b %s\n"passes the caller's message as a%sargument — backslash sequences in$*are never interpreted.Explicit
return 0statements: Already present in the multi-line form in_common.sh(added during the supervisor modularisation in t1031: Modularize supervisor-helper.sh into domain modules #1359). This commit preserves them and adds a block comment documenting theprintfrationale.Changes
.agents/scripts/supervisor-archived/_common.sh: Replaceecho -e "... $*"withprintf "%b %s\n" "..." "$*"in all five logging functions (log_info,log_success,log_warn,log_error,log_verbose). Preserve existingreturn 0statements.Verification
log_verboseonly outputs whenSUPERVISOR_VERBOSE=true; all functions return 0Closes #3605