chore: various fixes, improvements for optimization package#135
Open
andrewklatzke wants to merge 4 commits intoaklatzke/AIC-1793/output-name-optionfrom
Open
chore: various fixes, improvements for optimization package#135andrewklatzke wants to merge 4 commits intoaklatzke/AIC-1793/output-name-optionfrom
andrewklatzke wants to merge 4 commits intoaklatzke/AIC-1793/output-name-optionfrom
Conversation
jsonbailey
approved these changes
Apr 15, 2026
…ype, remove required context_choices argument and default to anon
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, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 55674ae. Configure here.
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
Provides some fixes and improvements to the optimization method after some QA-ing on my end.
globalmodels as those will be by far the most used; custom keys will still work for custom models)Describe alternatives you've considered
These are fixes for inconsistencies/bugs in the package. No alternatives considered.
Note
Medium Risk
Touches core optimization run lifecycle and LaunchDarkly API persistence semantics (new PATCH flow, iteration/validation folding), so regressions could affect UI progress reporting and stored run data; changes are well-covered by expanded tests.
Overview
Fixes result persistence for
optimize_from_configruns by creating one result record per logical iteration (POST) and incrementally updating it (PATCH) with status, telemetry (latency/tokens), scores (including judge thresholds), and variation metadata, while also auto-closing prior iterations so ground-truth sample records aren’t left stale.Corrects validation-phase behavior by folding validation sub-iterations back into the parent iteration’s persisted record and ensuring terminal events (
success/failure/turn completed) use the main iteration context (avoids mismatcheduserInputvscompletionResponse).Improves auto-commit payloads by retaining the original tool keys from the fetched agent variation and by resolving
modelConfigKeyvia a new_find_model_confighelper that prefersglobalmodel configs; also prefetches model configs once and patches the final result withcreatedVariationKeyafter commit.Adds
LLMCallConfig/LLMCallContextProtocols (exported in__init__) so one handler can be used for both agent and judge calls, renames judge contextvariablestocurrent_variables, and makescontext_choicesoptional (defaults to an anonymous context).Reviewed by Cursor Bugbot for commit 8f3468f. Bugbot is set up for automated code reviews on this repo. Configure here.