← Back to Pull requests

feat(trainer): Support namespaced TrainingRuntime in the SDK #130

Merged
shaikmoeed merged 3 files (309 lines) on Feb 18, 2026 14:41 UTC
View on GitHub
shaikmoeed shaikmoeed commented on Oct 29, 2025 07:35 UTC
Author

<!-- Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, check our contributor guidelines: https://www.kubeflow.org/docs/about/contributing
2. To know more about Kubeflow SDK, check the developer guide:
https://github.com/kubeflow/sdk/blob/main/CONTRIBUTING.md
3. If you want faster PR reviews, check how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
-->

What this PR does / why we need it:
Add support to list/get namespaced TrainingRuntime.

Which issue(s) this PR fixes:

Fixes #88

Checklist:

  • Docs included if any changes are user facing
  • Diff: 309 lines (+261 / -48) across 3 files Reviewer: abhijeet-dhumal Review duration: 161705m
    All Vouch review confidence checks passed
    Residual risk 0.04 = Change Risk (0.40) × (1 − Review Confidence (0.91)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 309 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.89 · 5 substantive comment(s)
    0.89
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    90%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.343
    Real PR Conversation Timeline
    47 items
    kramaranya kramaranya commented on Oct 29, 2025 07:51 UTC
    Contributor

    /ok-to-test

    abhijeet-dhumal abhijeet-dhumal commented on Nov 03, 2025 19:21 UTC
    Contributor

    Thank you @shaikmoeed for this!
    Left some nit-picks..

    abhijeet-dhumal abhijeet-dhumal commented on code on Nov 03, 2025 19:21 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -88,33 +100,55 @@ def list_runtimes(self) -> list[types.Runtime]:
     
             except multiprocessing.TimeoutError as e:
                 raise TimeoutError(
    -                f"Timeout to list {constants.CLUSTER_TRAINING_RUNTIME_KIND}s "
    +                "Timeout to list "
    +                f"{constants.CLUSTER_TRAINING_RUNTIME_KIND}s/{constants.TRAINING_RUNTIME_KIND}s "
                     f"in namespace: {self.namespace}"
                 ) from e
             except Exception as e:
                 raise RuntimeError(
    -                f"Failed to list {constants.CLUSTER_TRAINING_RUNTIME_KIND}s "
    +                "Failed to list "
    +                f"{constants.CLUSTER_TRAINING_RUNTIME_KIND}s/{constants.TRAINING_RUNTIME_KIND}s "
                     f"in namespace: {self.namespace}"
                 ) from e
     
             return result
     
         def get_runtime(self, name: str) -> types.Runtime:
    -        """Get the the Runtime object"""
    +        """Get the the Runtime object prefer namespaced, fall-back to cluster-scoped"""

            """Get the Runtime object prefer namespaced, fall-back to cluster-scoped"""
    

    abhijeet-dhumal abhijeet-dhumal commented on code on Nov 03, 2025 19:29 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -59,21 +59,33 @@ def __init__(self, cfg: KubernetesBackendConfig):
         def list_runtimes(self) -> list[types.Runtime]:
             result = []
             try:
    -            thread = self.custom_api.list_cluster_custom_object(
    +            cluster_thread = self.custom_api.list_cluster_custom_object(
                     constants.GROUP,
                     constants.VERSION,
                     constants.CLUSTER_TRAINING_RUNTIME_PLURAL,
                     async_req=True,
                 )
     
    -            runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    -                thread.get(common_constants.DEFAULT_TIMEOUT)
    +            namespace_thread = self.custom_api.list_namespaced_custom_object(
    +                constants.GROUP,
    +                constants.VERSION,
    +                self.namespace,
    +                constants.TRAINING_RUNTIME_PLURAL,
    +                async_req=True,
    +            )
    +
    +            cluster_runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    +                cluster_thread.get(constants.DEFAULT_TIMEOUT)

                    cluster_thread.get(common_constants.DEFAULT_TIMEOUT)
    

    abhijeet-dhumal abhijeet-dhumal commented on code on Nov 03, 2025 19:33 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -88,33 +100,55 @@ def list_runtimes(self) -> list[types.Runtime]:
     
             except multiprocessing.TimeoutError as e:
                 raise TimeoutError(
    -                f"Timeout to list {constants.CLUSTER_TRAINING_RUNTIME_KIND}s "
    +                "Timeout to list "
    +                f"{constants.CLUSTER_TRAINING_RUNTIME_KIND}s/{constants.TRAINING_RUNTIME_KIND}s "
                     f"in namespace: {self.namespace}"
                 ) from e
             except Exception as e:
                 raise RuntimeError(
    -                f"Failed to list {constants.CLUSTER_TRAINING_RUNTIME_KIND}s "
    +                "Failed to list "
    +                f"{constants.CLUSTER_TRAINING_RUNTIME_KIND}s/{constants.TRAINING_RUNTIME_KIND}s "
                     f"in namespace: {self.namespace}"
                 ) from e
     
             return result
     
         def get_runtime(self, name: str) -> types.Runtime:
    -        """Get the the Runtime object"""
    +        """Get the the Runtime object prefer namespaced, fall-back to cluster-scoped"""

    Same change goes for each occurence here

    szaher szaher commented on code on Nov 04, 2025 11:31 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend_test.py:1
    @@ -490,6 +500,37 @@ def create_cluster_training_runtime(
         )
     
     
    +def create_training_runtime(
    +    name: str,
    +    namespace: str = "default",
    +) -> models.TrainerV1alpha1TrainingRuntime:
    +    """Create a mock namespaced TrainingRuntime object (not cluster-scoped)."""
    +    return models.TrainerV1alpha1TrainingRuntime(
    +        apiVersion=constants.API_VERSION,
    +        kind="TrainingRuntime",
    +        metadata=models.IoK8sApimachineryPkgApisMetaV1ObjectMeta(
    +            name=name,
    +            namespace=namespace,
    +            labels={constants.RUNTIME_FRAMEWORK_LABEL: name},
    +        ),
    +        spec=models.TrainerV1alpha1TrainingRuntimeSpec(
    +            mlPolicy=models.TrainerV1alpha1MLPolicy(
    +                torch=models.TrainerV1alpha1TorchMLPolicySource(
    +                    numProcPerNode=models.IoK8sApimachineryPkgUtilIntstrIntOrString(2)
    +                ),
    +                numNodes=2,
    +            ),
    +            template=models.TrainerV1alpha1JobSetTemplateSpec(
    +                metadata=models.IoK8sApimachineryPkgApisMetaV1ObjectMeta(
    +                    name=name,
    +                    namespace=namespace,
    +                ),
    +                spec=models.JobsetV1alpha2JobSetSpec(replicatedJobs=[get_replicated_job()]),
    +            ),
    +        ),
    +    )
    +
    +

    did you mean to create this in kubernetes/backend_test.py?
    this is not a test function and I believe it should be added to the TrainerClient and propagated to the different backends.

    shaikmoeed shaikmoeed commented on code on Nov 19, 2025 17:28 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend_test.py:1
    @@ -490,6 +500,37 @@ def create_cluster_training_runtime(
         )
     
     
    +def create_training_runtime(
    +    name: str,
    +    namespace: str = "default",
    +) -> models.TrainerV1alpha1TrainingRuntime:
    +    """Create a mock namespaced TrainingRuntime object (not cluster-scoped)."""
    +    return models.TrainerV1alpha1TrainingRuntime(
    +        apiVersion=constants.API_VERSION,
    +        kind="TrainingRuntime",
    +        metadata=models.IoK8sApimachineryPkgApisMetaV1ObjectMeta(
    +            name=name,
    +            namespace=namespace,
    +            labels={constants.RUNTIME_FRAMEWORK_LABEL: name},
    +        ),
    +        spec=models.TrainerV1alpha1TrainingRuntimeSpec(
    +            mlPolicy=models.TrainerV1alpha1MLPolicy(
    +                torch=models.TrainerV1alpha1TorchMLPolicySource(
    +                    numProcPerNode=models.IoK8sApimachineryPkgUtilIntstrIntOrString(2)
    +                ),
    +                numNodes=2,
    +            ),
    +            template=models.TrainerV1alpha1JobSetTemplateSpec(
    +                metadata=models.IoK8sApimachineryPkgApisMetaV1ObjectMeta(
    +                    name=name,
    +                    namespace=namespace,
    +                ),
    +                spec=models.JobsetV1alpha2JobSetSpec(replicatedJobs=[get_replicated_job()]),
    +            ),
    +        ),
    +    )
    +
    +

    Similar to create_train_job, I thought to use create_training_runtime to pass here instead of empty list. Please correct me, if this was not intended?

    shaikmoeed shaikmoeed commented on code on Nov 19, 2025 17:31 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -59,21 +59,33 @@ def __init__(self, cfg: KubernetesBackendConfig):
         def list_runtimes(self) -> list[types.Runtime]:
             result = []
             try:
    -            thread = self.custom_api.list_cluster_custom_object(
    +            cluster_thread = self.custom_api.list_cluster_custom_object(
                     constants.GROUP,
                     constants.VERSION,
                     constants.CLUSTER_TRAINING_RUNTIME_PLURAL,
                     async_req=True,
                 )
     
    -            runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    -                thread.get(common_constants.DEFAULT_TIMEOUT)
    +            namespace_thread = self.custom_api.list_namespaced_custom_object(
    +                constants.GROUP,
    +                constants.VERSION,
    +                self.namespace,
    +                constants.TRAINING_RUNTIME_PLURAL,
    +                async_req=True,
    +            )
    +
    +            cluster_runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    +                cluster_thread.get(constants.DEFAULT_TIMEOUT)

    Done! Reason for test case failures!

    coveralls coveralls commented on Nov 19, 2025 18:00 UTC
    Contributor

    Pull Request Test Coverage Report for Build 22127337630

    Warning: This coverage report may be inaccurate.

    This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

  • For more information on this, see <a target="_blank" href="https://docs.coveralls.io/build-types#tracking-coverage-changes-with-pull_request-builds">Tracking coverage changes with pull request builds</a>.

  • To avoid this issue with future PRs, see these <a target="_blank" href="https://docs.coveralls.io/build-types#recommended-ci-configurations">Recommended CI Configurations</a>.

  • For a quick fix, <a target="_blank" href="https://github.blog/changelog/2022-02-03-more-ways-to-keep-your-pull-request-branch-up-to-date/#update-your-pull-request-branch-by-rebasing">rebase this PR at GitHub</a>. Your next report should be accurate.
  • Details

    68 of 86 (79.07%) changed or added relevant lines in 4 files are covered.
    16 unchanged lines in 2 files lost coverage.

  • Overall coverage decreased (-0.2%) to 76.436%
  • ---

    | Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
    | :-----|--------------|--------|---: |
    | kubeflow/trainer/types/types.py | 6 | 7 | 85.71%
    | kubeflow/trainer/backends/kubernetes/backend_test.py | 28 | 34 | 82.35%
    | kubeflow/trainer/backends/kubernetes/backend.py | 32 | 43 | 74.42%
    <!-- | Total: | 68 | 86 | 79.07% | -->

    | Files with Coverage Reduction | New Missed Lines | % |
    | :-----|--------------|--: |
    | kubeflow/trainer/backends/kubernetes/backend.py | 8 | 77.89% |
    | kubeflow/trainer/backends/kubernetes/backend_test.py | 8 | 93.27% |
    <!-- | Total: | 16 | | -->

    | Totals | ![Coverage Status](https://coveralls.io/builds/77867260) |
    | :-- | --: |
    | Change from base Build 22048455236: | -0.2% |
    | Covered Lines: | 4337 |
    | Relevant Lines: | 5674 |

    ---
    ##### 💛 - Coveralls

    shaikmoeed shaikmoeed commented on Nov 19, 2025 18:38 UTC
    Author

    @abhijeet-dhumal, can you review it again during your free time?

    kramaranya kramaranya commented on code on Nov 21, 2025 13:22 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -87,28 +99,56 @@ def list_runtimes(self) -> list[types.Runtime]:
                     result.append(self.__get_runtime_from_cr(runtime))
     
             except multiprocessing.TimeoutError as e:
    -            raise TimeoutError(f"Timeout to list {constants.CLUSTER_TRAINING_RUNTIME_KIND}s") from e
    +            raise TimeoutError(
    +                "Timeout to list "
    +                f"{constants.CLUSTER_TRAINING_RUNTIME_KIND}s/{constants.TRAINING_RUNTIME_KIND}s "
    +                f"in namespace: {self.namespace}"
    +            ) from e
             except Exception as e:
    -            raise RuntimeError(f"Failed to list {constants.CLUSTER_TRAINING_RUNTIME_KIND}s") from e
    +            raise RuntimeError(
    +                "Failed to list "
    +                f"{constants.CLUSTER_TRAINING_RUNTIME_KIND}s/{constants.TRAINING_RUNTIME_KIND}s "
    +                f"in namespace: {self.namespace}"
    +            ) from e

    What If only cluster runtimes exist (no TrainingRuntime CRD)? The entire list_runtimes will fail with RuntimeError, which we don't want, right?

    kramaranya kramaranya commented on code on Nov 21, 2025 13:24 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -87,28 +99,56 @@ def list_runtimes(self) -> list[types.Runtime]:
                     result.append(self.__get_runtime_from_cr(runtime))
     
             except multiprocessing.TimeoutError as e:
    -            raise TimeoutError(f"Timeout to list {constants.CLUSTER_TRAINING_RUNTIME_KIND}s") from e
    +            raise TimeoutError(
    +                "Timeout to list "
    +                f"{constants.CLUSTER_TRAINING_RUNTIME_KIND}s/{constants.TRAINING_RUNTIME_KIND}s "
    +                f"in namespace: {self.namespace}"
    +            ) from e

    What if one type times out and the other succeeds? I think we still should return partial results

    kramaranya kramaranya commented on code on Nov 21, 2025 13:27 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -87,28 +99,56 @@ def list_runtimes(self) -> list[types.Runtime]:
                     result.append(self.__get_runtime_from_cr(runtime))
     
             except multiprocessing.TimeoutError as e:
    -            raise TimeoutError(f"Timeout to list {constants.CLUSTER_TRAINING_RUNTIME_KIND}s") from e
    +            raise TimeoutError(
    +                "Timeout to list "
    +                f"{constants.CLUSTER_TRAINING_RUNTIME_KIND}s/{constants.TRAINING_RUNTIME_KIND}s "
    +                f"in namespace: {self.namespace}"

    nit: cluster scoped runtimes are not really in a namespace

    kramaranya kramaranya commented on code on Nov 21, 2025 13:37 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -87,28 +99,56 @@ def list_runtimes(self) -> list[types.Runtime]:
                     result.append(self.__get_runtime_from_cr(runtime))
     
             except multiprocessing.TimeoutError as e:
    -            raise TimeoutError(f"Timeout to list {constants.CLUSTER_TRAINING_RUNTIME_KIND}s") from e
    +            raise TimeoutError(
    +                "Timeout to list "
    +                f"{constants.CLUSTER_TRAINING_RUNTIME_KIND}s/{constants.TRAINING_RUNTIME_KIND}s "
    +                f"in namespace: {self.namespace}"
    +            ) from e
             except Exception as e:
    -            raise RuntimeError(f"Failed to list {constants.CLUSTER_TRAINING_RUNTIME_KIND}s") from e
    +            raise RuntimeError(
    +                "Failed to list "
    +                f"{constants.CLUSTER_TRAINING_RUNTIME_KIND}s/{constants.TRAINING_RUNTIME_KIND}s "
    +                f"in namespace: {self.namespace}"
    +            ) from e
     
             return result
     
         def get_runtime(self, name: str) -> types.Runtime:
    -        """Get the Runtime object"""
    +        """Get the Runtime object prefer namespaced, fall-back to cluster-scoped"""
     
             try:
    -            thread = self.custom_api.get_cluster_custom_object(
    +            cluster_thread = self.custom_api.get_cluster_custom_object(
                     constants.GROUP,
                     constants.VERSION,
                     constants.CLUSTER_TRAINING_RUNTIME_PLURAL,
                     name,
                     async_req=True,
                 )
     
    -            runtime = models.TrainerV1alpha1ClusterTrainingRuntime.from_dict(
    -                thread.get(common_constants.DEFAULT_TIMEOUT)  # type: ignore
    +            namespace_thread = self.custom_api.get_namespaced_custom_object(
    +                constants.GROUP,
    +                constants.VERSION,
    +                self.namespace,
    +                constants.TRAINING_RUNTIME_PLURAL,
    +                name,
    +                async_req=True,
                 )
     
    +            # Try namespaced runtime first, fall back to cluster-scoped one
    +            try:
    +                runtime = models.TrainerV1alpha1TrainingRuntime.from_dict(
    +                    namespace_thread.get(common_constants.DEFAULT_TIMEOUT)  # type: ignore
    +                )
    +            except Exception as e:
    +                logger.warning(
    +                    f"Namespaced TrainingRuntime '{self.namespace}/{name}' not found "
    +                    f"({type(e).__name__}: {e}); falling back to cluster-scoped runtime."
    +                )

    What if it was for example TimeoutError? We will still silently fallback to cluster scoped runtimes, right? I would suggest only treating not found / missing CRD as fall back.

    kramaranya kramaranya commented on code on Nov 21, 2025 13:38 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -87,28 +99,56 @@ def list_runtimes(self) -> list[types.Runtime]:
                     result.append(self.__get_runtime_from_cr(runtime))
     
             except multiprocessing.TimeoutError as e:
    -            raise TimeoutError(f"Timeout to list {constants.CLUSTER_TRAINING_RUNTIME_KIND}s") from e
    +            raise TimeoutError(
    +                "Timeout to list "
    +                f"{constants.CLUSTER_TRAINING_RUNTIME_KIND}s/{constants.TRAINING_RUNTIME_KIND}s "
    +                f"in namespace: {self.namespace}"
    +            ) from e
             except Exception as e:
    -            raise RuntimeError(f"Failed to list {constants.CLUSTER_TRAINING_RUNTIME_KIND}s") from e
    +            raise RuntimeError(
    +                "Failed to list "
    +                f"{constants.CLUSTER_TRAINING_RUNTIME_KIND}s/{constants.TRAINING_RUNTIME_KIND}s "
    +                f"in namespace: {self.namespace}"
    +            ) from e
     
             return result
     
         def get_runtime(self, name: str) -> types.Runtime:

    Similar to list_runtimes(), either case will cause a full failure

    kramaranya kramaranya commented on code on Nov 21, 2025 13:58 UTC
    Code Review
    kubeflow/trainer/constants/constants.py:1
    @@ -26,6 +26,12 @@
     # The plural for the ClusterTrainingRuntime.
     CLUSTER_TRAINING_RUNTIME_PLURAL = "clustertrainingruntimes"
     
    +# The Kind name for the TrainingRuntime.
    +TRAINING_RUNTIME_KIND = "TrainingRuntime"
    +
    +# The plural for the ClusterTrainingRuntime.

    # The plural for the TrainingRuntime.
    

    kramaranya kramaranya commented on Nov 22, 2025 09:23 UTC
    Reviewer

    Thank you @shaikmoeed!
    I'd like all of us to spend more time on designing this properly, since there are a lot of items to consider
    /assign @kubeflow/kubeflow-sdk-team

    abhijeet-dhumal abhijeet-dhumal commented on code on Nov 24, 2025 06:49 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -59,21 +59,33 @@ def __init__(self, cfg: KubernetesBackendConfig):
         def list_runtimes(self) -> list[types.Runtime]:
             result = []
             try:
    -            thread = self.custom_api.list_cluster_custom_object(
    +            cluster_thread = self.custom_api.list_cluster_custom_object(
                     constants.GROUP,
                     constants.VERSION,
                     constants.CLUSTER_TRAINING_RUNTIME_PLURAL,
                     async_req=True,
                 )
     
    -            runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    -                thread.get(common_constants.DEFAULT_TIMEOUT)
    +            namespace_thread = self.custom_api.list_namespaced_custom_object(
    +                constants.GROUP,
    +                constants.VERSION,
    +                self.namespace,
    +                constants.TRAINING_RUNTIME_PLURAL,
    +                async_req=True,
    +            )
    +
    +            cluster_runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    +                cluster_thread.get(common_constants.DEFAULT_TIMEOUT)
                 )
     
    -            if not runtime_list:
    +            namespace_runtime_list = models.TrainerV1alpha1TrainingRuntimeList.from_dict(
    +                namespace_thread.get(common_constants.DEFAULT_TIMEOUT)
    +            )
    +
    +            if not (cluster_runtime_list or namespace_runtime_list):
                     return result
     
    -            for runtime in runtime_list.items:
    +            for runtime in namespace_runtime_list.items + cluster_runtime_list.items:

    @shaikmoeed
    Quick question : What if runtimes with the same name exists in both cluster and namespace scoped ?
    IIUC you have implemented namespace scoped priority in get_runtime() where trainingRuntimes get's first priority..

    thinking should it be same case for list_runtimes method too ?
    And one more thing, In case of list_runtimes it's just appending both even if duplicates comes in..
    So for end user how user will be able to know the kind of runtime via list_runtimes's list items ?

    abhijeet-dhumal abhijeet-dhumal commented on code on Nov 24, 2025 06:55 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -59,21 +59,33 @@ def __init__(self, cfg: KubernetesBackendConfig):
         def list_runtimes(self) -> list[types.Runtime]:
             result = []
             try:
    -            thread = self.custom_api.list_cluster_custom_object(
    +            cluster_thread = self.custom_api.list_cluster_custom_object(
                     constants.GROUP,
                     constants.VERSION,
                     constants.CLUSTER_TRAINING_RUNTIME_PLURAL,
                     async_req=True,
                 )
     
    -            runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    -                thread.get(common_constants.DEFAULT_TIMEOUT)
    +            namespace_thread = self.custom_api.list_namespaced_custom_object(
    +                constants.GROUP,
    +                constants.VERSION,
    +                self.namespace,
    +                constants.TRAINING_RUNTIME_PLURAL,
    +                async_req=True,
    +            )
    +
    +            cluster_runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    +                cluster_thread.get(common_constants.DEFAULT_TIMEOUT)
                 )
     
    -            if not runtime_list:
    +            namespace_runtime_list = models.TrainerV1alpha1TrainingRuntimeList.from_dict(
    +                namespace_thread.get(common_constants.DEFAULT_TIMEOUT)
    +            )
    +
    +            if not (cluster_runtime_list or namespace_runtime_list):
                     return result
     
    -            for runtime in runtime_list.items:
    +            for runtime in namespace_runtime_list.items + cluster_runtime_list.items:

    What if we introduce kind and namespace(optional) params in Runtime dataclass here : https://github.com/kubeflow/sdk/blob/49a5087bb1154c0505cbe2a004db17d4d373c82a/kubeflow/trainer/types/types.py#L251
    So that

    for runtime in runtimes:
        print(f"{runtime.name} ({runtime.kind}, ns={runtime.namespace})")
        
    # Output:
    # torch-runtime (TrainingRuntime, ns=team-a)
    # torch-runtime (ClusterTrainingRuntime, ns=None)
    # custom-runtime (TrainingRuntime, ns=team-a)
    

    abhijeet-dhumal abhijeet-dhumal commented on code on Nov 24, 2025 06:55 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -59,21 +59,33 @@ def __init__(self, cfg: KubernetesBackendConfig):
         def list_runtimes(self) -> list[types.Runtime]:
             result = []
             try:
    -            thread = self.custom_api.list_cluster_custom_object(
    +            cluster_thread = self.custom_api.list_cluster_custom_object(
                     constants.GROUP,
                     constants.VERSION,
                     constants.CLUSTER_TRAINING_RUNTIME_PLURAL,
                     async_req=True,
                 )
     
    -            runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    -                thread.get(common_constants.DEFAULT_TIMEOUT)
    +            namespace_thread = self.custom_api.list_namespaced_custom_object(
    +                constants.GROUP,
    +                constants.VERSION,
    +                self.namespace,
    +                constants.TRAINING_RUNTIME_PLURAL,
    +                async_req=True,
    +            )
    +
    +            cluster_runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    +                cluster_thread.get(common_constants.DEFAULT_TIMEOUT)
                 )
     
    -            if not runtime_list:
    +            namespace_runtime_list = models.TrainerV1alpha1TrainingRuntimeList.from_dict(
    +                namespace_thread.get(common_constants.DEFAULT_TIMEOUT)
    +            )
    +
    +            if not (cluster_runtime_list or namespace_runtime_list):
                     return result
     
    -            for runtime in runtime_list.items:
    +            for runtime in namespace_runtime_list.items + cluster_runtime_list.items:

    WDYT? @kramaranya @szaher ?

    kramaranya kramaranya commented on code on Dec 02, 2025 23:14 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -59,21 +59,33 @@ def __init__(self, cfg: KubernetesBackendConfig):
         def list_runtimes(self) -> list[types.Runtime]:
             result = []
             try:
    -            thread = self.custom_api.list_cluster_custom_object(
    +            cluster_thread = self.custom_api.list_cluster_custom_object(
                     constants.GROUP,
                     constants.VERSION,
                     constants.CLUSTER_TRAINING_RUNTIME_PLURAL,
                     async_req=True,
                 )
     
    -            runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    -                thread.get(common_constants.DEFAULT_TIMEOUT)
    +            namespace_thread = self.custom_api.list_namespaced_custom_object(
    +                constants.GROUP,
    +                constants.VERSION,
    +                self.namespace,
    +                constants.TRAINING_RUNTIME_PLURAL,
    +                async_req=True,
    +            )
    +
    +            cluster_runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    +                cluster_thread.get(common_constants.DEFAULT_TIMEOUT)
                 )
     
    -            if not runtime_list:
    +            namespace_runtime_list = models.TrainerV1alpha1TrainingRuntimeList.from_dict(
    +                namespace_thread.get(common_constants.DEFAULT_TIMEOUT)
    +            )
    +
    +            if not (cluster_runtime_list or namespace_runtime_list):
                     return result
     
    -            for runtime in runtime_list.items:
    +            for runtime in namespace_runtime_list.items + cluster_runtime_list.items:

    I'd be in favor of adding a scope field instead, with values like "project" and "cluster", so we don't expose any k8s terminology to users.
    Regarding namespace I don't think AI practitioners need to see it, since they already know they're working in their project context (set at client init time).
    cc @andreyvelich @astefanutti

    astefanutti astefanutti commented on code on Dec 03, 2025 08:05 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -59,21 +59,33 @@ def __init__(self, cfg: KubernetesBackendConfig):
         def list_runtimes(self) -> list[types.Runtime]:
             result = []
             try:
    -            thread = self.custom_api.list_cluster_custom_object(
    +            cluster_thread = self.custom_api.list_cluster_custom_object(
                     constants.GROUP,
                     constants.VERSION,
                     constants.CLUSTER_TRAINING_RUNTIME_PLURAL,
                     async_req=True,
                 )
     
    -            runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    -                thread.get(common_constants.DEFAULT_TIMEOUT)
    +            namespace_thread = self.custom_api.list_namespaced_custom_object(
    +                constants.GROUP,
    +                constants.VERSION,
    +                self.namespace,
    +                constants.TRAINING_RUNTIME_PLURAL,
    +                async_req=True,
    +            )
    +
    +            cluster_runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    +                cluster_thread.get(common_constants.DEFAULT_TIMEOUT)
                 )
     
    -            if not runtime_list:
    +            namespace_runtime_list = models.TrainerV1alpha1TrainingRuntimeList.from_dict(
    +                namespace_thread.get(common_constants.DEFAULT_TIMEOUT)
    +            )
    +
    +            if not (cluster_runtime_list or namespace_runtime_list):
                     return result
     
    -            for runtime in runtime_list.items:
    +            for runtime in namespace_runtime_list.items + cluster_runtime_list.items:

    +1 for a scope field, though I wonder whether it could be more symmetrical to the resolution logic in the get_runtime and not returning the ClusterTrainingRuntimes that are "overwritten" in the client namespace. This way I don't think any additional field would be needed.

    andreyvelich andreyvelich commented on code on Dec 05, 2025 02:24 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -59,21 +59,33 @@ def __init__(self, cfg: KubernetesBackendConfig):
         def list_runtimes(self) -> list[types.Runtime]:
             result = []
             try:
    -            thread = self.custom_api.list_cluster_custom_object(
    +            cluster_thread = self.custom_api.list_cluster_custom_object(
                     constants.GROUP,
                     constants.VERSION,
                     constants.CLUSTER_TRAINING_RUNTIME_PLURAL,
                     async_req=True,
                 )
     
    -            runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    -                thread.get(common_constants.DEFAULT_TIMEOUT)
    +            namespace_thread = self.custom_api.list_namespaced_custom_object(
    +                constants.GROUP,
    +                constants.VERSION,
    +                self.namespace,
    +                constants.TRAINING_RUNTIME_PLURAL,
    +                async_req=True,
    +            )
    +
    +            cluster_runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    +                cluster_thread.get(common_constants.DEFAULT_TIMEOUT)
                 )
     
    -            if not runtime_list:
    +            namespace_runtime_list = models.TrainerV1alpha1TrainingRuntimeList.from_dict(
    +                namespace_thread.get(common_constants.DEFAULT_TIMEOUT)
    +            )
    +
    +            if not (cluster_runtime_list or namespace_runtime_list):
                     return result
     
    -            for runtime in runtime_list.items:
    +            for runtime in namespace_runtime_list.items + cluster_runtime_list.items:

    Shall we configure this setting during TrainerClient() initialization?
    I am curious if we ever have a use-case when users want to create a single TrainerClient() which can work with TrainingRuntime and ClusterTrainingRuntime ?

    kramaranya kramaranya commented on Jan 05, 2026 15:16 UTC
    Contributor

    Hey, @shaikmoeed! Are you still working on this PR? Did you have a chance to address the feedback?

    shaikmoeed shaikmoeed commented on Jan 06, 2026 05:50 UTC
    Author

    Hey, @shaikmoeed! Are you still working on this PR? Did you have a chance to address the feedback?

    @kramaranya Haven't got a chance to address the feedback. Will update the PR by next week.

    kramaranya kramaranya commented on Jan 13, 2026 17:27 UTC
    Contributor

    Hey @shaikmoeed! Are you still working on this PR? It would be great if we could include this feature in 0.3 release (we aim to cut the release this week)

    shaikmoeed shaikmoeed commented on Jan 15, 2026 09:03 UTC
    Author

    Hey @shaikmoeed! Are you still working on this PR? It would be great if we could include this feature in 0.3 release (we aim to cut the release this week)

    @kramaranya Sorry for the delay, I have addressed all the comments! Can you please provide your review?

    shaikmoeed shaikmoeed commented on Feb 06, 2026 12:46 UTC
    Author

    @kramaranya @abhijeet-dhumal @andreyvelich Request for review!

    abhijeet-dhumal abhijeet-dhumal commented on code on Feb 10, 2026 06:45 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -412,8 +492,17 @@ def delete_job(self, name: str):
     
         def __get_runtime_from_cr(
             self,
    -        runtime_cr: models.TrainerV1alpha1ClusterTrainingRuntime,
    +        runtime_cr: Union[
    +            models.TrainerV1alpha1ClusterTrainingRuntime, models.TrainerV1alpha1TrainingRuntime
    +        ],
         ) -> types.Runtime:
    +        crd_kind = getattr(runtime_cr, "kind", "UnknownKind")

    QQ: It seems relying on kind field being present. K8s API doesn't always return kind on retrieved objects (it's often omitted). If missing, scope stays None.
    what if we use type check which doesn't rely on K8s api response fileds.. something like :.

    scope = (
        "cluster"
        if isinstance(runtime_cr, models.TrainerV1alpha1ClusterTrainingRuntime)
        else "project"
    )
    

    abhijeet-dhumal abhijeet-dhumal commented on code on Feb 10, 2026 06:52 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend_test.py:1
    @@ -546,9 +593,13 @@ def create_runtime_type(
             image="example.com/test-runtime",
         )
         trainer.set_command(constants.TORCH_COMMAND)
    +    # Namespaced TrainingRuntime objects and default torch runtime use project scope;
    +    # other runtimes created as cluster-scoped use cluster scope.
    +    scope = "project" if name.startswith("ns-") or name == TORCH_RUNTIME else "cluster"

    Thinking .. Scope is derived from naming convention. Adding a runtime like "my-custom-runtime" silently gets scope="cluster" even if it's namespaced.

    Consider suggestion provided by @kramaranya from here :
    https://github.com/kubeflow/sdk/pull/130#discussion_r2583080641, Something like :

    create_runtime_type(name="my-custom-runtime", scope="project")
    

    In this case explicit is better than implicit

    abhijeet-dhumal abhijeet-dhumal commented on code on Feb 10, 2026 06:53 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend_test.py:1
    @@ -546,9 +593,13 @@ def create_runtime_type(
             image="example.com/test-runtime",
         )
         trainer.set_command(constants.TORCH_COMMAND)
    +    # Namespaced TrainingRuntime objects and default torch runtime use project scope;
    +    # other runtimes created as cluster-scoped use cluster scope.
    +    scope = "project" if name.startswith("ns-") or name == TORCH_RUNTIME else "cluster"

    wdyt @shaikmoeed ?

    abhijeet-dhumal abhijeet-dhumal commented on Feb 10, 2026 08:40 UTC
    Contributor

    Following up on @astefanutti's comment about symmetry between list_runtimes() and get_runtime().

    According to current behavior and if we consider separate scope arg :
    If Namespace has "torch-runtime", cluster also has "torch-runtime"
    client.list_runtimes() will return :

    - torch-runtime (scope=project)
    - torch-runtime (scope=cluster)  ...duplicate name
    

    client.get_runtime("torch-runtime")
    Returns one:
    - torch-runtime (scope=project)  .. namespaced wins
    

    so user sees duplicate names in list, but get_runtime() silently picks one.
    This creates confusion — "which one will user actually get?"

    so what if :

    client.list_runtimes()
    Returns:

    - torch-runtime (scope=project)  ... namespaced, shadows cluster
    

    client.get_runtime("torch-runtime")
    Returns:
    - torch-runtime (scope=project)  ... matches what list shows
    

    here are some edge cases i could think of on top of my head :

  • Same name in both scopes - Namespaced returned, cluster hidden

  • Only cluster runtime exists - Returned with scope="cluster"

  • Only namespaced runtime exists - Returned with scope="project"

  • User needs shadowed cluster runtime - Use kubectl or rename .. rare admin case
  • WDYT? @shaikmoeed

    Copilot Copilot commented on code on Feb 11, 2026 14:06 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend_test.py:1
    @@ -332,6 +332,12 @@ def get_namespaced_custom_object_response(*args, **kwargs):
             raise RuntimeError()
         if args[3] == TRAIN_JOBS:  # TODO: review this.
             mock_thread.get.return_value = add_status(create_train_job(train_job_name=args[4]))
    +    elif args[3] == constants.TRAINING_RUNTIME_PLURAL:
    +        # Return a namespaced TrainingRuntime for the requested name.
    +        mock_thread.get.return_value = normalize_model(

    The docstring says this helper returns a mocked TrainJob object, but it now also returns namespaced TrainingRuntime objects; update the docstring to reflect the expanded behavior to avoid misleading future test maintenance.

    Copilot Copilot commented on code on Feb 11, 2026 14:06 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend_test.py:1
    @@ -374,6 +380,16 @@ def list_namespaced_custom_object_response(*args, **kwargs):
                 models.TrainerV1alpha1TrainJobList(items=items),
                 models.TrainerV1alpha1TrainJobList,
             )
    +    elif args[3] == constants.TRAINING_RUNTIME_PLURAL:
    +        # Added namespace-scoped runtimes for testing.
    +        items = [

    The docstring says this helper returns a list of mocked TrainJob objects, but the new branch also returns TrainingRuntime lists; update the docstring so the mocked behavior is accurate.

    Copilot Copilot commented on code on Feb 11, 2026 14:06 UTC
    Code Review
    kubeflow/trainer/types/types.py:1
    @@ -252,6 +252,12 @@ class Runtime:
         name: str
         trainer: RuntimeTrainer
         pretrained_model: Optional[str] = None
    +    scope: Optional[str] = None
    +
    +    def __post_init__(self):
    +        valid_scopes = ["project", "cluster", None]
    +        if self.scope not in valid_scopes:
    +            raise ValueError(f"Scope must be one of {valid_scopes}, got '{self.scope}'")

    The Runtime.scope allowed value "project" is ambiguous for a Kubernetes namespaced resource; consider renaming the scope values to "namespace"/"namespaced" (and updating backend/tests) or introducing an enum so the public SDK surface matches the underlying scoping semantics.

    Copilot Copilot commented on code on Feb 11, 2026 14:06 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -422,7 +510,10 @@ def __get_runtime_from_cr(
                 and runtime_cr.spec.template.spec
                 and runtime_cr.spec.template.spec.replicated_jobs
             ):
    -            raise Exception(f"ClusterTrainingRuntime CR is invalid: {runtime_cr}")
    +            raise Exception(
    +                f"{runtime_cr}' is invalid — missing one or more required fields: "
    +                f"metadata.name, spec.mlPolicy, spec.template.spec.replicatedJobs.\n"

    The invalid-CR exception message has a stray quote after the runtime object and references "replicatedJobs" while the code checks replicated_jobs, which makes the error output confusing when debugging.

                    f"{runtime_cr} is invalid — missing one or more required fields: "
                    "metadata.name, spec.ml_policy, spec.template.spec.replicated_jobs.\n"
    

    Copilot Copilot commented on code on Feb 11, 2026 14:06 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend_test.py:1
    @@ -507,6 +523,37 @@ def create_cluster_training_runtime(
         )
     
     
    +def create_training_runtime(
    +    name: str,
    +    namespace: str = "default",
    +) -> models.TrainerV1alpha1TrainingRuntime:
    +    """Create a mock namespaced TrainingRuntime object (not cluster-scoped)."""
    +    return models.TrainerV1alpha1TrainingRuntime(
    +        apiVersion=constants.API_VERSION,
    +        kind="TrainingRuntime",

    This test helper hardcodes kind="TrainingRuntime" even though the PR adds constants.TRAINING_RUNTIME_KIND; using the constant here avoids drift if the kind ever changes and keeps tests aligned with the SDK constants.

            kind=constants.TRAINING_RUNTIME_KIND,
    

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Feb 11, 2026 14:06 UTC
    Reviewer

    Pull request overview

    Adds SDK support for namespaced TrainingRuntime resources alongside existing cluster-scoped ClusterTrainingRuntime, enabling users to list/get runtimes from their namespace and fall back to cluster runtimes as needed.

    Changes:

  • Add scope to types.Runtime and populate it when converting runtime CRs to SDK types.

  • Extend Kubernetes backend to list both namespaced and cluster runtimes, and prefer namespaced runtime on get_runtime().

  • Update Kubernetes backend tests/mocks to cover namespaced TrainingRuntime list/get behavior.
  • Reviewed changes

    Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

    | File | Description |
    | ---- | ----------- |
    | kubeflow/trainer/types/types.py | Introduces Runtime.scope with validation of allowed values. |
    | kubeflow/trainer/constants/constants.py | Adds kind/plural constants for namespaced TrainingRuntime. |
    | kubeflow/trainer/backends/kubernetes/backend.py | Implements list/get support for namespaced runtimes and sets Runtime.scope. |
    | kubeflow/trainer/backends/kubernetes/backend_test.py | Extends mocks and expected outputs for namespaced runtime scenarios. |

    shaikmoeed shaikmoeed commented on code on Feb 11, 2026 15:31 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend_test.py:1
    @@ -546,9 +593,13 @@ def create_runtime_type(
             image="example.com/test-runtime",
         )
         trainer.set_command(constants.TORCH_COMMAND)
    +    # Namespaced TrainingRuntime objects and default torch runtime use project scope;
    +    # other runtimes created as cluster-scoped use cluster scope.
    +    scope = "project" if name.startswith("ns-") or name == TORCH_RUNTIME else "cluster"

    Yeah, agree. Made the relevant changes!

    shaikmoeed shaikmoeed commented on code on Feb 11, 2026 15:32 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -412,8 +492,17 @@ def delete_job(self, name: str):
     
         def __get_runtime_from_cr(
             self,
    -        runtime_cr: models.TrainerV1alpha1ClusterTrainingRuntime,
    +        runtime_cr: Union[
    +            models.TrainerV1alpha1ClusterTrainingRuntime, models.TrainerV1alpha1TrainingRuntime
    +        ],
         ) -> types.Runtime:
    +        crd_kind = getattr(runtime_cr, "kind", "UnknownKind")

    Thanks, it simplifies code as well! Updated with changes!

    Copilot Copilot commented on code on Feb 11, 2026 15:34 UTC
    Code Review
    kubeflow/trainer/types/types.py:1
    @@ -245,6 +245,13 @@ class TrainerType(Enum):
         BUILTIN_TRAINER = BuiltinTrainer.__name__
     
     
    +class RuntimeScope(Enum):
    +    """Scope for training runtimes."""
    +
    +    NAMESPACE = "project"
    +    CLUSTER = "cluster"

    RuntimeScope.NAMESPACE is set to the string value "project", which is inconsistent with Kubernetes terminology and the PR intent (namespaced runtimes) and will be confusing if this value is ever surfaced/serialized; consider renaming the value to "namespace" (or "namespaced") to match the concept being modeled.

    Copilot Copilot commented on code on Feb 11, 2026 15:34 UTC
    Code Review
    kubeflow/trainer/backends/kubernetes/backend.py:1
    @@ -57,68 +57,148 @@ def __init__(self, cfg: KubernetesBackendConfig):
             self.namespace = cfg.namespace
     
         def list_runtimes(self) -> list[types.Runtime]:
    -        result = []
    +        result: list[types.Runtime] = []
    +
    +        cluster_err = None
    +        namespace_err = None
    +        cluster_runtime_list = None
    +        namespace_runtime_list = None
    +
             try:
                 thread = self.custom_api.list_cluster_custom_object(
                     constants.GROUP,
                     constants.VERSION,
                     constants.CLUSTER_TRAINING_RUNTIME_PLURAL,
                     async_req=True,
                 )
    +            cluster_runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    +                thread.get(common_constants.DEFAULT_TIMEOUT)
    +            )
    +        except multiprocessing.TimeoutError as e:
    +            cluster_err = e
    +            logger.warning("Cluster runtimes timed out", exc_info=True)
    +        except Exception as e:
    +            cluster_err = e
    +            logger.warning("Cluster runtimes failed", exc_info=True)
     
    -            runtime_list = models.TrainerV1alpha1ClusterTrainingRuntimeList.from_dict(
    +        try:
    +            thread = self.custom_api.list_namespaced_custom_object(
    +                constants.GROUP,
    +                constants.VERSION,
    +                self.namespace,
    +                constants.TRAINING_RUNTIME_PLURAL,
    +                async_req=True,
    +            )
    +            namespace_runtime_list = models.TrainerV1alpha1TrainingRuntimeList.from_dict(
                     thread.get(common_constants.DEFAULT_TIMEOUT)
                 )

    list_runtimes() uses async_req=True but immediately blocks on each .get() sequentially, which adds unnecessary latency; start both async requests first and then wait for both results (handling errors per-scope) to keep the end-to-end call closer to the slower of the two API calls rather than the sum.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Feb 11, 2026 15:34 UTC
    Reviewer

    Pull request overview

    Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Feb 14, 2026 04:49 UTC
    Reviewer

    Pull request overview

    Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

    <details>
    <summary>Comments suppressed due to low confidence (1)</summary>

    kubeflow/trainer/backends/kubernetes/backend_test.py:735

  • Missing test coverage for the fallback scenario in get_runtime. The current test only covers the case where a namespaced runtime exists. Add a test case for when a namespaced runtime doesn't exist (404) but a cluster runtime does, to verify the fallback logic works correctly.

  • @pytest.mark.parametrize(
        "test_case",
        [
            TestCase(
                name="valid flow with all defaults",
                expected_status=SUCCESS,
                config={"name": TORCH_RUNTIME},
                expected_output=create_runtime_type(
                    name=TORCH_RUNTIME,
                    scope=types.RuntimeScope.NAMESPACE,
                ),
            ),
            TestCase(
                name="timeout error when getting runtime",
                expected_status=FAILED,
                config={"name": TIMEOUT},
                expected_error=TimeoutError,
            ),
            TestCase(
                name="runtime error when getting runtime",
                expected_status=FAILED,
                config={"name": RUNTIME},
                expected_error=RuntimeError,
            ),
        ],
    )
    

    </details>

    shaikmoeed shaikmoeed commented on Feb 18, 2026 14:08 UTC
    Author

    @andreyvelich Addressed your comments. Can you please take a look now?

    google-oss-prow[bot] google-oss-prow[bot] commented on Feb 18, 2026 14:40 UTC
    Bot

    [APPROVALNOTIFIER] This PR is APPROVED

    This pull-request has been approved by: <a href="https://github.com/kubeflow/sdk/pull/130#pullrequestreview-3820286002" title="Approved">andreyvelich</a>

    The full list of commands accepted by this bot can be found here.

    The pull request process is described here

    <details >
    Needs approval from an approver in each of these files:

  • ~~OWNERS~~ [andreyvelich]
  • Approvers can indicate their approval by writing /approve in a comment
    Approvers can cancel approval by writing /approve cancel in a comment
    </details>
    <!-- META={"approvers":[]} -->

    Assignees
    shaikmoeed shaikmoeed
    Labels
    risk: low confidence: 90.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.2% (MEDIUM) · Higher = larger blast radius
    40.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 90.8% · Lower = rushed or shallow review
    90.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 3.7% · Safe to merge
    3.7%
    Repository