Skip to content

t1031: Restore missing supervisor globals + add globals test#1361

Merged
marcusquinn merged 2 commits intomainfrom
hotfix/supervisor-globals
Feb 13, 2026
Merged

t1031: Restore missing supervisor globals + add globals test#1361
marcusquinn merged 2 commits intomainfrom
hotfix/supervisor-globals

Conversation

@marcusquinn
Copy link
Owner

Summary

  • Restores SUPERVISOR_LOG, SUPERVISOR_LOG_DIR, PULSE_LOCK_DIR, and PULSE_LOCK_TIMEOUT globals that were dropped during t1031 modularization (PR t1031: Modularize supervisor-helper.sh into domain modules #1359)
  • These missing globals caused unbound variable errors when running supervisor-helper.sh pulse
  • Adds tests/test-supervisor-globals.sh — a permanent guard that catches this class of bug:
    1. Sources all modules with set -u (catches unbound variables)
    2. Syntax-checks all module files
    3. Verifies key globals are defined
    4. Cross-references module variable usage against definitions

This is the permanent solution: any future modularization that drops a global will be caught by the test before merge.

Fixes the supervisor pulse failure introduced by #1359.

…IR) dropped during t1031 modularization

Add test-supervisor-globals.sh to catch unbound variables in modules.
Tests: source with set -u, syntax check all modules, verify key globals defined,
cross-reference module variable usage against definitions.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 13, 2026

Warning

Rate limit exceeded

@marcusquinn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 19 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 hotfix/supervisor-globals

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

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 addresses a critical issue where supervisor-helper.sh pulse failed due to missing global variable definitions, a side effect of a recent modularization. It reintroduces the necessary global variables and establishes a robust testing mechanism to ensure the integrity of global variable definitions across supervisor modules, thereby preventing future occurrences of this class of bug.

Highlights

  • Restore Missing Supervisor Globals: The pull request restores SUPERVISOR_LOG, SUPERVISOR_LOG_DIR, PULSE_LOCK_DIR, and PULSE_LOCK_TIMEOUT global variables that were inadvertently removed during a previous modularization effort (PR t1031: Modularize supervisor-helper.sh into domain modules #1359). This fixes unbound variable errors encountered when running supervisor-helper.sh pulse.
  • Add Globals Test: A new test script, tests/test-supervisor-globals.sh, has been added to prevent similar regressions in the future. This test sources all modules with set -u to catch unbound variables, syntax-checks all module files, verifies key globals are defined, and cross-references module variable usage against definitions.
Changelog
  • .agents/scripts/supervisor-helper.sh
    • Restored definitions and exports for SUPERVISOR_LOG, SUPERVISOR_LOG_DIR, PULSE_LOCK_DIR, and PULSE_LOCK_TIMEOUT.
    • Ensured SUPERVISOR_LOG_DIR is created upon script execution.
    • Removed minor extraneous blank lines.
  • tests/test-supervisor-globals.sh
    • Introduced a new test script to validate the correct definition and usage of supervisor global variables.
    • Implemented checks for unbound variables by sourcing modules with set -u.
    • Added syntax checks (bash -n) for all supervisor module files.
    • Included verification that key global variables are explicitly defined.
    • Added cross-referencing to ensure variables used within modules are defined somewhere.
  • todo/VERIFY.md
    • Appended a new verification entry for the t1031 supervisor modularization.
    • Included shellcheck and file-exists checks for all associated supervisor module files.
Activity
  • No human activity has been recorded on this pull request yet.
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

🔍 Code Quality Report

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

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Fri Feb 13 14:20:11 UTC 2026: Code review monitoring started
Fri Feb 13 14:20:12 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 19

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 19
  • VULNERABILITIES: 0

Generated on: Fri Feb 13 14:20:15 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@marcusquinn marcusquinn merged commit c4752ee into main Feb 13, 2026
8 of 10 checks passed
@marcusquinn marcusquinn deleted the hotfix/supervisor-globals branch February 13, 2026 14:22
Copy link

@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 effectively restores the missing global variables in supervisor-helper.sh, fixing the unbound variable errors. The addition of test-supervisor-globals.sh is an excellent step towards preventing similar issues in the future. My review focuses on improving the robustness of the new test script and ensuring consistency in the main script, in line with the repository's style guide.

"VALID_TRANSITIONS"
)

all_files="$SUPERVISOR $(echo "$REPO_DIR/.agents/scripts/supervisor/"*.sh)"

Choose a reason for hiding this comment

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

high

Constructing the file list as a space-separated string is not robust. It is subject to word-splitting (hence the shellcheck disable on line 76) and will behave incorrectly if the glob pattern .../*.sh matches no files. Using a bash array is a safer and more robust way to handle lists of files. This would require updating the grep calls on lines 77 and 95 to use array expansion ("${all_files[@]}").

if grep -rq "\$${var}\b\|\${${var}}" "$module_dir/" 2>/dev/null; then
# Check if defined in monolith or _common.sh
# shellcheck disable=SC2086
if ! grep -q "^[[:space:]]*\(readonly \)\{0,1\}${var}=" $all_files 2>/dev/null; then

Choose a reason for hiding this comment

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

high

The regex in this grep command is incorrect and inconsistent with the one used in Test 3 (line 77). It only checks for definitions like readonly VAR= and misses plain assignments (VAR=) or array assignments (readonly -a VAR=). To correctly detect if a variable is defined, you should use grep -E with the same robust pattern from Test 3.

Suggested change
if ! grep -q "^[[:space:]]*\(readonly \)\{0,1\}${var}=" $all_files 2>/dev/null; then
if ! grep -qE "^[[:space:]]*(readonly( -a)? )?${var}=" $all_files 2>/dev/null; then

Comment on lines +199 to +201
SUPERVISOR_LOG_DIR="${HOME}/.aidevops/logs"
mkdir -p "$SUPERVISOR_LOG_DIR" 2>/dev/null || true
SUPERVISOR_LOG="${SUPERVISOR_LOG_DIR}/supervisor.log"

Choose a reason for hiding this comment

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

medium

The new variables SUPERVISOR_LOG_DIR (line 199) and SUPERVISOR_LOG (line 201) are not declared readonly. This is inconsistent with other constants in this file (e.g., PULSE_LOCK_DIR) and the convention for UPPER_SNAKE variables. They should be made readonly to prevent accidental modification.

References
  1. Variables named in UPPER_SNAKE are for constants/env vars. Constants should be immutable. (link)

readonly SESSION_CHECKPOINT_HELPER="${SCRIPT_DIR}/session-checkpoint-helper.sh" # Used by respawn (t264.1)
readonly RESPAWN_LOG="${HOME}/.aidevops/logs/respawn-history.log" # Persistent respawn log (t264.1)
SUPERVISOR_LOG_DIR="${HOME}/.aidevops/logs"
mkdir -p "$SUPERVISOR_LOG_DIR" 2>/dev/null || true

Choose a reason for hiding this comment

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

medium

The use of 2>/dev/null here to suppress errors from mkdir -p is not ideal. According to the repository style guide, 2>/dev/null should only be used for redirection to log files, not for blanket suppression. mkdir -p is idempotent and won't fail if the directory already exists. Suppressing stderr can hide important permission or filesystem errors. The || true guard is sufficient to prevent the script from exiting on failure.

Suggested change
mkdir -p "$SUPERVISOR_LOG_DIR" 2>/dev/null || true
mkdir -p "$SUPERVISOR_LOG_DIR" || true
References
  1. The style guide states that 2>/dev/null is acceptable ONLY when redirecting to log files, not for blanket suppression of command output. (link)

Comment on lines +24 to +31
pass() {
PASS=$((PASS + 1))
echo " PASS: $1"
}
fail() {
FAIL=$((FAIL + 1))
echo " FAIL: $1"
}

Choose a reason for hiding this comment

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

medium

These helper functions are missing explicit return statements, which is required by the repository style guide.

Suggested change
pass() {
PASS=$((PASS + 1))
echo " PASS: $1"
}
fail() {
FAIL=$((FAIL + 1))
echo " FAIL: $1"
}
pass() {
PASS=$((PASS + 1))
echo " PASS: $1"
return 0
}
fail() {
FAIL=$((FAIL + 1))
echo " FAIL: $1"
return 0
}
References
  1. All functions must have explicit return statements. (link)

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