Skip to content

fix(runners): fix registration token API, shuffle rebalance, consolidate dirs#1333

Merged
sbryngelson merged 1 commit intoMFlowCode:masterfrom
sbryngelson:fix/runner-scripts
Mar 20, 2026
Merged

fix(runners): fix registration token API, shuffle rebalance, consolidate dirs#1333
sbryngelson merged 1 commit intoMFlowCode:masterfrom
sbryngelson:fix/runner-scripts

Conversation

@sbryngelson
Copy link
Member

Summary

  • Add -X POST to gh_registration_token() — required by GitHub API, was causing 404 on runner creation
  • Shuffle runner placement order during rebalance so sequential runner numbers spread across nodes (avoids overloading one node when jobs arrive in number order)
  • Remove scratch dir from Phoenix RUNNER_PARENT_DIRS (all runners consolidated to project storage)

Test plan

  • Verified create-runner works with the -X POST fix (created phoenix 1-4)
  • Verified rebalance-runners dry run produces randomized order
  • Verified all 10 runners healthy after rebalance (check-runners)

🤖 Generated with Claude Code

…ate dirs

- Add -X POST to gh_registration_token() (required by GitHub API)
- Shuffle runner placement order in rebalance to spread sequential
  numbers across nodes, avoiding overloading one node when jobs arrive
- Remove scratch dir from Phoenix RUNNER_PARENT_DIRS (all runners
  consolidated to project storage)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sbryngelson sbryngelson marked this pull request as ready for review March 20, 2026 23:18
@sbryngelson sbryngelson merged commit 90d4b6e into MFlowCode:master Mar 20, 2026
23 of 25 checks passed
@sbryngelson sbryngelson deleted the fix/runner-scripts branch March 20, 2026 23:18
@github-actions
Copy link

Claude Code Review

Head SHA: c417fc8

Files changed:

  • 3
  • misc/runners/common/rebalance-runners.sh
  • misc/runners/common/runner-lib.sh
  • misc/runners/phoenix/config.sh

Findings:

  • misc/runners/phoenix/config.sh: runner_install_dir now uses an out-of-bounds array index.
    The diff removes the first entry (/storage/scratch1/…/mfc-runners) from RUNNER_PARENT_DIRS, shifting the remaining entry from index 1 to index 0. However, runner_install_dir() in the same file still hardcodes RUNNER_PARENT_DIRS[1]:
    local parent="${RUNNER_PARENT_DIRS[1]}"
    After this change RUNNER_PARENT_DIRS[1] is empty/unset, so parent will be an empty string. Any call to runner_install_dir will attempt to resolve paths like //actions-runner-N, causing installs to silently target the filesystem root or fail. The index should be updated to RUNNER_PARENT_DIRS[0].

@github-actions
Copy link

Claude Code Review

Head SHA: c417fc8

Files changed:

  • 3
  • misc/runners/common/rebalance-runners.sh
  • misc/runners/common/runner-lib.sh
  • misc/runners/phoenix/config.sh

Findings:

  • rebalance-runners.sh: Shuffle is O(n²) due to full array rebuild each iteration — The Fisher-Yates-style loop rebuilds to_place every iteration via to_place=("${to_place[@]:0:$rand}" "${to_place[@]:$((rand+1))}"), which copies all remaining elements. For typical runner counts (tens of runners) this is benign, but if many runners are simultaneously offline the cost grows quadratically. A simpler approach is to swap the chosen element with the last and shrink the array by one, keeping the loop O(n).

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f0c6930a-221b-434b-b250-b94d3ae9c73c

📥 Commits

Reviewing files that changed from the base of the PR and between 6120810 and c417fc8.

📒 Files selected for processing (3)
  • misc/runners/common/rebalance-runners.sh
  • misc/runners/common/runner-lib.sh
  • misc/runners/phoenix/config.sh

📝 Walkthrough

Walkthrough

Three shell script files were modified. A randomization algorithm was added to rebalance-runners.sh to shuffle the ordering of entries before move assignment. The runner-lib.sh file was updated to explicitly specify the POST HTTP method when requesting a registration token. In phoenix/config.sh, one shared storage directory path was removed from the RUNNER_PARENT_DIRS array, which affects runner installation directory selection and runner discovery.


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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant