Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .agents/scripts/fallback-chain-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,13 @@ get_chain_for_tier() {
# Use the existing model-availability-helper.sh tier mapping
local tier_spec=""
case "$tier" in
haiku) tier_spec='["anthropic/claude-3-5-haiku-20241022","google/gemini-2.5-flash","openrouter/anthropic/claude-3-5-haiku-20241022"]' ;;
flash) tier_spec='["google/gemini-2.5-flash","openai/gpt-4.1-mini","openrouter/google/gemini-2.5-flash"]' ;;
sonnet) tier_spec='["anthropic/claude-sonnet-4-20250514","openai/gpt-4.1","openrouter/anthropic/claude-sonnet-4-20250514"]' ;;
pro) tier_spec='["google/gemini-2.5-pro","anthropic/claude-sonnet-4-20250514","openrouter/google/gemini-2.5-pro"]' ;;
opus) tier_spec='["anthropic/claude-opus-4-6","openai/o3","openrouter/anthropic/claude-opus-4-6"]' ;;
coding) tier_spec='["anthropic/claude-opus-4-6","openai/o3","openrouter/anthropic/claude-opus-4-6"]' ;;
eval) tier_spec='["anthropic/claude-sonnet-4-5","google/gemini-2.5-flash","openrouter/anthropic/claude-sonnet-4-5"]' ;;
haiku) tier_spec='["anthropic/claude-haiku-4-5","google/gemini-2.5-flash"]' ;;
flash) tier_spec='["google/gemini-2.5-flash","anthropic/claude-haiku-4-5"]' ;;
sonnet) tier_spec='["anthropic/claude-sonnet-4-5","google/gemini-2.5-pro"]' ;;
pro) tier_spec='["google/gemini-2.5-pro","anthropic/claude-sonnet-4-5"]' ;;
opus) tier_spec='["anthropic/claude-opus-4-6","google/gemini-2.5-pro"]' ;;
coding) tier_spec='["anthropic/claude-opus-4-6","google/gemini-2.5-pro"]' ;;
eval) tier_spec='["anthropic/claude-sonnet-4-5","google/gemini-2.5-flash"]' ;;
health) tier_spec='["anthropic/claude-sonnet-4-5","google/gemini-2.5-flash"]' ;;
*)
print_error "Unknown tier: $tier"
Expand Down
17 changes: 7 additions & 10 deletions .agents/scripts/supervisor-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,11 @@ readonly -a VALID_TRANSITIONS=(

readonly BOLD='\033[1m'

log_info() { echo -e "${BLUE}[SUPERVISOR]${NC} $*"; }
log_success() { echo -e "${GREEN}[SUPERVISOR]${NC} $*"; }
log_warn() { echo -e "${YELLOW}[SUPERVISOR]${NC} $*"; }
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; }
Comment on lines +230 to +234

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)


# Check GitHub authentication in a way that works with GH_TOKEN env var.
# gh auth status may fail in cron even when GH_TOKEN is valid (keyring issues).
Expand Down Expand Up @@ -2818,16 +2818,13 @@ resolve_model() {
echo "anthropic/claude-sonnet-4-5"
;;
haiku)
echo "anthropic/claude-3-5-haiku-20241022"
echo "anthropic/claude-haiku-4-5"
;;
flash)
echo "google/gemini-2.5-flash-preview-05-20"
echo "google/gemini-2.5-flash"
;;
pro)
echo "google/gemini-2.5-pro-preview-06-05"
;;
grok)
echo "xai/grok-3"
echo "google/gemini-2.5-pro"
;;
*)
# Unknown tier — treat as coding tier default
Expand Down
Loading