Skip to content

nes: add optimized PatchBased02 prompt strategy - #332018

Open
Julia Gong (juliagongms) wants to merge 7 commits into
microsoft:mainfrom
juliagongms:juliagong_microsoft/nes-patchbased02-optimized-strategy
Open

nes: add optimized PatchBased02 prompt strategy#332018
Julia Gong (juliagongms) wants to merge 7 commits into
microsoft:mainfrom
juliagongms:juliagong_microsoft/nes-patchbased02-optimized-strategy

Conversation

@juliagongms

@juliagongms Julia Gong (juliagongms) commented Aug 21, 2026

Copy link
Copy Markdown

Summary

Adds patchBased02Optimized, an implementation-neutral prompting strategy for the optimized inline-suggestion treatment. It inherits everything from patchBased02WithRecentLineNumbers (current/recent-file line numbers, cross-file edits/imports, disabled next-cursor prediction) and additionally bakes in the client, latency, and completions-unification knobs this unified model was tuned for, so a single promptingStrategy value carries the whole treatment rather than relying on many separate client settings or experiment/deployment toggles.

This makes the treatment self-contained enough to ship purely as the prompt template of a copilot-proxy /models deployment: the proxy only specifies promptStrategy: "patchBased02Optimized" and the client derives everything else.

Analogous to the change for 2-in-1 models made in this PR: #321755

Baked-in configuration

patchBased02Optimized spreads the shared patchBased02WithRecentLineNumbers config and adds:

Setting Baked value
patchModelPredictionKind currentLineCompleted
splitPatchOnDiff true
patchFastYieldLineWithCursor true
extraDebounceEndOfLine 0
nesMimicGhostTextBehavior true
cacheDelay 200
rebasedCacheDelay 0
debounce 0
supportsUnifiedCompletions true

How it works

  • These are exposed as optional ModelConfiguration fields (each with a MODEL_CONFIGURATION_VALIDATOR entry), following the same pattern used to bake in allowImportChanges and supportsNextCursorLinePrediction.
  • Every read site resolves via modelConfig.<field> ?? experimentDefault, so behavior is unchanged for any strategy that does not set a value.
  • selectedModelConfiguration() returns the strategy-resolved config, so consumers outside xtabProvider observe the baked values:
    • xtabProvider (patchModelPredictionKind, splitPatchOnDiff, patchFastYieldLineWithCursor, extraDebounceEndOfLine) via the already-resolved model config.
    • NextEditProvider (cacheDelay, rebasedCacheDelay) and UserInteractionMonitor (debounce) inject IInlineEditsModelService.
    • inline completion provider (nesMimicGhostTextBehavior) via its existing model service.
  • Adds a reusable NullInlineEditsModelService test double for the newly-injected dependency.

Completions unification

supportsUnifiedCompletions bakes completions unification into the strategy, following the exact supportsNextCursorLinePrediction precedent where a baked capability overrides the deployment toggle at each read site. When the selected NES model's strategy sets it, the client runs as the single unified provider — one baked boolean replaces all three unification settings:

  • inlineCompletionProvider.ts: unification resolves via selectedModelConfiguration().supportsUnifiedCompletions ?? InlineEditsUnification (replaces github.copilot.chat.advanced.inlineEdits.unification).
  • jointInlineCompletionProvider.ts: the baked flag is observed reactively (via onModelListUpdated) and OR-ed into the effective modelUnification, which both suppresses the separate GitHub Copilot completions provider and pushes github.copilot into the provider excludes (replaces inlineCompletionsUnificationModel (ExP) and excludedProviders: "completions,github.copilot" (local)).

The baked value never replaces the existing experiment path for other models — it only short-circuits it when set, so unrelated deployments are unaffected.

Intended deployment

{
  "modelConfiguration": {
    "modelName": "copilot-suggestions-lysithea-0024",
    "promptingStrategy": "patchBased02Optimized",
    "includeTagsInCurrentFile": false
  }
}

No inlineCompletionsUnificationModel / unification / excludedProviders toggles are required — the strategy carries them.

Testing

  • npm run typecheck --prefix extensions/copilot
  • focused Vitest coverage for applyStrategyConfig, MODEL_CONFIGURATION_VALIDATOR, pickSystemPrompt, NextEditProvider caching/speculative, and UserInteractionMonitor
  • npm run precommit

Copilot AI balanced review requested due to automatic review settings August 21, 2026 18:40

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.

Pull request overview

Adds an optimized PatchBased02 inline-edit prompting strategy while reusing existing behavior and configuration.

Changes:

  • Registers patchBased02Optimized with shared PatchBased02 configuration.
  • Routes prompt crafting, response parsing, and system prompts through PatchBased02 behavior.
  • Adds focused configuration and system-prompt tests.
Show a summary per file
File Description
xtabPromptOptions.spec.ts Tests optimized strategy overrides.
xtabPromptOptions.ts Defines and configures the strategy.
xtabProvider.spec.ts Tests system-prompt selection.
xtabProvider.ts Selects the PatchBased02 system prompt.
promptCrafting.ts Uses PatchBased02 prompt construction.

Review details

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

  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Balanced

Expose a PatchBased02Optimized strategy that shares the existing recent-line-number prompt configuration while giving the optimized inline suggestion treatment a stable, implementation-neutral identifier.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The patchBased02Optimized strategy now inherits everything from
patchBased02WithRecentLineNumbers and additionally bakes in the
client/latency configuration this unified model was tuned for:
patchModelPredictionKind=currentLineCompleted, splitPatchOnDiff,
patchFastYieldLineWithCursor, extraDebounceEndOfLine=0,
nesMimicGhostTextBehavior, cacheDelay=200, rebasedCacheDelay=0 and
debounce=0.

These are exposed as optional ModelConfiguration fields (with
validators) and resolved at each read site via
`modelConfig.<field> ?? experimentDefault`, mirroring the
allowImportChanges baking pattern. selectedModelConfiguration() now
returns the strategy-resolved config so consumers outside xtabProvider
(NextEditProvider, UserInteractionMonitor, inline completion provider)
observe the baked values.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 676b2f6f-4b80-4754-8dde-708d7e992148
@juliagongms
Julia Gong (juliagongms) force-pushed the juliagong_microsoft/nes-patchbased02-optimized-strategy branch from 84916f7 to df9edb0 Compare August 21, 2026 19:33
Adds a `supportsUnifiedCompletions` capability to ModelConfiguration,
following the `supportsNextCursorLinePrediction` precedent where a baked
strategy value overrides the experiment/deployment toggle at each read
site. When the selected NES model's strategy sets it, the client runs as
the single unified provider: the separate GitHub Copilot completions
provider is suppressed and 'github.copilot' is excluded.

patchBased02Optimized bakes it to true, so a copilot-proxy /models
deployment can drive unification purely from the prompt strategy without
relying on inlineCompletionsUnificationModel (ExP), the local
inlineEdits.unification setting, or excludedProviders.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 676b2f6f-4b80-4754-8dde-708d7e992148

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved. The fix is minimal and correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants