Skip to content

fix: redirect supervisor log functions to stderr (unblocks all workers)#796

Merged
marcusquinn merged 3 commits intomainfrom
bugfix/resolve-model-stdout
Feb 9, 2026
Merged

fix: redirect supervisor log functions to stderr (unblocks all workers)#796
marcusquinn merged 3 commits intomainfrom
bugfix/resolve-model-stdout

Conversation

@marcusquinn
Copy link
Copy Markdown
Owner

Summary

  • Redirects log_info, log_success, log_warn, and log_verbose to stderr (>&2) in supervisor-helper.sh
  • log_error already 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 with ProviderModelNotFoundError. The model string passed to OpenCode contained ANSI-colored log lines because resolve_task_model() uses log_info (stdout) and returns its value via echo (also stdout). When captured via $(), the caller received:

[SUPERVISOR] Model for t135.3: openrouter/anthropic/claude-opus-4-6 (default coding tier)
openrouter/anthropic/claude-opus-4-6

...instead of just openrouter/anthropic/claude-opus-4-6.

Impact

  • Unblocks: All 14 tasks in backlog-10 batch (t135.3-t135.14, t020.1-t020.6)
  • Fixes latent bug: resolve_model() also has log_verbose calls that would pollute stdout when SUPERVISOR_VERBOSE=true
  • No behavioral change: Log output still visible in terminal/cron logs (stderr is captured by log files)

Testing

  • bash -n syntax check: PASS
  • shellcheck -S warning: PASS (only pre-existing unused var warnings)
  • Manual test: $(test_function) captures clean single-line model string with log going to stderr

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.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 9, 2026

Warning

Rate limit exceeded

@marcusquinn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 27 minutes and 23 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 bugfix/resolve-model-stdout

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
Copy Markdown

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 implements a crucial fix by redirecting several supervisor logging functions from stdout to stderr within supervisor-helper.sh. This change ensures that only the intended data is passed through stdout, preventing log messages from corrupting the output of command substitutions. The resolution unblocks a significant number of failing tasks and aligns the logging behavior with standard Unix practices, improving the robustness of the system.

Highlights

  • Log Redirection: Redirected log_info, log_success, log_warn, and log_verbose functions in supervisor-helper.sh to output to stderr (>&2), aligning them with Unix logging conventions.
  • Problem Resolution: This change resolves an issue where log messages were incorrectly sent to stdout, causing command substitutions to capture log lines along with intended data, leading to ProviderModelNotFoundError errors.
  • Task Unblocking: Successfully unblocks 14 tasks in the backlog-10 batch (t135.3-t135.14, t020.1-t020.6) that were failing due to the polluted stdout.
  • Latent Bug Fix: Addresses a latent bug where log_verbose calls could also pollute stdout when SUPERVISOR_VERBOSE=true.
Changelog
  • .agents/scripts/supervisor-helper.sh
    • Modified log_info, log_success, log_warn, and log_verbose functions to explicitly direct their output to stderr (>&2).
Activity
  • The author has provided a detailed summary of the problem, solution, impact, and testing performed.
  • Syntax check (bash -n) and static analysis (shellcheck -S warning) passed.
  • Manual testing confirmed clean single-line model string capture with logs going to stderr.
  • No human activity (comments, reviews, approvals) is mentioned in the provided context.
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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 9, 2026

🔍 Code Quality Report

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

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Mon Feb 9 18:38:01 UTC 2026: Code review monitoring started
Mon Feb 9 18:38:01 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 60

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 60
  • VULNERABILITIES: 0

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).
Copy link
Copy Markdown

@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 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.

Comment on lines +230 to +234
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; }
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

These logging functions have two issues that could lead to bugs and violate the repository's style guide:

  1. 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.

  2. Missing Explicit return (Style Violation): The style guide (line 12) requires all functions to have an explicit return statement. Adding return 0 improves 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.

Suggested change
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
  1. According to the repository style guide, all shell script functions must have an explicit return statement. The logging functions log_info, log_success, log_warn, log_error, and log_verbose are missing these. (link)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 9, 2026

🔍 Code Quality Report

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

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Mon Feb 9 18:42:19 UTC 2026: Code review monitoring started
Mon Feb 9 18:42:19 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 60

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 60
  • VULNERABILITIES: 0

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

github-actions bot commented Feb 9, 2026

🔍 Code Quality Report

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

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Mon Feb 9 18:43:33 UTC 2026: Code review monitoring started
Mon Feb 9 18:43:33 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 60

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 60
  • VULNERABILITIES: 0

Generated on: Mon Feb 9 18:43:35 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Feb 9, 2026

@marcusquinn marcusquinn merged commit bd93ce4 into main Feb 9, 2026
10 checks passed
@marcusquinn marcusquinn deleted the bugfix/resolve-model-stdout branch February 21, 2026 01:59
alex-solovyev added a commit that referenced this pull request Mar 13, 2026
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
alex-solovyev added a commit that referenced this pull request Mar 13, 2026
…-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
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.

1 participant