fix: redirect supervisor log functions to stderr (unblocks all workers)#796
fix: redirect supervisor log functions to stderr (unblocks all workers)#796marcusquinn merged 3 commits intomainfrom
Conversation
log_info, log_success, log_warn, and log_verbose were writing to stdout, which polluted return values of functions like resolve_task_model() when captured via $() subshells. This caused ProviderModelNotFoundError in all worker dispatches because the model string contained ANSI-colored log lines prepended to the actual model identifier. log_error already used >&2 correctly. Now all log functions follow the Unix convention: logs to stderr, data to stdout.
|
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 implements a crucial fix by redirecting several supervisor logging functions from stdout to stderr within 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: Mon Feb 9 18:38:04 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
…l IDs CRITICAL: openrouter dispatch was draining budget — all fallback chains now use only anthropic/ and google/ providers (the only ones configured in OpenCode). Also updated stale model IDs: - haiku: claude-3-5-haiku-20241022 -> claude-haiku-4-5 - flash: gemini-2.5-flash-preview-05-20 -> gemini-2.5-flash - pro: gemini-2.5-pro-preview-06-05 -> gemini-2.5-pro - sonnet: claude-sonnet-4-20250514 -> claude-sonnet-4-5 Removed xai/grok-3 tier (not configured).
There was a problem hiding this comment.
Code Review
This pull request correctly fixes a critical bug where logging functions were writing to stdout, interfering with functions that return data via command substitution. Redirecting the log output to stderr is the right solution.
My review includes one suggestion to further improve the logging functions. It addresses an unsafe use of unquoted arguments, which could lead to bugs with certain inputs, and brings the functions into compliance with the repository's style guide by adding explicit return statements. This is a good opportunity to harden these widely-used helper functions.
| log_info() { echo -e "${BLUE}[SUPERVISOR]${NC} $*" >&2; } | ||
| log_success() { echo -e "${GREEN}[SUPERVISOR]${NC} $*" >&2; } | ||
| log_warn() { echo -e "${YELLOW}[SUPERVISOR]${NC} $*" >&2; } | ||
| log_error() { echo -e "${RED}[SUPERVISOR]${NC} $*" >&2; } | ||
| log_verbose() { [[ "${SUPERVISOR_VERBOSE:-}" == "true" ]] && echo -e "${BLUE}[SUPERVISOR]${NC} $*" || true; } | ||
| log_verbose() { [[ "${SUPERVISOR_VERBOSE:-}" == "true" ]] && echo -e "${BLUE}[SUPERVISOR]${NC} $*" >&2 || true; } |
There was a problem hiding this comment.
These logging functions have two issues that could lead to bugs and violate the repository's style guide:
-
Unquoted Argument Expansion (High Severity): The use of unquoted
$*is unsafe. It can lead to unexpected behavior due to word splitting and glob expansion if the log message contains special characters (e.g.,*, extra spaces). This can corrupt log messages or even execute unintended commands. -
Missing Explicit
return(Style Violation): The style guide (line 12) requires all functions to have an explicitreturnstatement. Addingreturn 0improves clarity and ensures compliance.
I've provided a suggestion that addresses both points for all the logging functions in this block by switching to printf. It's generally safer than echo for handling arbitrary string data and correctly quotes the arguments.
| log_info() { echo -e "${BLUE}[SUPERVISOR]${NC} $*" >&2; } | |
| log_success() { echo -e "${GREEN}[SUPERVISOR]${NC} $*" >&2; } | |
| log_warn() { echo -e "${YELLOW}[SUPERVISOR]${NC} $*" >&2; } | |
| log_error() { echo -e "${RED}[SUPERVISOR]${NC} $*" >&2; } | |
| log_verbose() { [[ "${SUPERVISOR_VERBOSE:-}" == "true" ]] && echo -e "${BLUE}[SUPERVISOR]${NC} $*" || true; } | |
| log_verbose() { [[ "${SUPERVISOR_VERBOSE:-}" == "true" ]] && echo -e "${BLUE}[SUPERVISOR]${NC} $*" >&2 || true; } | |
| log_info() { printf "%b %s\n" "${BLUE}[SUPERVISOR]${NC}" "$*" >&2; return 0; } | |
| log_success() { printf "%b %s\n" "${GREEN}[SUPERVISOR]${NC}" "$*" >&2; return 0; } | |
| log_warn() { printf "%b %s\n" "${YELLOW}[SUPERVISOR]${NC}" "$*" >&2; return 0; } | |
| log_error() { printf "%b %s\n" "${RED}[SUPERVISOR]${NC}" "$*" >&2; return 0; } | |
| log_verbose() { [[ "${SUPERVISOR_VERBOSE:-}" == "true" ]] && printf "%b %s\n" "${BLUE}[SUPERVISOR]${NC}" "$*" >&2 || true; return 0; } |
References
- According to the repository style guide, all shell script functions must have an explicit
returnstatement. The logging functionslog_info,log_success,log_warn,log_error, andlog_verboseare missing these. (link)
🔍 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: Mon Feb 9 18:42:22 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
The config template (Priority 2) was overriding the hardcoded fallback (Priority 4), so the previous .sh fix had no effect. Now the config template only uses anthropic/ and google/ providers. Also disabled openrouter gateway (enabled: false) and updated all model IDs to current versions.
🔍 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: Mon Feb 9 18:43:35 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|
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
…-e and printf return (#4369) 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



Summary
log_info,log_success,log_warn, andlog_verboseto stderr (>&2) insupervisor-helper.shlog_erroralready used stderr correctly; now all log functions follow Unix convention (logs to stderr, data to stdout)Problem
All worker dispatches in batch
backlog-10(14 tasks) were failing immediately withProviderModelNotFoundError. The model string passed to OpenCode contained ANSI-colored log lines becauseresolve_task_model()useslog_info(stdout) and returns its value viaecho(also stdout). When captured via$(), the caller received:...instead of just
openrouter/anthropic/claude-opus-4-6.Impact
resolve_model()also haslog_verbosecalls that would pollute stdout whenSUPERVISOR_VERBOSE=trueTesting
bash -nsyntax check: PASSshellcheck -S warning: PASS (only pre-existing unused var warnings)$(test_function)captures clean single-line model string with log going to stderr