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 structure and searching for code related to worker disconnects and workload requeuing.
- Assistant
The issue sounds MultiKueue-related; I'll search for worker-loss timeout and disconnect handling.
- Assistant
rg is not available, let me use grep.
- Assistant
I'll inspect the MultiKueue workload reconciler around worker-loss timeout handling.
- Assistant
I'll dig into the related unit tests and how disconnected workers affect matching.
- Assistant
I'll inspect the WorkerLostTimeout tests and the remote-client disconnect path next.
- Assistant
I'll examine how
connectingis used and how remote workloads are built into the group. - Assistant
Let me look at the remoteClientsForAC and readGroup more carefully - the issue is that admitted workloads are requeued too early when a worker disconnects.
- Assistant
The LastTransitionTime of Ready is likely wrong for the timeout — I'll inspect reconnect handling and recent related changes.
- Assistant
I'll inspect the reconnecting-client tests and the MultiKueueCluster Active condition.
- Assistant
I'll inspect cluster reconcile and disconnect status transitions.
- Assistant
I'll check git blame on the worker-loss timeout logic and look for related issues or open PRs.
- Assistant
I'll read the integration tests covering worker-loss requeue behavior.
- Assistant
Interesting - the integration test seems to expect that when connection is lost, the AC goes to Pending (via Retry). It uses
util.MediumTimeoutfor the wait (not pausing to verify it waits for worke...I understand the issue now. The tests are actually validating the buggy behavior by setting LastTransitionTime to simulate old admissions, which causes immediate Retry on disconnect. The real requirement is that admitted workloads should stay Ready during worker disconnects until the workerLostTimeout expires, then go to Retry. - Assistant
There's a smoking gun comment casting LastTransitionTime as a worker-loss heartbeat — I'll check how often it gets refreshed.
- Assistant
I'll check what the watch-ended event requeues.
- Assistant
I'll check what PatchAdmissionStatus does and how brokers compare existing ACS fields.
- Assistant
I'll inspect how SetAdmissionCheckState is used and whether callers rely on LastTransitionTime for non-state changes.
- Assistant
I'll check if the provisioning controller depends on LastTransitionTime heartbeats the same way.
- Assistant
I'll verify what
acspoints at insidereconcileGroupandsyncReservingRemoteState. - Assistant
I'll inspect reconnect same-config behavior and related tests for other-worker impact.
- Assistant
I'll check whether worker-loss remaining wait uses the reconciler clock.
- Assistant
I'll dig into PatchAdmissionStatus / BaseSSAWorkload object mutation semantics.
- Assistant
I'll check admissionChecksStatusPatch and whether RetryCount is preserved.
- Assistant
Root cause:
SetAdmissionCheckStateonly updatesLastTransitionTimeon state change, so MultiKueue's worker-loss heartbeat never refreshes and admitted workloads get requeued immediately. Fixing that. - Assistant
I'll update
SetAdmissionCheckStateto honor an explicit LastTransitionTime heartbeat, and use the reconciler clock for remainingWaitTime. - Assistant
I'll also make remaining-wait use the reconciler clock for consistent timing.
- Assistant
Let me fix time.Since to use clock.
- Assistant
I introdила a typo and an extra brace; fixing those.
- Assistant
I'll check for unused imports and write a small temporary test for the heartbeat behavior.
- Assistant
I'll add a temporary unit test to verify the heartbeat fix.
- Assistant
I'll put the temporary test inside the repo module instead.
- Assistant
Need to set GOCACHE and maybe HOME
- Assistant
Heartbeat test passed. Running existing related unit tests next.
- Assistant
I'll add a temporary end-to-end multi-reconcile test for the worker-loss heartbeat.
- Assistant
Let me write a standalone temporary test file in the multikueue package that verifies:
- Assistant
Need to use the right package for fake clock. Let me check how existing tests do it.
- Assistant
Also need to check howmodel.init LocalWorkload Type with Admitted -
Looking at where admitted temprature is checked...
- Assistant
Looking at lines around 450...
- Assistant
Let me fix the temporary test.
- Assistant
Heartbeat is working — the LTT mismatch is just metav1 second precision. I'll fix the test comparison and rerun.
- Assistant
There's also another issue - if LTT was oldLTT m=-899 (15 min ago with defaultWorkerLostTimeout = 5 min which is 3x), without heartbeat it would fail immediately on disconnect.
- Assistant
want is still showing nanoseconds — I'll check how metav1.NewTime behaves here.
- Assistant
Truncate happens on client round-trip; I'll compare Unix seconds instead.
- Assistant
Also need to ensure second-precision truncation on remaining wait works. When LTT is truncated to second, remainingwait might be slightly oil from full timeout, still should be >0.
- Assistant
When the only worker reconnects we hit ErrNoActiveClusters before the timeout path—I'll trace how that error is handled.
- Assistant
When all workers are disconnected we hit ErrNoActiveClusters and never apply WorkerLostTimeout — I'll update that path.
- Assistant
I'll extract the worker-lost handling and use it when there are no active clusters while ACS is Ready.
- Assistant
There's an extra brace; I'll remove it and add
handleReservingRemoteLost. - Assistant
I broke
updateACSduring the edit; restoring aos ang cleanly. - Assistant
I introduced garbage characters; cleaning up the corrupted lines.
- Assistant
Good. Now replace the inline remaining wait with the helper.
- Assistant
Replace with handleReservingRemoteLost call.
- Assistant
I'll polish the comment and then re-run the tests.
- Assistant
There's another extra brace; removing it.
- Assistant
Looks good. Need a blank line before // 7. Let me run tests.
- Assistant
The temporary test passed. Running the full multikueue unit suite next.
- Assistant
All tests passed. Cleaning up temporary tests and reviewing the final diff.
- Assistant
I'll confirm the
errorsimport is present.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.