Skip to content

fix(arc): count this host's orgs however they were supplied - #16

Merged
Mearman merged 1 commit into
mainfrom
fix/arc-fleet-includes-play-orgs
Sep 26, 2026
Merged

Mearman merged 1 commit into
mainfrom
fix/arc-fleet-includes-play-orgs

Conversation

@Mearman

@Mearman Mearman commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

This came out of a consumer adopting v1.2.0. It passes its orgs to the role as a play variable, and its measured maxRunners came out far too low.

The role builds the fleet from hostvars for every host in groups['all']. The fleet is what the cross-host checks use, and it also supplies the namespaces measured sizing leaves out of each node's requests. hostvars holds inventory variables and facts but not play variables. An org passed as a play variable was missing from the fleet, so its namespaces weren't left out, and the runner pods already running counted as other workload against the ceiling they're sized by. An implicit localhost isn't in groups['all'] at all, so it had the same problem. The consumer's workaround was a set_fact of github_runner_arc_orgs before including the role.

Now this host's orgs come from github_runner_arc_orgs as the play resolves it, and other hosts' still come from their hostvars. This host is taken out of the hostvars pass, so inventory orgs aren't counted twice. The heartbeat gist bootstrap had the same blind spot: a gist id passed as a play variable looked like no gist anywhere, and would have created one. It now reads this host's id the same way.

tests/unit/test_fleet_orgs.py runs the real validation tasks in a play. It covers orgs as a play variable on an inventory localhost and on an implicit one, and a measured ceiling with two runner pods already running in the scale set's namespace (2 with the fix, 1 without). It also covers another host's orgs from host_vars, this host's inventory orgs counted once, the same org on two hosts still flagged as a duplicate, and a play-variable gist id not triggering the bootstrap, using a stand-in gh so nothing can reach GitHub. Six of the seven fail against v1.2.0; the one about counting this host's inventory orgs once passes on both, as it should.

The fix making app_id optional with an existing App Secret is stacked on this one, because both change the same lines of validate.yml. Against a live cluster in check mode, a fleet with its orgs in host_vars ran the same tasks with the same result as v1.2.0.

The fleet the role validates and looks things up in was built from
every inventory host's hostvars, which hold inventory variables and
facts but not play variables. Orgs passed to the role as a play
variable were therefore missing from it, and measured sizing, which
leaves the fleet's scale-set namespaces out of each node's requests,
counted the running runner pods as other workloads and set too low
a ceiling. An implicit localhost was missing for the same reason.

This host's orgs now come from github_runner_arc_orgs as the play
resolves it, and other hosts' still from their hostvars. The check
for whether any host has a heartbeat gist id reads this host's the
same way, so a gist id passed as a play variable no longer triggers
the gist bootstrap.
@Mearman
Mearman marked this pull request as ready for review September 26, 2026 05:35
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-26T05:37:38.483465Z 0220686 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Mearman
Mearman merged commit c731751 into main Sep 26, 2026
11 checks passed
@Mearman
Mearman deleted the fix/arc-fleet-includes-play-orgs branch September 26, 2026 05:36
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant