Skip to content

nes: let settings and experiments override baked strategy values - #333423

Merged
Ulugbek Abdullaev (ulugbekna) merged 4 commits into
mainfrom
ulugbekna/agents/revert-commit-fix-config-issues
Aug 30, 2026
Merged

Ulugbek Abdullaev (ulugbekna) merged 4 commits into
mainfrom
ulugbekna/agents/revert-commit-fix-config-issues

Conversation

@ulugbekna

@ulugbekna Ulugbek Abdullaev (ulugbekna) commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #332018 / #332316, addressing two problems with the patchBased02Optimized strategy.

Originally this was structured as a revert of e845953 plus a re-land. That is no longer possible: #332802 and its follow-ups have since merged on top of e845953, so reverting would take a colleague's merged work with it and leaves four commits that do not compile. The change is now expressed directly on top of current main, with the same end state.

1. Model configuration outranked settings and experiments

Every baked knob was read as modelConfig.x ?? getExperimentBasedConfig(x). Since getExperimentBasedConfig already resolves user setting → experiment treatment → default, putting the model configuration first placed it above both. Once a strategy baked a knob in, neither the user nor a flight could move it, and an A/B arm assigning one of these settings measured nothing.

Reads now go through resolveModelConfigValue:

user setting → experiment treatment → model configuration → setting default

This needed a new configuration primitive, getExperimentBasedConfigIfSet, which reports only an explicitly provided value instead of falling back to the default — that is what makes "is this setting actually driven?" answerable. Registration-time reads use the observable form, since an imperative read inside an autorun would not subscribe and would miss a treatment arriving after the graph was built.

2. Two definitions of "unified" that could disagree

supportsUnifiedCompletions was resolved in InlineEditProviderFeature (for the provider excludes) and again per request in InlineCompletionProviderImpl. Nothing kept them in agreement, and disagreement is user-visible: if registration excludes the separate provider while a request declines to stand in for it, there is no inline suggestion at all. Both paths, plus the joint provider, now resolve through one observeUnifiedCompletions, which keeps the existing OR with the core modelUnification toggle.

Also

  • defaultModelConfiguration() applies applyStrategyConfig, so the forceUseDefaultModel (404) fallback stops silently dropping every baked knob.
  • Renamed patchBased02Optimized → patchBased02Unified. "Optimized" did not say what the variant does; "unified" names its defining property and matches the existing xtabUnifiedModel. The wire value is renamed with the identifier — see the reviewer thread on this.
  • Fixed a pre-existing bug where updateExperimentBasedConfiguration only matched config.<fullyQualifiedId>, so a treatment arriving under copilotchat.config.<id> never invalidated the setting's observers. This affects every existing getExperimentBasedConfigObservable consumer, not just this change, so it is a separate commit.

Commits

Each compiles independently.

  1. configuration: refactor: — hoist the duplicated treatment lookup into the base class (no behavior change)
  2. configuration: fix: — invalidate observables for every treatment name a setting is published under
  3. configuration: feat: — add getExperimentBasedConfigIfSet
  4. nes: fix: — the precedence inversion, the single unified-completions definition, and the rename

Known limitations

  • Flights win over baked values. Experiments currently assigning these settings will override the strategy, so it only becomes self-contained for those users once those flights are retired. Values coincide today, so there is no behavior change.
  • Startup window (NES: cold-start flicker before supportsUnifiedCompletions resolves on fetched /models path #332837) unchanged. supportsUnifiedCompletions is the only baked value read at provider-registration time rather than per request, so on the fetched /models path there is a brief window before the model list resolves. Measured at ~600 ms against a real account.

Testing

  • npm run typecheck --prefix extensions/copilot, and each commit typechecks independently
  • 2494 vitest tests pass across platform/inlineEdits, platform/configuration, platform/proxyModels, extension/inlineEdits, extension/xtab
  • Ran a Code OSS build from these sources: the extension activates cleanly, and a local model configuration is accepted with patchBased02Unified and rejected with patchBased02Optimized (Expected undefined, but got string), confirming the rename end to end

Copilot AI balanced review requested due to automatic review settings August 30, 2026 19:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

Review tier: Balanced
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity extensions/​copilot/​src/​platform/​inlineEdits/​common/​dataTypes/​xtabPromptOptions.ts — Preserve compatibility with the already-shipped patchBased02Optimized wire value during this…
What changed in this PR

Reworks inline-edits configuration precedence so user and experiment values override model-baked defaults, while introducing unified PatchBased02 behavior.

Changes:

  • Centralizes user > experiment > model > default resolution.
  • Integrates unified-completions capability across provider registration and requests.
  • Adds configuration, model-selection, and strategy tests.
File Description
platform/​inlineEdits/​test/​node/​inlineEditsModelService.spec.ts Tests model capability selection.
platform/​inlineEdits/​test/​common/​xtabPromptOptions.spec.ts Updates unified-strategy tests.
platform/​inlineEdits/​test/​common/​modelConfigurationResolution.spec.ts Tests precedence and reactivity.
platform/​inlineEdits/​node/​inlineEditsModelService.ts Exposes selected-model capability.
platform/​inlineEdits/​common/​modelConfigurationResolution.ts Adds model-config resolution helpers.
platform/​inlineEdits/​common/​inlineEditsModelService.ts Extends the model-service contract.
platform/​inlineEdits/​common/​dataTypes/​xtabPromptOptions.ts Defines unified strategy configuration.
platform/​configuration/​vscode/​test/​configurationServiceImpl.spec.ts Tests explicit and experiment values.
platform/​configuration/​vscode/​configurationServiceImpl.ts Uses centralized configuration resolution.
platform/​configuration/​test/​common/​inMemoryConfigurationService.ts Supports explicit in-memory overrides.
platform/​configuration/​common/​defaultsOnlyConfigurationService.ts Reuses shared experiment handling.
platform/​configuration/​common/​configurationService.ts Adds “if set” accessors and caching.
lib/​node/​chatLibMain.ts Integrates validated chat-library overrides.
extension/​xtab/​test/​node/​xtabProvider.spec.ts Updates strategy and service mocks.
extension/​xtab/​node/​xtabProvider.ts Applies centralized precedence to runtime knobs.
extension/​xtab/​common/​promptCrafting.ts Handles the renamed unified strategy.
extension/​inlineEdits/​vscode-node/​unifiedCompletions.ts Centralizes unified-completions state.
extension/​inlineEdits/​vscode-node/​jointInlineCompletionProvider.ts Uses shared unification state.
extension/​inlineEdits/​vscode-node/​inlineEditProviderFeature.ts Reactively registers unified providers.
extension/​inlineEdits/​vscode-node/​inlineCompletionProvider.ts Aligns request behavior with registration.
extension/​inlineEdits/​test/​node/​nextEditProviderSpeculative.spec.ts Updates model-service fixture.
extension/​inlineEdits/​test/​node/​nextEditProviderCaching.spec.ts Updates model-service fixture.
extension/​inlineEdits/​node/​nextEditProvider.ts Resolves model-baked cache delays.
extension/​inlineEdits/​common/​userInteractionMonitor.ts Resolves model-baked debounce values.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

…o the base class

`ConfigurationServiceImpl` and `DefaultsOnlyConfigurationService` each carried a verbatim copy of the five-step treatment-variable lookup, so every change to the lookup order had to be made twice.

Move the shared resolution into `AbstractConfigurationService`: `getExperimentBasedConfig` becomes concrete there, built from a `_getExperimentTreatment` helper and a `_getUserConfiguredExperimentBasedValue` hook that defaults to "nothing configured" and is overridden by the implementation that can actually read user settings. No behavior change.

Co-authored-by: Copilot <[email protected]>
… name a setting is published under

`getExperimentBasedConfig` resolves a treatment under any of five names -- the setting's `experimentName`, `copilotchat.config.<id>`, `config.<fullyQualifiedId>`, and two more for a migrated setting's old id -- but `updateExperimentBasedConfiguration` only recognized `config.<fullyQualifiedId>` and the old id's equivalent.

A treatment arriving under one of the other names therefore assigned the setting without notifying anyone observing it, so every `getExperimentBasedConfigObservable` consumer kept serving the pre-treatment value until some unrelated configuration change happened to invalidate it.

Match the same alias list the resolution uses. The new set is a superset of the old one, so nothing that used to invalidate stops doing so.

Co-authored-by: Copilot <[email protected]>
…lues

`getExperimentBasedConfig` resolves user setting -> experiment treatment -> setting default, and there was no way to ask which of those three a value came from. Callers that have another source of defaults therefore had to place that source *above* the setting, defeating both the user's own configuration and the remote experiment lever.

Add `getExperimentBasedConfigIfSet` (plus an observable form) which reports only the explicitly provided value, so such a caller can fall back to its own default only when the setting is not driven by the user or by an experiment.

The observable cache is now keyed by accessor as well as setting id: it previously keyed on the setting id alone, so observing one setting through two accessors would have handed back the wrong observable. No key could reach both accessors before, since a simple and an experiment-based setting are distinct types, but a third accessor makes the collision reachable.

Co-authored-by: Copilot <[email protected]>
The `patchBased02Optimized` strategy (#332018 / #332316) bakes in the client and latency knobs its model was tuned for, so a `copilot-proxy` `/models` deployment can ship the whole treatment as one `promptStrategy` value.

Every read site resolved it as `modelConfig.x ?? getExperimentBasedConfig(x)`. Since `getExperimentBasedConfig` already resolves user setting -> experiment treatment -> default, putting the model configuration first placed it above *both*: once a strategy baked a knob in, neither the user nor a flight could move it, and an A/B arm assigning one of these settings measured nothing. Reads now go through `resolveModelConfigValue`, which consults the strategy only when the setting is not explicitly driven: user setting, then experiment treatment, then model configuration, then the setting default. Registration-time reads use the observable form, since an imperative read inside an `autorun` would not subscribe and would miss a treatment arriving after the graph was built.

`supportsUnifiedCompletions` was resolved in two places -- `InlineEditProviderFeature` for the provider `excludes` and `InlineCompletionProviderImpl` per request -- which were free to disagree. If registration excluded the separate provider while a request declined to stand in for it, the user would be left with no inline suggestion at all. Both, plus the joint provider, now resolve through one `observeUnifiedCompletions`, which keeps the existing OR with the core `modelUnification` toggle.

`defaultModelConfiguration()` now applies `applyStrategyConfig` as well, so the `forceUseDefaultModel` fallback stops silently dropping every baked knob.

The strategy is renamed from `patchBased02Optimized` to `patchBased02Unified`: "optimized" did not say what the variant does, while "unified" names its defining property and matches the existing `xtabUnifiedModel`. Nothing sends the old wire value -- no live experiment assigns it -- so the wire value is renamed with the identifier rather than letting the two spellings drift apart.

Note that flights currently assigning these settings win over the baked values, so the strategy only becomes self-contained for those users once those flights are retired. The startup window on the fetched `/models` path (#332837) is unchanged and remains a known limitation.

Co-authored-by: Copilot <[email protected]>
@ulugbekna
Ulugbek Abdullaev (ulugbekna) force-pushed the ulugbekna/agents/revert-commit-fix-config-issues branch from d8c0603 to e9df460 Compare August 30, 2026 19:36
@ulugbekna Ulugbek Abdullaev (ulugbekna) changed the title Revert commit e845953 and address config issues nes: let settings and experiments override baked strategy values Aug 30, 2026
@ulugbekna
Ulugbek Abdullaev (ulugbekna) marked this pull request as draft August 30, 2026 19:44
auto-merge was automatically disabled August 30, 2026 19:44

Pull request was converted to draft

@ulugbekna
Ulugbek Abdullaev (ulugbekna) marked this pull request as ready for review August 30, 2026 19:50
@ulugbekna
Ulugbek Abdullaev (ulugbekna) merged commit ee9c82e into main Aug 30, 2026
37 checks passed
@ulugbekna
Ulugbek Abdullaev (ulugbekna) deleted the ulugbekna/agents/revert-commit-fix-config-issues branch August 30, 2026 21:35
@vs-code-engineering vs-code-engineering Bot added this to the 1.136.0 milestone Aug 30, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Oct 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants