fix: better handling of params and custom params for optimization#163
Open
andrewklatzke wants to merge 1 commit intoaklatzke/AIC-2263/sdk-dx-improvementsfrom
Open
Conversation
jsonbailey
approved these changes
May 5, 2026
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.
Requirements
Describe the solution you've provided
Implements better handling for params on the initial variation (folds model changes in as overwrites rather than completely replacing) and ensures custom params are persisted unchanged. Additionally makes sure that tools cannot be changed by the optimization process.
Describe alternatives you've considered
This is the result of a bug report so there weren't really alternatives considered.
Additional context
Initially it was assumed that the optimization process would properly pull params forward (via the LLM) but this doesn't seem to always be the case. In the case of custom params, they aren't fed into the LLM calls since they're user-specified data (not specific to the actual optimization result). We now just pull these through as-is. In the case of tools, the model will be able to optimize the prompt to call a specific tool if multiple are provided, but we don't want to strip any tool information from the final result as it may be necessary for the calls to function.
Note
Medium Risk
Moderate risk because it changes how model parameters and
toolsare carried forward across optimization iterations and what gets auto-committed, which can affect runtime agent behavior if merging/restoration logic is wrong.Overview
Improves variation-application logic so LLM-generated
current_parametersare merged into existing parameters instead of replacing them, preserving user-specified/custom settings (e.g.max_tokens,response_format) when the LLM omits them.Prevents tool drift by always restoring the original
toolslist (and logging when the LLM returns a different one) to avoid silently dropping user tools or leaking internal framework tools.Captures
model.customfrom the initial LaunchDarkly variation and includes it when auto-committing a winning variation; adds focused test coverage for parameter persistence, tool restoration/warnings, andmodel.custompropagation.Reviewed by Cursor Bugbot for commit 572a2aa. Bugbot is set up for automated code reviews on this repo. Configure here.