Fix variant BasicInfo rendering '0' when numeric fields are zero#6128
Open
Fix variant BasicInfo rendering '0' when numeric fields are zero#6128
Conversation
When numeric fields like temperature, top_p, max_tokens etc. have a value of 0, the truthy check `field &&` evaluates to `0 && <JSX>` which returns the number 0 instead of false, causing React to render "0" as text. Changed all numeric field checks from `field &&` to `field !== null &&` to properly handle the case when a field is 0. Affects chat_completion, best_of_n_sampling, dicl, and mixture_of_n variant types.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
ui/app/routes/observability/functions/$function_name/variants/VariantBasicInfo.tsx
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
field &&) which evaluate to0 && <JSX>→0when the field is zero, causing React to render "0" as textfield !== null &&)Test plan
/observability/functions/extract_entities/variants/gpt4o_mini_initial_promptwhich hastemperature: 0Note
Low Risk
Low risk UI-only change: replaces truthy conditional rendering with explicit
!== nullchecks so valid0values render with labels instead of as stray text. Main risk is only minor display regressions if these fields can beundefinedrather thannull.Overview
Fixes a rendering bug in
VariantBasicInfo.tsxwhere numeric config fields with value0could render as an unlabeled0due to truthy checks.Updates conditional rendering for numeric fields (e.g.,
temperature,top_p,max_tokens, penalties,seed) across variant types to use explicit!== nullchecks, ensuring0is treated as a valid value and shown with its label.Written by Cursor Bugbot for commit a4250fb. This will update automatically on new commits. Configure here.