Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@carlory
Copy link
Contributor

@carlory carlory commented Jul 18, 2025

What type of PR is this?

/kind bug

What this PR does / why we need it:

when base model can be obtained from isvc.Spec.Model and isvc.Spec.Predictor.Model is nil, the model path won't be mounted. it is not correct.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Fix benchmark container don't  mount model path when base model exists

@carlory carlory requested a review from CatherineSue as a code owner July 18, 2025 08:39
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @carlory, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical bug that prevented benchmark containers from correctly mounting model paths under specific configuration scenarios. The solution involves a targeted refactoring of a key utility function responsible for managing volume mounts, making it more explicit and robust by directly providing the necessary model identification information. This ensures that model paths are consistently mounted when a base model is present.

Highlights

  • Bug Fix: Benchmark Container Volume Mounts: I've addressed a bug where the benchmark container failed to mount the model path correctly. This occurred specifically when the base model was defined in isvc.Spec.Model but isvc.Spec.Predictor.Model was nil, leading to an incorrect determination of whether the model path should be mounted.
  • Refactor: UpdateVolumeMounts Utility Function: The UpdateVolumeMounts utility function in pkg/controller/v1beta1/benchmark/utils/utils.go has been refactored. It now directly accepts the baseModelName as a string argument, simplifying its signature and internal logic. This removes its previous dependency on the full InferenceService object for extracting the model name.
  • Code Consistency and Test Updates: The call site for UpdateVolumeMounts in pkg/controller/v1beta1/benchmark/controller.go has been updated to align with the new function signature, passing the baseModelName directly. Corresponding unit tests in pkg/controller/v1beta1/benchmark/utils/utils_test.go were also modified to reflect these changes, ensuring continued test coverage and correctness.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request fixes a bug where the benchmark container's volume mounts were not correctly updated when the base model was specified via isvc.Spec.Model. The fix refactors UpdateVolumeMounts to be independent of the InferenceService object, which is a good design improvement. The tests have been updated accordingly.

I've identified a potential panic in the updated UpdateVolumeMounts function if the base model's storage path is not defined. I've provided a suggestion to make the function safer and also recommended adding test cases to cover this scenario.

func UpdateVolumeMounts(isvc *v1beta1.InferenceService, container *v1.Container, baseModel *v1beta1.BaseModelSpec) {
if isvc.Spec.Predictor.Model == nil || isvc.Spec.Predictor.Model.BaseModel == nil || baseModel == nil {
func UpdateVolumeMounts(container *v1.Container, baseModelName string, baseModel *v1beta1.BaseModelSpec) {
if baseModelName == "" || baseModel == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This function could panic if baseModel.Storage or baseModel.Storage.Path is nil. The code at lines 139 and 145 dereferences baseModel.Storage.Path without checking if baseModel.Storage or baseModel.Storage.Path are nil.

Please add a check to ensure baseModel.Storage and baseModel.Storage.Path are not nil before proceeding.

Suggested change
if baseModelName == "" || baseModel == nil {
if baseModelName == "" || baseModel == nil || baseModel.Storage == nil || baseModel.Storage.Path == nil {
return
}

Comment on lines +505 to 508
name: "without base model",
container: &v1.Container{},
want: &v1.Container{},
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve test coverage and prevent future regressions, it would be beneficial to add test cases for when baseModel is provided but its Storage or Storage.Path fields are nil. This will ensure the function handles these edge cases gracefully without panicking, especially after the recommended change in utils.go.

@slin1237 slin1237 merged commit 84e9093 into sgl-project:main Jul 18, 2025
24 checks passed
@carlory carlory deleted the patch-1 branch July 18, 2025 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.