Skip to content

Fix variant BasicInfo rendering '0' when numeric fields are zero#6128

Open
simeonlee wants to merge 2 commits intomainfrom
simeonlee/fix-variant-basicinfo-zero-render
Open

Fix variant BasicInfo rendering '0' when numeric fields are zero#6128
simeonlee wants to merge 2 commits intomainfrom
simeonlee/fix-variant-basicinfo-zero-render

Conversation

@simeonlee
Copy link
Member

@simeonlee simeonlee commented Feb 4, 2026

Summary

  • Fixed a bug where numeric fields (temperature, top_p, max_tokens, etc.) would render a stray "0" when their value was 0
  • The issue was caused by using truthy checks (field &&) which evaluate to 0 && <JSX>0 when the field is zero, causing React to render "0" as text
  • Changed all numeric field checks to use explicit null checks (field !== null &&)
Screenshot 2026-02-04 at 10 29 46 AM

Test plan

  • Verified on /observability/functions/extract_entities/variants/gpt4o_mini_initial_prompt which has temperature: 0
  • Before: Stray "0" appeared below Model without any label
  • After: "Temperature: 0" appears correctly with its label

Note

Low Risk
Low risk UI-only change: replaces truthy conditional rendering with explicit !== null checks so valid 0 values render with labels instead of as stray text. Main risk is only minor display regressions if these fields can be undefined rather than null.

Overview
Fixes a rendering bug in VariantBasicInfo.tsx where numeric config fields with value 0 could render as an unlabeled 0 due to truthy checks.

Updates conditional rendering for numeric fields (e.g., temperature, top_p, max_tokens, penalties, seed) across variant types to use explicit !== null checks, ensuring 0 is 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.

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.
@simeonlee simeonlee assigned simeonlee and virajmehta and unassigned simeonlee Feb 4, 2026
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

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.

@simeonlee simeonlee assigned simeonlee and virajmehta and unassigned virajmehta and simeonlee Feb 4, 2026
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