Skip to content

Replenish runners promptly when listener demand accounts for completion - #1

Open
bf-operator[bot] wants to merge 3 commits into
masterfrom
fix/prompt-runner-replenishment
Open

bf-operator[bot] wants to merge 3 commits into
masterfrom
fix/prompt-runner-replenishment

Conversation

@bf-operator

@bf-operator bf-operator Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

When a runner terminates just after the listener publishes demand that already excludes its completed job, ARC suppresses replacement creation until the next listener long-poll update. This adds roughly 50 seconds per replenishment cycle under sustained queued demand (actions#4704).

The listener now includes a bounded history of completed runner names in the same merge patch as replicas and patchID. The runner-set controller skips recording a stale-demand cleanup marker only when every runner in the cleanup batch is acknowledged by that exact spec snapshot. It still returns after cleanup and counts deleting runners before creating replacements.

Completion history is deduplicated and bounded by maxRunners. Missing, evicted, or unavailable acknowledgements fall back to the existing suppression behavior. Old listeners and CRDs retain the existing behavior; no new polling, permissions, dependencies, or chart version changes are needed.

Validation:

  • A real API-server regression reproduces completion publication before runner termination, and requires replacement without another listener patch. It fails with the original cleanup behavior and passes with this change.
  • Existing stale-demand integration regression passes.
  • All 124 controller unit tests pass.
  • Listener and API tests pass with the race detector; go vet passes for changed packages.
  • The full EphemeralRunnerSet integration suite passes against a local Kubernetes 1.37 API server.

Upstream PR submission was attempted but rejected by GitHub: Resource not accessible by integration (createPullRequest). The implementation is based on upstream master and ready to submit from a GitHub account that can open upstream PRs.

Live canary validation on GKE (2026-10-10): the stock 0.15.0 controller/listener completed a warmed 12-job burst in 276 seconds. Three patched bursts completed in 155, 139 and 132 seconds (44–52% faster), with 36/36 successful jobs, peak concurrency three, and no cleanup-suppression log entries (stock warm had 13 entries, including distinct waits of 30, 49 and 82 seconds). Median pod scheduling remained 0 seconds, runner container startup 7 seconds, and connection/assignment about 5–6 seconds. This isolates replenishment improvement from startup speed.

Benchmark: 12 independent GitHub Actions jobs, each sleeping 15 seconds, maxRunners3/minRunners0, same runner/dind image digests and requests, already warmed nodes/images. Both manager and listener were patched. Job timestamps, pod conditions/container timestamps, listener desired-count/completion acknowledgement snapshots, and controller logs were captured. Some wave delays remain; this does not claim every queue delay is eliminated.

Live runs: stock warm, patched 1, patched 2, patched 3. The isolated canary is now parked at zero capacity; the first completion-ack fix was subsequently promoted to production via infra#139.

Follow-up from production telemetry (2026-10-10): commits d216f6d and 7fe8df8 also handles an acknowledged completion whose runner is still counted as Running when other runners are created from the same patch. The set revisits an acknowledged shortfall even when remaining runners carry that patch ID. Cleanup still returns before scaling, deleting registrations still count against capacity, and unaccounted completions still suppress replay of stale demand. The runner controller records that suppression against an uncached, optimistic-lock-protected snapshot before deleting a successful, unacknowledged runner; a concurrent listener acknowledgement is re-read after a conflict.

The production smoke sample had six GitHub-to-pod delays of 2 seconds and one of 53 seconds. Logs show the finishing seed runner initially satisfied one slot of the six-job demand, with the missing pod created only after a later listener restart. This follow-up reproduces and fixes that same-patch gap without a restart. The first follow-up image was tested only in the isolated canary; production remains on the initial completion-ack fix.

Follow-up validation: all standalone controller tests pass with the race detector; listener/API race tests and vet pass; runner and runner-set integration tests pass against the local Kubernetes 1.37 API server (112.5s). Five handover cases cover acknowledged/unacknowledged completion, deletion finalizer retention, runner-controller deletion and repeated reconciliation. A concurrent listener-update test verifies the resourceVersion precondition and retry against a newer acknowledgement. The regression fails before the same-patch change. An earlier broader test invocation also ran unrelated chart-contract cases without Helm in PATH; those environmental failures are excluded from this passing focused result.

The isolated follow-up canary passed 24/24 jobs but exposed a stale informer list replaying successful creates, briefly exceeding maxRunners=3 with four live pods. Commit 7fe8df8 therefore confirms owned child capacity through the authoritative API reader before every scale-up, counting deleting and terminal registrations until removal. It reads the cleanup suppression marker after that list to close a concurrent deletion race. New tests keep the cached list stale across repeated reconciles and commit a suppression marker during the authoritative list. The corrected image subsequently passed 24/24 canary jobs with peak live pod count three at maxRunners=3. Completion-to-replacement pod creation medians were 4s and 2s, and first-start-to-last-finish times were 136s and 125s. It was promoted to production, where all seven shared-cache smoke jobs passed (run 38071634452). Production is pinned to 7fe8df8 / sha256:195698cdba1577995a3b68c01930094803c4a8cd91f259dee6e2690381888f89.

Corrected live canaries: https://github.com/bayfold/infra/actions/runs/38071050715 and https://github.com/bayfold/infra/actions/runs/38071225039. The first was dispatched during a listener restart and waited nearly three minutes before beginning; this transition delay is not claimed fixed by replenishment. The second shared the same three-slot queue and waited behind the first. GKE scheduling, container startup and GitHub assignment remain separate stages.

@bf-operator
bf-operator Bot force-pushed the fix/prompt-runner-replenishment branch from 6eb04ea to bc2f7a5 Compare October 9, 2026 23:44
@bf-operator bf-operator Bot changed the title Wake listener after accounted runner cleanup to avoid long-poll delays Replenish runners promptly when listener demand accounts for completion Oct 9, 2026
@bf-operator
bf-operator Bot changed the base branch from bayfold/arc-0.15.0 to master October 9, 2026 23:44
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.

0 participants