Skip to content

fix(arc): withhold the heartbeat until a scale set's listener has settled - #265

Merged
Mearman merged 2 commits into
mainfrom
fix/heartbeat-listener-settle
Nov 19, 2026
Merged

Mearman merged 2 commits into
mainfrom
fix/heartbeat-listener-settle

Conversation

@Mearman

@Mearman Mearman commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Stop heartbeat.sh vouching for a scale set whose listener the controller has just re-created.

The controller deletes and re-creates a listener whenever its scale set's spec changes, and the autoscaler patches maxRunners on the pooled sets often. The listener and controller logs on the fleet's cluster showed the shared exadev-runners listener re-created 21 times between 10:53 and 11:47 UTC on 2026-11-19. Each replacement drops the session with GitHub, and the heartbeat counted any Running listener, so it kept the gist fresh through the churn.

A listener now counts only once it has run for HEARTBEAT_LISTENER_SETTLE_SECONDS (default: one heartbeat interval). A scale set without such a listener is reported in fleet-health.json and the timestamp is not refreshed, so jobs fall back to hosted runners.

Not covered: what makes the autoscaler's patches re-create the listener. This is also not the cause of jobs from a public repository staying queued: the default runner group does not allow public repositories, so GitHub never offers those jobs to the scale set at all.

Tests: three new cases in tests/unit/test_heartbeat.py (listener inside the settle time withholds, older than it does not, an old listener beside a new one does not). The module passes, and the first case fails against the previous script.

…tled

The controller deletes and re-creates a scale set's listener whenever the set's spec changes,
and the autoscaler patches maxRunners often enough that the shared exadev-runners set had its
listener replaced 21 times in two hours. Each replacement drops the session with GitHub, and
jobs queued around it stayed unassigned for hours while the new listener was Running and
runners started for other jobs. The heartbeat counted any Running listener, so it kept
vouching for the fleet and runner-fallback-action kept routing those jobs to it.

A listener now counts only once it has run for HEARTBEAT_LISTENER_SETTLE_SECONDS, one
heartbeat interval by default, so a scale set whose listener keeps being replaced is not
vouched for and its jobs fall back to hosted runners.
…of reading as no listener

A jq failure on the listener pods was turned into a count of zero, so the heartbeat withheld
with the reason "no running listener" and the real error was discarded. The failure now stops
the tick with jq's own message, which still withholds the refresh, and a test pins it.
@Mearman
Mearman merged commit 0c5499b into main Nov 19, 2026
16 checks passed
@Mearman
Mearman deleted the fix/heartbeat-listener-settle branch November 19, 2026 13:12
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 3.6.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