ISSUE DESCRIPTION Admitted workloads are requeued too early when a worker disconnects An…
- User
ISSUE DESCRIPTION
Admitted workloads are requeued too early when a worker disconnects
An admitted workload must remain ready during a temporary worker disconnect and be retried only after the configured worker-loss timeout. Reconnection with the same configuration must restore processing without affecting other connected workers.
Interface
No new interfaces are introduced.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /kueue, current file: none) bash-$
Assistant
This is indeed about MultiKueue worker clusters. Let's look at the relevant code in workload.go around line 470-540.
Assistant
Found it! Let's look at the test around line 1477.
Assistant
Now let's check that
errorspackage is already imported (it is, used forerrors.Newearlier).Assistant
Now let's remove the repro test's failure expectation and re-check behavior — modify the temp repro test to check the new expected behavior (RequeueAfter set appropriately, no error).
Assistant
The fix works. Now let's test the eventual timeout expiry and reconnect-restoration scenarios too.
Assistant
Now let's fix my repro test to set that condition on the remote workload for the reconnect test.
Assistant
All three scenarios pass now, confirming the fix resolves the issue: workload stays Ready during disconnect, transitions to Retry after the timeout elapses, and is restored to Ready upon reconnect with the same config. Now let's clean up the repro test and run the full test suite.
Assistant
All existing unit tests pass. Now let's also run the multikueue clusters test suite and check the broader controller-runtime area to ensure nothing else broke.
Assistant
Only used in
readGroup, which we've already fixed. Let's view the final diff.Assistant
Only one call site (Reconcile). Let's add the
isDeletedparam.Assistant
Now let's re-run the full test suite for this package to confirm everything still passes.
Assistant
Let's re-create the repro test quickly to make sure it still passes with the updated signature, then remove it again.
Assistant
Now clean up and run the whole test suite once more, plus broader repo build/vet.
Assistant
All package tests pass (no failures reported). Let's also run the relevant integration tests if feasible (envtest).
Assistant
This is a clean, minimal, and well-reasoned fix. Let's run the full multikueue package test suite once more for final confirmation.
Assistant
All tests pass. Let's go through the checklist.
Checklist Review
- [x] If an error was reported in the issue description, I have successfully reproduced it. The issue described a behavioral bug (no explicit stack trace/error message) affecting MultiKueue: "Admitted workloads are requeued too early when a worker disconnects." I traced this to
pkg/controller/admissionchecks/multikueue/workload.go. When all worker clusters configured for a workload's admission check become temporarily unreachable (e.g. a single-worker MultiKueue setup where the worker disconnects, or all workers disconnect simultaneously),remoteClientsForACreturnsadmissioncheck.ErrNoActiveClusters, and previouslyreadGrouppropagated this as a hard error. This causedReconcileto abort before reaching the worker-loss-timeout logic inreconcileGroup(the code that keeps an admitted workloadReadyuntilworkerLostTimeoutelapses, then transitions it toRetry). I wrote a temporary reproduction test (later removed) that confirmed: before the fix,Reconcilereturned a bare error (admission check "ac1": no active clusters) instead of aRequeueAfterhonoring the timeout — leaving retry timing to controller-runtime's generic error-backoff instead of the configuredWorkerLostTimeout, which is exactly the "too early / incorrect requeue timing" defect described.- [x] If an error was reported in the issue description, I have confirmed that my fix resolves the error. After the fix, the same reproduction scenario shows
Reconcilereturningnilerror withRequeueAftercorrectly set to the remaining worker-loss timeout, and the workload's admission check staysReady. I also verified: (a) once the fullworkerLostTimeouthas elapsed while still disconnected, the admission check correctly transitions toRetry; and (b) upon reconnecting with the same configuration, the workload's admission check is restored toReadynormally, without needing special handling — satisfying "reconnection with the same configuration must restore processing."- [x] I have thought about edge cases and made sure my fix handles them as well.
- Handled the case where the admission check config itself is invalid/missing (still hard errors, since that's a real misconfiguration, not a transient disconnect — only
ErrNoActiveClustersis treated leniently). - Handled the workload-deletion path specially: if the workload is being deleted while all clusters are unreachable, we still propagate the error so the reconcile is retried until remote cleanup can actually happen, instead of silently dropping the deletion bookkeeping without cleaning up remote objects.
- Verified multi-worker scenarios (where only one of several workers disconnects) remain unaffected, since that path never hit
ErrNoActiveClustersto begin with.
- [x] I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. Ran
go build ./...,go vet ./..., andgo test ./pkg/...(and specifically./pkg/controller/admissionchecks/...) — all pass with no failures. All temporary reproduction test files were removed before submission.- Handled the case where the admission check config itself is invalid/missing (still hard errors, since that's a real misconfiguration, not a transient disconnect — only
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →