-
Notifications
You must be signed in to change notification settings - Fork 95
Fix Azure model selector and inherited provider options #1902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
🦋 Changeset detectedLatest commit: 04861a7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No docs changes detected. These bug fixes align the Visual Builder's behavior with already-documented functionality for model configuration and provider options inheritance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Review Summary
5 Key Findings | Risk: Medium
🟠⚠️ Major (2) 🟠⚠️
🟠 1) model-selector.tsx:288 Azure placeholder value can persist as invalid configuration
Issue: When a user clicks "Azure ..." from the model dropdown, onValueChange?.('azure/...') is called immediately (line 288), setting azure/... as the model value before configuration is complete. If the user navigates away without completing or canceling the Azure configuration, this invalid placeholder value can be persisted to the store and database.
Why: The string azure/... is not a valid model identifier. At runtime, ModelFactory.parseModelString would parse this as provider='azure', modelName='...' which is semantically meaningless. This could cause confusing behavior when the agent runs, displaying an invalid model name in the UI, or triggering errors in downstream model resolution.
Fix: Consider one of these approaches:
- Use separate UI state to track that Azure configuration is "in progress" rather than setting an incomplete model value
- Validate that
azure/...is not accepted as a valid model value before persisting (e.g., in theonModelChangehandler in parent components) - Add an
onBluror navigation guard that clears incomplete Azure configuration
Refs:
- model-selector.tsx:288 — where placeholder is set
- model-selector.tsx:475 — Cancel correctly clears to
''
🟠 2) model-configuration.tsx:68-78 Potential stale closure in useEffect transition detection
Issue: The useEffect on lines 69-78 uses previousValue.current to detect inherited-to-explicit transitions. The ref is read at the start and updated at the end of the effect. The condition wasInherited = previousValue.current === undefined && inheritedValue !== undefined could evaluate to true on every render where value is undefined and inheritedValue exists, not just on actual transitions.
Why: If inheritedValue changes while value remains undefined (e.g., parent component passes a different inheritance source), the effect will fire and potentially clear internalProviderOptions unexpectedly. This could cause loss of displayed inherited provider options when the inheritance chain re-renders.
Fix: Track the transition more explicitly:
const hasTransitionedToExplicit = useRef(false);
useEffect(() => {
// Only clear once when transitioning from inherited to explicit
if (!hasTransitionedToExplicit.current && value !== undefined && inheritedValue !== undefined) {
setInternalProviderOptions(undefined);
hasTransitionedToExplicit.current = true;
}
// Reset the flag when value becomes undefined again
if (value === undefined) {
hasTransitionedToExplicit.current = false;
}
}, [value, inheritedValue]);Refs:
🟡 Minor (2) 🟡
🟡 1) metadata-editor.tsx, model-section.tsx Structured output model missing Azure template placeholder
Issue: The summarizer model configuration includes a getJsonPlaceholder callback to show Azure-specific templates (lines 373-378 in metadata-editor.tsx, lines 181-186 in model-section.tsx), but the structured output model configuration does not provide this callback. This creates an inconsistent UX where Azure models show different placeholder templates depending on the model type.
Why: Users configuring Azure models for structured output will see a generic placeholder instead of the Azure-specific one that shows resourceName and baseURL fields.
Fix: Add getJsonPlaceholder to structured output ModelConfiguration in both files, mirroring the summarizer pattern.
Refs:
- metadata-editor.tsx:373-378 — summarizer has it
- model-section.tsx:307 — structured output should match
🟡 2) model-section.tsx:19-20 Props use any type weakening type safety
Issue: ModelSectionProps uses any for projectModels and agentModels props (lines 19-20). This allows malformed model configurations to pass through without compile-time validation.
Why: The helper functions access nested properties like agentModels?.structuredOutput?.model. With any typing, TypeScript cannot verify callers pass correctly shaped data, which could lead to runtime errors or silent failures in inheritance resolution.
Fix: Use the existing model types:
interface ModelSectionProps {
models: AgentNodeData['models'];
updatePath: (path: string, value: unknown) => void;
projectModels?: AgentNodeData['models'];
agentModels?: AgentNodeData['models'];
}Refs:
- 🟡 Minor:
model-selector.tsx:49Invalid'use memo'directive (see inline comment)
💭 Consider (2) 💭
💭 1) .changeset/odd-pots-sin.md Changeset message undersells scope
Issue: The message "fixed azure model selector" doesn't reflect all changes (inherited provider options display, provider options auto-clearing, X button clearing fixes).
Fix: Update to: "Fix Azure model selector, display inherited provider options, and auto-clear provider options when switching models"
💭 2) metadata-editor.tsx, model-section.tsx Inheritance resolution logic could be extracted
Issue: Similar inheritance cascade logic exists in both files with different implementations (inline ternaries vs helper functions).
Why: Could be extracted to a shared utility to reduce drift risk, though current implementations are correct.
💡 APPROVE WITH SUGGESTIONS
Summary: This PR successfully fixes several model configuration UX issues around Azure selection and provider options inheritance. The core functionality appears sound. The main concerns are: (1) the azure/... placeholder potentially persisting as an invalid configuration if the user abandons the Azure setup flow, and (2) a subtle edge case in the transition detection useEffect. Both are addressable without blocking the PR. The invalid 'use memo' directive should be removed. Nice work on the inheritance model/options pairing logic! 🎉
Discarded (9)
| Location | Issue | Reason Discarded |
|---|---|---|
model-configuration.tsx:80-95 |
handleModelChange not wrapped in useCallback |
LOW confidence, minimal performance impact |
metadata-editor.tsx:77-80 |
updateMetadata empty dependency array |
Zustand actions are stable references |
model-section.tsx:32-80 |
Helper functions not memoized | Acknowledged as acceptable, lightweight computation |
model-selector.tsx:162-195 |
Direct DOM access for cmdk search value | Pre-existing code, library workaround |
model-configuration.tsx:86-92 |
Provider options clearing on same model | Intentional behavior per code comments |
model-configuration.tsx:10-39 |
Dual string/Record type representation | Current design works correctly |
model-section.tsx:29 |
Unused variable cleanup | Positive change, not an issue |
project-models-section.tsx |
Doesn't use ModelConfiguration | Project is root of inheritance chain |
| Various | Various INFO-level notes | Informational only |
Reviewers (5)
| Reviewer | Returned | Main Findings | Consider | While You're Here | Inline Comments | Pending Recs | Discarded |
|---|---|---|---|---|---|---|---|
pr-review-product |
4 | 1 | 1 | 0 | 0 | 0 | 2 |
pr-review-consistency |
5 | 1 | 1 | 0 | 0 | 0 | 3 |
pr-review-types |
2 | 1 | 0 | 0 | 0 | 0 | 1 |
pr-review-frontend |
6 | 1 | 0 | 0 | 1 | 0 | 4 |
pr-review-standards |
0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Total | 17 | 4 | 2 | 0 | 1 | 0 | 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Review Summary
0 Key Findings | Risk: Low
Re-Review Delta Assessment
This re-review is scoped to the changes since the previous automated review (commit ee343ce9 → 8499cf65).
Delta summary: +16 lines across 2 files, adding getJsonPlaceholder callback to structured output ModelConfiguration in both metadata-editor.tsx and model-section.tsx.
Changes Verified ✅
The delta directly addresses 🟡 Minor 1 from the previous review:
Structured output model missing Azure template placeholder
Issue: The summarizer model configuration includes a
getJsonPlaceholdercallback to show Azure-specific templates, but the structured output model configuration does not provide this callback.
Resolution: Both files now include identical getJsonPlaceholder logic for structured output models:
getJsonPlaceholder={(model) => {
if (model?.startsWith('azure/')) {
return azureModelProviderOptionsTemplate;
}
return structuredOutputModelProviderOptionsTemplate;
}}This matches the existing summarizer pattern exactly, ensuring consistent Azure placeholder UX across all model configuration types.
Prior Findings Status
| Finding | Status |
|---|---|
| 🟠 Major 1: Azure placeholder persistence | Unaddressed — still applicable |
| 🟠 Major 2: Stale closure in useEffect | Unaddressed — still applicable |
| 🟡 Minor 1: Structured output missing placeholder | ✅ Addressed in this delta |
🟡 Minor 2: any type for props |
Unaddressed — still applicable |
🟡 Inline: 'use memo' directive |
Unaddressed — still applicable |
| 💭 Consider 1: Changeset message | Unaddressed |
| 💭 Consider 2: Inheritance extraction | Unaddressed |
✅ APPROVE
Summary: The delta cleanly addresses a Minor finding from the previous review with no new issues introduced. The existing Major findings from the prior review remain applicable but do not block this incremental fix. The PR is now in good shape for merge after addressing any Major items per author discretion. Nice follow-through! 🎉
Reviewers (0)
| Reviewer | Returned | Main Findings | Consider | While You're Here | Inline Comments | Pending Recs | Discarded |
|---|---|---|---|---|---|---|---|
| Orchestrator review (delta too small for subagent dispatch) | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Note: Delta was +16 lines addressing a single prior Minor finding. Subagent dispatch was skipped as the change directly mirrors existing reviewed code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Review Summary
1 Key Finding | Risk: Low
Re-Review Delta Assessment
This re-review is scoped to the changes since the previous automated review (commit 8499cf65 → d1e7f881).
Delta summary: +96/-17 lines across 5 files
- New
hasOpenModelConfigZustand state to track open model configuration modals - Toolbar Save and "Try it" buttons disabled while model config is open
- Azure configuration sections added to
project-models-section.tsxfor structured output and summarizer models - Provider placeholders (
openrouter/...,gateway/...,nim/...) now set immediately when selected (matching Azure behavior) - Azure configuration section moved above provider options in
model-configuration.tsx(visual reordering)
Notable: The new hasOpenModelConfig mechanism nicely addresses the prior review's Major 1 finding about azure/... placeholder persistence — by disabling Save while configuration is in progress, invalid placeholder values can no longer be persisted to the database.
🟠⚠️ Major (1) 🟠⚠️
- 🟠 Major:
model-selector.tsx:62-64Missing useEffect cleanup can leave global state stale (see inline comment)
🕐 Pending Recommendations (4)
Prior findings from automated review #3780627559 that remain unaddressed:
- 🟠
model-configuration.tsx:68-78Potential stale closure in useEffect transition detection - 🟡
model-section.tsx:19-20Props useanytype weakening type safety - 🟡
model-selector.tsx:50Invalid'use memo'directive (should be removed) - 💭
.changeset/odd-pots-sin.mdChangeset message undersells scope
💡 APPROVE WITH SUGGESTIONS
Summary: The delta introduces a solid UX improvement by preventing saves while model configuration is in progress. The one new finding is a missing useEffect cleanup that should be quick to fix. Prior review findings remain applicable and are worth addressing before merge. Nice progress on the inheritance display and Azure configuration flow! 🎉
Discarded (2)
| Location | Issue | Reason Discarded |
|---|---|---|
project-models-section.tsx:118+ |
Duplicated JSON parsing logic | Pre-existing pattern not introduced by this PR; larger refactor scope |
toolbar.tsx:100 |
Save button could remain disabled | Downstream consequence of the merged MAJOR finding — redundant |
Reviewers (2)
| Reviewer | Returned | Main Findings | Consider | While You're Here | Inline Comments | Pending Recs | Discarded |
|---|---|---|---|---|---|---|---|
pr-review-frontend |
3 | 0 | 0 | 0 | 1 | 0 | 2 |
pr-review-standards |
1 | 0 | 0 | 0 | 0 | 0 | 1 |
| Total | 4 | 0 | 0 | 0 | 1 | 0 | 3 |
Note: The MAJOR finding was merged from both reviewers (same issue: missing useEffect cleanup).
| useEffect(() => { | ||
| setHasOpenModelConfig(showCustomInput !== null); | ||
| }, [showCustomInput]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 MAJOR: Missing useEffect cleanup can leave global state stale
Issue: This useEffect sets hasOpenModelConfig in the global Zustand store but lacks a cleanup function. If the component unmounts while showCustomInput !== null (e.g., user navigates away while the Azure/OpenRouter configuration panel is open), hasOpenModelConfig remains true in the store.
Why: This would incorrectly keep the Save and "Try it" buttons disabled on subsequent page visits until a full page refresh, since nothing resets the flag when the component unmounts.
Fix: Add a cleanup function and include setHasOpenModelConfig in the dependency array:
| useEffect(() => { | |
| setHasOpenModelConfig(showCustomInput !== null); | |
| }, [showCustomInput]); | |
| useEffect(() => { | |
| setHasOpenModelConfig(showCustomInput !== null); | |
| return () => setHasOpenModelConfig(false); | |
| }, [showCustomInput, setHasOpenModelConfig]); |
Refs:
- React useEffect cleanup docs
- toolbar.tsx:100 — where
hasOpenModelConfigdisables the save button
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Review Summary
0 Key Findings | Risk: Low
Re-Review Delta Assessment
This re-review is scoped to the changes since the previous automated review (commit d1e7f881 → 08ca0795).
Delta summary: +4/-2 lines across 1 file (project-models-section.tsx)
The delta consists of:
- A merge from
main(bringing in unrelated changes: manage database docs, generic editors, traces fixes) - One PR-specific commit (
af6522b9 fixed types) with 2 line changes
PR-specific changes:
- providerOptions={providerOptionsField.value}
+ providerOptions={providerOptionsField.value ?? undefined}This change appears twice (lines 120 and 206) in project-models-section.tsx for the AzureConfigurationSection component. It's a straightforward type fix that coerces potential null values to undefined to satisfy the component's prop type expectations. This is a correct fix — no issues introduced.
🕐 Pending Recommendations (4)
Prior findings from automated review #3782038685 that remain unaddressed:
- 🟠
model-selector.tsx:62-64Missing useEffect cleanup can leave global state stale - 🟠
model-configuration.tsx:68-78Potential stale closure in useEffect transition detection - 🟡
model-section.tsx:19-20Props useanytype weakening type safety - 🟡
model-selector.tsx:50Invalid'use memo'directive (should be removed)
💡 APPROVE WITH SUGGESTIONS
Summary: The delta is a clean, minimal type fix with no new issues introduced. The prior review's findings — particularly the missing useEffect cleanup in model-selector.tsx:62-64 which could leave global state stale — remain unaddressed. I recommend addressing at least the Major items before merge, but the delta itself is good. 👍
Reviewers (0)
| Reviewer | Returned | Main Findings | Consider | While You're Here | Inline Comments | Pending Recs | Discarded |
|---|---|---|---|---|---|---|---|
| Orchestrator review (delta too small for subagent dispatch) | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Note: Delta was +2 lines (type fix only). Subagent dispatch was skipped as the change is trivial and introduces no new patterns requiring specialized review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Review Summary
0 Key Findings | Risk: Low
Re-Review Delta Assessment
This re-review is scoped to the changes since the previous automated review (commit 08ca0795 → 3a44a1a3).
Delta summary: +33/-41 lines across 6 files — all from merge commits from main
The delta consists solely of:
3a44a1a3 Merge branch 'main' into bugfix/azure-model-selector- Brought in PRs #1910, #1911, #1912 (MCP node connection warnings, SpiceDB script fixes)
No PR-specific code was changed since the last review. The Azure model selector, model configuration, and inheritance logic files remain unchanged.
🕐 Pending Recommendations (4)
Prior findings from previous automated reviews that remain unaddressed:
- 🟠
model-selector.tsx:62-64Missing useEffect cleanup can leave global state stale — still lacks cleanup function andsetHasOpenModelConfigin dependency array - 🟠
model-configuration.tsx:68-78Potential stale closure in useEffect transition detection - 🟡
model-section.tsx:19-20Props useanytype weakening type safety - 💭
.changeset/odd-pots-sin.mdChangeset message undersells scope
💡 APPROVE WITH SUGGESTIONS
Summary: The delta contains only merge commits from main with no PR-specific changes — no new issues to report. The prior review's findings remain applicable, particularly the missing useEffect cleanup in model-selector.tsx:62-64 which could leave hasOpenModelConfig stuck as true if the user navigates away while configuring a model. Recommend addressing at least the Major item before merge. The core Azure model selector fixes look good! 🎉
Reviewers (0)
| Reviewer | Returned | Main Findings | Consider | While You're Here | Inline Comments | Pending Recs | Discarded |
|---|---|---|---|---|---|---|---|
| Orchestrator review (delta contains no PR-specific changes) | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Note: Subagent dispatch was skipped as the delta contains only merge commits from main — no PR-specific code changes to review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Review Summary
0 Key Findings | Risk: Low
Re-Review Delta Assessment
This re-review is scoped to the changes since the previous automated review (commit 3a44a1a3 → 04861a74).
Delta summary: +0/-4 lines across 2 files — 1 PR-specific commit (04861a74 updated)
Changes Analyzed
1. Removal of key props from ModelConfiguration components (metadata-editor.tsx)
- key={`structured-${models?.structuredOutput?.model ?? 'unset'}`}
- key={`summarizer-${models?.summarizer?.model ?? 'unset'}`}Assessment: ✅ This is a valid optimization. The key props were causing React to unmount and remount the ModelConfiguration components whenever the model name changed. Removing them allows React to update the components in-place, preserving internal state (like provider options being edited) and avoiding unnecessary re-renders.
2. Removal of resourceName from Azure template placeholders (model-templates.ts)
export const azureModelProviderOptionsTemplate = `{
- "resourceName": "your-azure-resource",
"temperature": 0.7,
"maxOutputTokens": 2048
}`;Assessment: ✅ This is correct. The resourceName is now captured through the dedicated AzureConfigurationSection component (a separate input field above the JSON editor). Having resourceName in both the template placeholder and the dedicated UI field would be confusing and redundant.
🕐 Pending Recommendations (3)
Prior findings from previous automated reviews that remain unaddressed:
- 🟠
model-selector.tsx:62-64Missing useEffect cleanup can leave global state stale — The useEffect still lacks a cleanup function andsetHasOpenModelConfigin the dependency array. If the user navigates away while configuring a model,hasOpenModelConfigremainstrue, keeping Save/"Try it" buttons disabled. - 🟠
model-configuration.tsx:68-78Potential stale closure in useEffect transition detection - 🟡
model-section.tsx:19-20Props useanytype weakening type safety
💡 APPROVE WITH SUGGESTIONS
Summary: The delta is clean — both changes are valid improvements with no new issues introduced. The key prop removal prevents unnecessary re-mounts, and the resourceName removal from templates correctly defers to the dedicated Azure configuration UI.
However, the prior MAJOR finding about the missing useEffect cleanup in model-selector.tsx:62-64 remains unaddressed. This could leave hasOpenModelConfig stuck as true if the user navigates away mid-configuration, which would incorrectly keep the Save and "Try it" buttons disabled until a page refresh. Recommend addressing this before merge:
useEffect(() => {
setHasOpenModelConfig(showCustomInput !== null);
return () => setHasOpenModelConfig(false);
}, [showCustomInput, setHasOpenModelConfig]);The core Azure model selector and inheritance fixes look good! 🎉
Reviewers (0)
| Reviewer | Returned | Main Findings | Consider | While You're Here | Inline Comments | Pending Recs | Discarded |
|---|---|---|---|---|---|---|---|
| Orchestrator review (delta too small for subagent dispatch) | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Note: Delta was +0/-4 lines (key prop and template cleanup). Subagent dispatch was skipped as the changes are straightforward with no new patterns requiring specialized review.
Changes
azure/...placeholder immediately when selected