Repository navigation
fix(sync): check the model in prompt files at plan time (AIC-3647) - #1062
Open
nkester-ld wants to merge 9 commits into
Open
nkester-ld wants to merge 9 commits into
nkester-ld wants to merge 9 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…use pins above the latest version - D7: a modelName equal to the model config's id or key is valid, and a name LaunchDarkly already holds for the variation is never refused. The check now runs after the server read in planVariationRows. - A pinned modelConfigVersion above the latest version is refused at plan time with a not_found message naming the variation, key and version. - S1 message now says "or remove modelName". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l config Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o tables Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ersion Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nkester-ld
marked this pull request as ready for review
November 25, 2026 20:13
nkester-ld
requested review from
tiffanylphan
and removed request for
a team
November 25, 2026 20:13
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort 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 bfdceef. Configure here.
Sync checks the type of modelName only when it reads a local file. A pinned variation that LaunchDarkly holds with the same model config key and version does not need its model config. The held-name exemption now also needs the same pinned version. A not-found error from the versions lookup is an invalid reference that names the variation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An unpinned file uses the latest model config version. A name that LaunchDarkly holds under an older pin is now checked against the latest version. A pin below 1 is refused at plan time. A versions lookup that returns 404 has its own message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Human
The bug
Sync never checked the
model:block of a prompt file. You could setmodelName: gpt-4oon theAnthropic.claude-haiku-4-5model config, and sync pushed it; LaunchDarkly stored the wrong name.modelName:with no value re-pushed on every run and never settled. And withmodelConfigVersionpinned, sync skipped looking up the model config at all, so a bad key passed the dry run and--yescreated the config before failing.Failure and reason for change
modelName:with no value planned"" → nullforever; a bad key with a pinned version made a partial write.modelName, and the UI itself sometimes stores the model config key there, so a server-side check would break existing data.What changes
modelName: gpt-4oon theAnthropic.claude-haiku-4-5model configgpt-4o, but the model config usesclaude-haiku-4-5. It suggests usingclaude-haiku-4-5or removingmodelName.modelName:(no value)model.modelName must be text, suggestionSet it to the model config's name, or remove modelName.modelConfigVersion: 1model config "…" has no version 5, suggestionIts latest version is 2. Pin that version, or remove modelConfigVersion.Pinned files (what
sync prompts addwrites) are checked against the pinned version's model name: the latest model config when the pin is the latest, otherwise the version list (listModelConfigVersions), fetched only when the name differs from LaunchDarkly's and cached per run.Golden path
A prompt file pulled with
ldcli sync prompts addnames its model like this, and every step below syncs or refuses before anything is written:ldcli sync prompts add --project P --config-key C --key K. The file matches LaunchDarkly;ldcli sync prompts --dry-runsaysNo changes.modelConfigKeyto another model config andmodelNameto that config's id (or removemodelName), then push.modelConfigKeybut keep the oldmodelName, or type a name that isn't the model config's. The plan stops with an error that names both models: the one in the file and the one the model config uses. Nothing is pushed. The full error reads:Edge cases
modelName= the model config's idmodelName= the model config's key (some UI paths store this)modelNamethat LaunchDarkly already holds for this variation under the same model config, even if it's neither (legacy data). A pinned file also needs the same pinned version; an unpinned file needs LaunchDarkly to pin the latest version or none, because the push stamps the latestmodel:blockmodelName: ""model.modelName is empty (code: invalid_source), suggestionSet it to the model config's name, or remove modelName.Accepted only when LaunchDarkly already holds""for this variation (gonfalon stores""for a missing name)modelName:with no value, or not textmodel.modelName must be text…modelConfigKeythat doesn't exist (pinned or not)model config "…" was not found in project "…"; no config is createdmodelConfigVersionabove the latest, or below 1model config "…" has no version N, suggestion names the latest. Versions run 1 to latest with no gaps, so nothing else needs the version listlistModelConfigVersions, fetched only when the name differs from LaunchDarkly's)Known limits: a wrong name an older ldcli already pushed is accepted until someone edits it, because it's indistinguishable from a name the UI wrote. A file whose
modelNameisn't text stops every run, scoped or not, like the existingmodel.parameters must be an objectcheck.Review focus
canonicalizeLocalVariationModelsnow runs after the server reads inplanVariationRows(state.go)..WithResource(id), like other plan-time refusals:invalid_referencefor a wrong name, a missing model config or an out-of-range pin;invalid_sourcefor an empty name. A missing model config wraps the API's 404 withWrapProblem, soIsNotFoundstill works; a failed versions lookup has its own message (LaunchDarkly did not return the versions of model config …) →model_config.go.local/variation.go), not inVariation.Validate, so data from LaunchDarkly never trips it during fingerprinting.Testing
go test ./...and golangci-lint pass. New acceptance tests cover each row above, plus in-sync files that keep a LaunchDarkly-written name.Ticket: AIC-3647
🤖 Generated with Claude Code
Note
Overview
Prompt sync now validates
model.modelNamebefore any write, fixing cases where a mismatched name was pushed, empty/nullmodelNamecaused endless sync loops, and badmodelConfigKey+ pinned version slipped through dry-run then partially created resources.Parse time (
local/variation.go): non-text or invalidmodel:shapes are rejected when the prompt file is read (model.modelName must be text, etc.). Fingerprints from LaunchDarkly are unaffected.Plan time (
canonicalizeLocalVariationModelsinmodel_config.go): after server state is loaded (state.goreorder), each variation checks thatmodelNamematches the model config key or the id of the pinned/latest version; empty names, missing keys, out-of-range pins, and version-list failures becomeinvalid_reference/invalid_sourceproblems tied to the variation. Unchanged names already held in LaunchDarkly under the same config/version are skipped so legacy UI values stay accepted.API: adds paginated
ModelConfigVersionson the catalog client for pinned older versions when a name check needs the version’s model id.Reviewed by Cursor Bugbot for commit 3bb5ab5. Bugbot is set up for automated code reviews on this repo. Configure here.
Related Jira issue: AIC-3647: [blitz] Check the prompt model against the model-list endpoint