Repository navigation
fix(web): keep the chosen Antigravity thinking level while its descriptor is missing #38441
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ type ComposerProviderStateInput = { | |
| models: ReadonlyArray<ServerProviderModel>; | ||
| promptInjectionState?: ComposerPromptInjectionState; | ||
| modelOptions: ReadonlyArray<ProviderOptionSelection> | null | undefined; | ||
| modelOwnedOptions?: ReadonlyArray<ProviderOptionSelection> | undefined; | ||
| includePlanAgent?: boolean | undefined; | ||
| }; | ||
|
|
||
|
|
@@ -113,6 +114,25 @@ export function getComposerProviderState(input: ComposerProviderStateInput): Com | |
| (descriptor): descriptor is Extract<(typeof descriptors)[number], { type: "select" }> => | ||
| descriptor.type === "select", | ||
| ); | ||
| let modelOptionsForDispatch = buildExplicitProviderOptionSelectionsFromDescriptors( | ||
| descriptors, | ||
| selections, | ||
| ); | ||
| if (provider === "antigravity" && !descriptors.some(({ id }) => id === "thought_level")) { | ||
| // Sticky selections can carry options from another model. | ||
| const chosenLevel = selections?.find(({ id }) => id === "thought_level")?.value; | ||
| if ( | ||
| typeof chosenLevel === "string" && | ||
| input.modelOwnedOptions?.some( | ||
| ({ id, value }) => id === "thought_level" && value === chosenLevel, | ||
| ) | ||
|
Comment on lines
+126
to
+128
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the draft's model ownership, not the latest remembered value. If draft A selects High for Carbon and draft B later selects Medium for the same instance and model, B changes the shared memory but not A's selection. If the descriptor is absent when A sends, the multi-model resolver passes A's High beside the remembered Medium. This comparison rejects A's High and sends no level. Track whether the option belongs to the draft's selected model when the draft is written. Use that ownership at dispatch. This preserves A's High without allowing a model-only switch to send a level inherited from a different model.
|
||
| ) { | ||
| modelOptionsForDispatch = [ | ||
| ...(modelOptionsForDispatch ?? []), | ||
| { id: "thought_level", value: chosenLevel }, | ||
| ]; | ||
| } | ||
| } | ||
| const primaryValue = getProviderOptionCurrentValue(primarySelectDescriptor ?? null); | ||
| const promptEffort = typeof primaryValue === "string" ? primaryValue : null; | ||
| const ultrathinkActive = | ||
|
|
@@ -122,10 +142,7 @@ export function getComposerProviderState(input: ComposerProviderStateInput): Com | |
| return { | ||
| provider, | ||
| promptEffort, | ||
| modelOptionsForDispatch: buildExplicitProviderOptionSelectionsFromDescriptors( | ||
| descriptors, | ||
| selections, | ||
| ), | ||
| modelOptionsForDispatch, | ||
| ...(ultrathinkActive | ||
| ? { | ||
| composerFrameClassName: "ultrathink-frame", | ||
|
|
||
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.
Use the catalog's current thinking level when dispatch has none.
If Carbon advertises High and the draft has no explicit level,
buildExplicitProviderOptionSelectionsFromDescriptorsreturnsundefined. The descriptor check then skips the fallback.promptEffortreports High, but dispatch omitsthought_level. This misses the catalog fallback stated in the PR.Check whether
modelOptionsForDispatchalready containsthought_level. If not, use the catalog descriptor's current string value when present. Preserve explicit High over advertised Medium, and omit the option when neither source provides a level. Update the existing Antigravity test that currently expects a reported High to stay out of dispatch.