Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek/deepseek-v4-pro· deepseekHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Standalone elastic RayCluster self-updates raycluster-generation…

  1. User

    ISSUE DESCRIPTION

    Standalone elastic RayCluster self-updates raycluster-generation annotation What happened:

    A standalone Kueue-managed elastic RayCluster is continuously updated by Kueue.

    The kueue.x-k8s.io/raycluster-generation annotation tracks the RayCluster's own metadata.generation, but remains one value behind. For example:

    metadata.generation: 273390
    kueue.x-k8s.io/raycluster-generation: "273389"
    

    A later read showed the same pattern:

    metadata.generation: 273462
    kueue.x-k8s.io/raycluster-generation: "273461"
    

    Kueue logs showed repeated RayCluster reconciles followed by RayCluster update webhook calls from the Kueue controller manager.

    This is a self-triggered loop in the RayCluster custom annotation path. For standalone RayClusters, GetCustomAnnotations calls GetWorkloadslicingRayClusterCustomAnnotations(ctx, c, j.Object(), podSets, j.Name). That helper fetches the same RayCluster and returns the fetched RayCluster generation as an annotation to write back onto the RayCluster. The metadata patch then advances the RayCluster generation, making the annotation stale again.

    What you expected to happen:

    Kueue should not continuously patch a standalone elastic RayCluster when its replica counts have not changed.

    The raycluster-generation annotation is useful for RayJob and RayService, where the top-level object needs to account for an underlying RayCluster generation. A standalone RayCluster should not write its own generation back onto itself.

    How to reproduce it (as minimally and precisely as possible):

    1. Install Kueue v0.16.5 with ElasticJobsViaWorkloadSlices=true.
    2. Enable the RayCluster integration.
    3. Create a standalone RayCluster with:
    metadata:
      annotations:
        kueue.x-k8s.io/elastic-job: "true"
      labels:
        kueue.x-k8s.io/queue-name: <local-queue>
    
    1. Inspect the RayCluster generation and annotation repeatedly:
    kubectl get raycluster.ray.io <name> -n <namespace> \
      -o jsonpath='{.metadata.generation}{"\t"}{.metadata.annotations.kueue\.x-k8s\.io/raycluster-generation}{"\n"}'
    

    Anything else we need to know?:

    This may be related to #10160, which added generation-based elastic workload names on the release-0.16 branch.

    A fix is to omit kueue.x-k8s.io/raycluster-generation when the jobObject is the same standalone RayCluster as rayClusterName.

    Environment:

    • Kubernetes version (use kubectl version):
      • Client Version: v1.33.9
      • Server Version: v1.33.10-gke.1115000
    • Kueue version (use git describe --tags --dirty --always):
      • Deployed controller image: kueue:v0.16.5
      • Helm chart: kueue-0.16.5
    • Cloud provider or hardware configuration: GKE
    • OS (e.g: cat /etc/os-release): not collected
    • Kernel (e.g. uname -a): not collected
    • Install tools: Helm
    • Others:
      • ElasticJobsViaWorkloadSlices=true
      • TopologyAwareScheduling=false

    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 using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to 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-$

  2. DeepSeek Assistant

    Let me understand the issue:

    1. When a standalone RayCluster (not part of a RayJob or RayService) is managed by Kueue, Kueue writes a kueue.x-k8s.io/raycluster-generation annotation to the RayCluster.
    2. This annotation tracks the RayCluster's own metadata.generation, but it's always one behind.
    3. This causes an infinite loop: Kueue reads the RayCluster, gets its generation, writes it back as an annotation, which updates the generation, making the annotation stale again, causing another reconcile.

    The fix should be: omit kueue.x-k8s.io/raycluster-generation when the jobObject is the same standalone RayCluster. In other words, for a standalone RayCluster, we should not write its own generation back onto itself.

    Let me explore the repository structure first.

  3. DeepSeek Assistant

    The grep returned a match but with an error. Let me search more carefully.

  4. DeepSeek Assistant

    Let me find all references to this annotation.

  5. DeepSeek Assistant

    Let me look at the common.go file in

  6. DeepSeek Assistant

    Let me try to open the file using a different syntax.

  7. DeepSeek Assistant

    Now I can see the GetWorkloadslicingRayClusterCustomAnnotations function. Let me find where it's called

  8. DeepSeek Assistant

    Let me find the RayCluster controller's GetCustomAnnotations:

  9. DeepSeek Assistant

    Let me find the RayCluster controller file:

  10. DeepSeek Assistant

    Let me check the raycluster_controller.go to see if it has GetCustomAnnotations.

  11. DeepSeek Assistant

    Let me look at the reconciler code to understand how GetCustomAnnotations is used:

  12. DeepSeek Assistant

    Let me search for where GetCustomAnnotations is called in the reconciler code

  13. DeepSeek Assistant

    Let me look at the area around line 962 to understand the context.

  14. DeepSeek Assistant

    Let me use sed to read lines around 962.

  15. DeepSeek Assistant

    Let me check if RayCluster implements GetCustomAnnotations

  16. DeepSeek Assistant

    Let me look at the common_test.go to understand the test cases:

  17. DeepSeek Assistant

    Let me check the raycluster_webhook.go:

  18. DeepSeek Assistant

    Let me check the interface definition for JobWithCustomAnnotations:

  19. DeepSeek Assistant

    Let me look at the interface definition.

  20. DeepSeek Assistant

    Let me see which types implement JobWithCustomAnnotations:

  21. DeepSeek Assistant

    Let me look at the workloadslicing package and how it handles annotations

  22. DeepSeek Assistant

    Let me look at the GetWorkloadNameExtraPart and how it's used:

  23. DeepSeek Assistant

    Let me look at the reconciler code around line 1437 to see how GetWorkloadNameExtraPart is used

  24. DeepSeek Assistant

    Let me search more broadly for where annotations are set on the RayCluster:

  25. DeepSeek Assistant

    Let me look at the workloadslicing package

  26. DeepSeek Assistant

    Let me look at the workloadslicing package:

  27. DeepSeek Assistant

    Let me look at the full reconcile flow to understand where annotations might get written

  28. DeepSeek Assistant

    Let me look at the full ReconcileGenericJob

  29. DeepSeek Assistant

    Let me continue reading the reconcile flow after ensureOneWorkload:

  30. DeepSeek Assistant

    Let me search more thoroughly for any GetCustomAnnotations implementation related to RayCluster:

  31. DeepSeek Assistant

    Let me check git status and recent commits:

  32. DeepSeek Assistant

    Let me search for ElasticWorkloadNameProvider and check what RayCluster implements:

  33. DeepSeek Assistant

    Let me look at the full ensureOneWorkload function:

  34. DeepSeek Assistant

    Let me look at the RayJob and RayService controllers to understand their GetCustomAnnotations:

  35. DeepSeek Assistant

    Let me also look at the RayService controller:

  36. DeepSeek Assistant

    Let me search for any RayCluster GetCustomAnnotations implementation more broadly:

  37. DeepSeek Assistant

    Let me look at JobPodSets:

  38. DeepSeek Assistant

    Let me search more broadly for JobPodSets:

  39. DeepSeek Assistant

    Let me look at JobPodSets:

  40. DeepSeek Assistant

    Let me look at startJob and stopJob

  41. DeepSeek Assistant

    Let me see the rest of the reconcile flow after ensureOneWorkload

  42. DeepSeek Assistant

    Let me check the git log for changes to the raycluster controller files

  43. DeepSeek Assistant

    Let me look at the commit that added generation-based elastic workload names:

  44. DeepSeek Assistant

    Let me see what was added to common.go in that commit specifically

  45. DeepSeek Assistant

    Let me check if there's a JobWithCustomAnnotations implementation for RayCluster in any file

  46. DeepSeek Assistant

    Let me check all callers of GetWorkloadslicingRayClusterCustomAnnotations and GetWorkloadNameExtraPart:

  47. DeepSeek Assistant

    Let me check if there's a release branch or tag that might have different

  48. DeepSeek Assistant

    Now I have a clear understanding of the issue. Let me look at the test file to understand the expected

  49. DeepSeek Assistant

    Now I have a thorough understanding of the issue. Let me summarize:

    The Problem: When GetWorkloadslicingRayClusterCustomAnnotations is called with a jobObject that is the same standalone RayCluster as rayClusterName, it:

    1. Fetches the RayCluster's generation
    2. Returns it as RayClusterGenerationAnnotation to be written back onto the same RayCluster
    3. The write increments the RayCluster's generation, making the annotation stale
    4. This triggers another reconcile, creating an infinite loop

    The Fix: Omit RayClusterGenerationAnnotation when jobObject is the same RayCluster as rayClusterName.

    Let me implement this fix in `common.go

  50. DeepSeek Assistant

    Now I'll implement the fix. The key change is in GetWorkloadslicingRayClusterCustomAnnotations - when jobObject is the same as rayClusterName, we should skip the RayClusterGenerationAnnotation.

  51. DeepSeek Assistant

    Let me open the file first and then edit it

  52. DeepSeek Assistant

    Now I can edit the function. Let me replace lines 335-366:

  53. DeepSeek Assistant

    Let me try writing the replacement to a temporary file and then using sed or a different approach:

  54. DeepSeek Assistant

    Now let me use a script to replace lines 335-366:

  55. DeepSeek Assistant

    Let me verify the change was applied correctly:

  56. DeepSeek Assistant

    The change looks correct. Now let me verify the code compiles and tests pass.

  57. DeepSeek Assistant

    Let me set up the Go cache and try again:

  58. DeepSeek Assistant

    The build passes! Now let me run the tests for this package:

  59. DeepSeek Assistant

    All existing tests pass! Let me also run all tests in the raycluster package to make sure nothing else is broken:

  60. DeepSeek Assistant

    All tests pass. Let me also run the related tests for rayjob and rayservice:

  61. DeepSeek Assistant

    Let me run the rayservice tests too:

  62. DeepSeek Assistant

    Let me run the full test suites for both packages:

  63. DeepSeek Assistant

    All tests pass. Let me also run the jobframework reconciler tests and workloadslicing tests:

  64. DeepSeek Assistant

    Let me now verify the change with a quick sanity check - let me look at the final state of the modified function:

  65. DeepSeek Assistant

    Let me verify the git diff to confirm the change is correct:

  66. DeepSeek Assistant

    The diff looks correct. Let me now run the broader test suite one more time to ensure everything is clean:

  67. DeepSeek Assistant

    All tests pass. Let me force re-run them to be certain:

  68. DeepSeek Assistant

    All tests pass. Let me clean up the temporary file:

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.