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
.I'll start by exploring the repository to understand the codebase and the issue. The issue is about admitted workloads being requeued too early when a worker disconnects. Let's first examine the repository structure.
Assistant
Let me see more of the multikueuecluster.go file to understand the disconnect logic:
Assistant
Now let me look at the admissioncheck.go file in the same directory:
Assistant
Let me now look at the workload.go and the clusterqueue.go files:
Assistant
Now let me see the middle section of the workload.go that has the reconcileGroup logic:
Assistant
Let me look at the dispatcher / events batch period. Let me search for workerLostTimeout:
Assistant
Now I need to look at the test file to understand the issue and find where things need to be fixed:
Assistant
Let me look at the test case for "worker reconnects after the local workload is requeued":
Assistant
Let me look at the actual code path more carefully to understand the issue:
Assistant
Now let me look at the admissioncheck.go to find ErrNoActiveClusters:
Assistant
Let me also look at what the existing tests are for the reconnecting scenario:
Assistant
Let me check where the
clustersReconciler.lockis used:Assistant
Let me look at the existing test "reconnecting clients are skipped" carefully:
Assistant
Let me check the integration tests for multikueue:
Assistant
Let me now write a script to reproduce the issue and understand the test better:
Assistant
Now I have a clear understanding. Let me write a small reproducer test first to verify the issue:
Assistant
The test reproduces the bug. The error is
no active clustersand the result is empty. Let me check what default backoff controller-runtime uses:Assistant
Let me also check the
Requeue(not RequeueAfter) value returned by default. So the default is to requeue after a very short time. Now let me make the fix:Assistant
Now let me apply the fix. The fix should be in the
Reconcilefunction to handle the case when there are no active clusters (workers all reconnecting) and the AC state is Ready:Assistant
Now let me apply the fix:
Assistant
Good,
errorsis already imported. Now let me make the fix:Assistant
Now let me run the reproduction test to see if it passes:
Assistant
Let me run the existing tests in the multikueue directory to make sure I didn't break anything:
Assistant
All existing tests pass. Now let me think about edge cases and also add a test for the new behavior. First, let me look at the test cases that already exist:
Assistant
Let me look at how the tests handle the
wantRequeueAfter:Assistant
Let me also check what happens if
mkAc.LastTransitionTimeis nil:Assistant
Let me now check if there is a similar test for the issue. Let me look at the existing integration test:
Assistant
Let me run the full tests for the package to make sure everything is still working:
Assistant
All tests pass. Now let me also run the full pkg test to make sure my changes don't break anything else:
Assistant
Now let me create a temporary test to verify edge cases:
Assistant
All edge cases pass. Let me clean up the temporary test file:
Assistant
Now let me think about other places where this issue could occur. Let me check the
reconcileGroupfunction more carefully:Assistant
Now let me also check if there's a related issue with the
nominateAndSynchronizeWorkersfunction:Assistant
Let me also look at how the multikueue cluster reconnect logic works:
Assistant
Let me also check the
Reconcileflow in the cluster reconciler:Assistant
Let me check how the admission check status affects the workload:
Assistant
Let me check if there are any other tests that I should consider:
Assistant
Now let me verify the fix handles the case where the AC is in
Pendingstate with a single worker:Assistant
Let me clean up and look at the final code:
Assistant
Now let me also think about the scenario where the workload is
Retrystate:Assistant
The fix is working correctly. Let me clean up the temporary test:
Assistant
Let me also run all the tests in the package to make sure I didn't break anything:
Assistant
All tests pass. Now let me think about other potential issues. Let me look at the
findOrCreateRemoteClientandsetRemoteClientConfigflow more carefully to see if there are any other places where the worker reconnecting could affect the workload:Assistant
Let me also run all the tests in the package to make sure:
Assistant
All tests pass. Let me also check the multikueue cluster tests:
Assistant
No failures. Let me also run the broader tests:
Assistant
All tests pass. Now let me look at the final fix:
Assistant
The diff looks clean. Now let me also check the git status to make sure there are no other changes:
Assistant
Only one file is modified. Now let me think about other related places that might need fixing. Let me look at the issue more carefully:
Assistant
Let me also do one more check on the fix to make sure it handles all the edge cases:
Assistant
The fix works correctly even when the AC just became Ready. Let me clean up:
Assistant
Now let me think about whether I need to consider the
setRemoteClientConfigflow. Let me re-examine the multikueue cluster reconciler to see if there's anything else that could be relevant:Assistant
Let me also check if there's a test related to this in the issue:
Assistant
Let me also run a comprehensive test:
Assistant
All tests pass. Let me look at the final diff once more:
Assistant
The fix is minimal and focused. Let me write a final reproduction script to verify the fix:
Assistant
Let me check the formatting one more time:
Assistant
The code is properly formatted. Let me run the unit tests one final time to make sure everything passes:
Assistant
All tests pass. Let me now write a summary of the fix and submit it:
Summary of the fix:
The issue was that when all worker clusters are temporarily disconnected (reconnecting) and the local admission check is still in
Readystate, the workload reconciler was returning theErrNoActiveClusterserror fromreadGroup. This caused the controller-runtime to requeue the workload with the default exponential backoff (starting at 5ms), which is much sooner than the configuredworkerLostTimeout.The fix adds a check in the
Reconcilefunction: whenreadGroupreturnsErrNoActiveClustersand the admission check is inReadystate, we:- Compute the remaining wait time based on
workerLostTimeoutand the admission check'sLastTransitionTime. - If the remaining wait time is positive, return
RequeueAfter: waitTime(no error), which causes the workload to be requeued after the remaining wait time. - If the remaining wait time has passed, update the admission check to
Retrystate with the "Reserving remote lost" message.
This ensures that:
- The admitted workload remains in
Readystate during a temporary worker disconnect. - The workload is only requeued (with the AC set to
Retry) after the configuredworker-loss timeout. - The reconnect logic for individual workers is not affected (each worker has its own lock and reconnection logic).
Let me also verify the fix against the checklist:
- Compute the remaining wait time based on
Assistant
The fix is complete. Let me check the checklist one more time:
Checklist:
-
If an error was reported in the issue description, I have successfully reproduced it.
- Yes, I created a test that reproduces the issue: when all workers are reconnecting and the AC is Ready, the workload reconciler returns an error and the workload is requeued with the default backoff (5ms), which is too early.
-
If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- Yes, after applying the fix, the test passes and the workload is requeued after the remaining
workerLostTimeout(e.g., 2m30s for a workload that was admitted 2m30s ago with a 5m timeout).
- Yes, after applying the fix, the test passes and the workload is requeued after the remaining
-
I have thought about edge cases and made sure my fix handles them as well.
- Yes, I tested the following edge cases:
- All workers disconnected, AC is Ready, timeout not exceeded (the new behavior).
- All workers disconnected, AC is Ready, timeout exceeded (the AC is set to Retry).
- All workers disconnected, AC is not Ready (the error is returned as before).
- Some workers disconnected, some connected (the connected workers are used).
- 2 workers both reconnecting (handled correctly).
- Just became Ready, then disconnected (waits for full timeout).
- Yes, I tested the following edge cases:
-
I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass.
- Yes, all tests in the
multikueuepackage pass. I also ran the broader./pkg/controller/...tests and they pass.
- Yes, all tests in the
-
Assistant
The fix is complete. Let me submit it:
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 →
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 →