Skip to content

fix(schedulers): add default values for optional params $12 and $13 in _install_scheduler_linux#17826

Merged
alex-solovyev merged 1 commit intomainfrom
bugfix/schedulers-unbound-var
Apr 8, 2026
Merged

fix(schedulers): add default values for optional params $12 and $13 in _install_scheduler_linux#17826
alex-solovyev merged 1 commit intomainfrom
bugfix/schedulers-unbound-var

Conversation

@alex-solovyev
Copy link
Copy Markdown
Collaborator

@alex-solovyev alex-solovyev commented Apr 8, 2026

Summary

_install_scheduler_linux() in setup-modules/schedulers.sh accessed ${12} (on_calendar) and ${13} (timeout_sec) without default values. Under set -u, any caller that passes fewer than 13 arguments triggers an unbound variable error, causing aidevops update to exit 1.

Root cause

The function signature documents $12 and $13 as optional parameters, but the variable assignments used bare ${12} and ${13} without :- defaults. Multiple callers pass only 11 arguments (omitting both optional params):

  • setup_stats_wrapper (line 781)
  • setup_process_guard (line 988)
  • setup_memory_pressure_monitor (line 1080)
  • _install_cw_linux (line 1281)
  • _install_profile_readme_linux (line 1448)
  • setup_token_refresh (line 1660)

Fix

-	local on_calendar="${12}"
-	local timeout_sec="${13}"
+	local on_calendar="${12:-}"
+	local timeout_sec="${13:-}"

The downstream _install_scheduler_systemd() already handles empty timeout_sec (falls back to interval_sec, then 3600), so empty defaults are safe.

Verification

  • bash -n setup-modules/schedulers.sh — syntax check passes
  • shellcheck setup-modules/schedulers.sh — zero violations
  • The fix allows callers with 11 args to work without triggering set -u errors

Runtime Testing

Risk level: Low — two-character change to variable defaults, no logic change.
Self-assessed: syntax check + shellcheck pass; downstream empty-value handling confirmed at lines 492-496.

Resolves #17807


aidevops.sh v3.6.171 plugin for OpenCode v1.4.0 with claude-sonnet-4-6 spent 2m and 4,087 tokens on this as a headless worker.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced scheduler installation stability by improving how optional configuration parameters are processed, preventing failures in scenarios where these parameters are not provided.

_install_scheduler_linux() accessed ${12} and ${13} (on_calendar and
timeout_sec) without default values. Under set -u, callers that pass
fewer than 13 args (e.g. stats-wrapper, process-guard, memory-pressure-
monitor, contribution-watch, profile-readme, token-refresh) trigger an
unbound variable error, causing aidevops update to exit 1.

Fix: use ${12:-} and ${13:-} to default to empty string when not
provided. The downstream _install_scheduler_systemd() already handles
empty timeout_sec (falls back to interval_sec then 3600).

Fixes #17807
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@github-actions github-actions bot added the bug Auto-created from TODO.md tag label Apr 8, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: baf391b5-47f2-4af5-ac92-9ad97cf1e5df

📥 Commits

Reviewing files that changed from the base of the PR and between ea7daeb and 3260d39.

📒 Files selected for processing (1)
  • setup-modules/schedulers.sh

Walkthrough

A surgical fix to setup-modules/schedulers.sh that addresses an unbound variable error by adding default empty-string fallbacks to optional positional parameters in the scheduler installation function, preventing script exit code 1 when those arguments are omitted under set -u.

Changes

Cohort / File(s) Summary
Unbound Variable Mitigation
setup-modules/schedulers.sh
Added ${VAR:-} default fallback syntax to positional parameters ${12} and ${13} (on_calendar, timeout_sec) in _install_scheduler_linux to prevent unset optional arguments from triggering unbound variable errors under set -u.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🔧 A parameter stripped of its chains,
Default fallback flows through the veins,
No more does set -u make us frown,
The update ascends—no crash-bound!
Exit code zero, the victory's plain. 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the primary fix: adding default values for optional parameters $12 and $13 in _install_scheduler_linux to resolve unbound variable errors under set -u.
Linked Issues check ✅ Passed The code changes directly address the root cause in #17807 by applying safe parameter defaults (${12:-} and ${13:-}) to prevent unbound variable errors, ensuring aidevops update exits 0 as required.
Out of Scope Changes check ✅ Passed The changes are narrowly scoped to fixing the exact unbound variable issue in _install_scheduler_linux; no extraneous modifications or refactoring unrelated to #17807 objectives are present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/schedulers-unbound-var

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.

@alex-solovyev
Copy link
Copy Markdown
Collaborator Author

MERGE_SUMMARY

Fix: Added :- default values to optional positional parameters ${12} and ${13} in _install_scheduler_linux() in setup-modules/schedulers.sh.

Root cause: Under set -u, accessing ${12} or ${13} when fewer than 13 arguments are passed causes an unbound variable error. Six callers pass only 11 args (omitting the optional on_calendar and timeout_sec), triggering the error on every Linux scheduler setup.

Change: 2-line diff — ${12}${12:-} and ${13}${13:-}. No logic change; downstream _install_scheduler_systemd() already handles empty timeout_sec.

Verification: bash -n syntax check passes, shellcheck zero violations.

Closes: #17807


aidevops.sh v3.6.171 plugin for OpenCode v1.4.0 with claude-sonnet-4-6 spent 4m and 226 tokens on this as a headless worker. Overall, 11s since this issue was created.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🔍 Code Quality Report

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

SonarCloud: 0 bugs, 0 vulnerabilities, 650 code smells

Wed Apr 8 05:05:13 UTC 2026: Code review monitoring started
Wed Apr 8 05:05:14 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 650

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 650
  • VULNERABILITIES: 0

Generated on: Wed Apr 8 05:05:16 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 8, 2026

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@alex-solovyev alex-solovyev merged commit 395d6d7 into main Apr 8, 2026
44 checks passed
@alex-solovyev alex-solovyev deleted the bugfix/schedulers-unbound-var branch April 8, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Auto-created from TODO.md tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(schedulers): aidevops update exits 1 due to unbound variable in schedulers.sh line 613

1 participant