Skip to content

Add configurable xtab reasoning effort and completion token limits - #342204

Merged
Ulugbek Abdullaev (ulugbekna) merged 4 commits into
microsoft:mainfrom
bluerose73:shengjiema/xtab-reasoning-completion-tokens
Oct 21, 2026
Merged

Ulugbek Abdullaev (ulugbekna) merged 4 commits into
microsoft:mainfrom
bluerose73:shengjiema/xtab-reasoning-completion-tokens

Conversation

@bluerose73

@bluerose73 Shengjie Ma (bluerose73) commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add optional reasoningEffort and maxCompletionTokens fields to the xtab model configuration, including the existing local setting and ExP-driven modelConfigurationString / defaultModelConfigurationString paths.

Example model configuration:

    "github.copilot.chat.inlineEdits.xtabProvider.modelConfiguration": {
        "modelName": "xxxxxx",
        "promptingStrategy": "patchBased02Unified",
        "includeTagsInCurrentFile": false,
        "maxCompletionTokens": 512,
        "reasoningEffort":"high"
    }

maxCompletionTokens sets max_completion_tokens. It is the token limit setting for OpenAI reasoning models. If set, max_completion_tokens will replace max_tokens.

  • Respects useMaxTokens. If useMaxTokens == false, max_completion_tokens is unset.
  • Yields to usePrediction. If usePrediction == true, max_completion_tokens is unset

reasoningEffort simply adds the reasoning effort to the LLM request.

Detailed changes:

  • Validate reasoning effort against the OpenAI enum and completion-token limits as finite positive integers.
  • Send reasoning_effort only when configured.
  • When prediction is disabled and useMaxTokens is enabled, send configured max_completion_tokens instead of max_tokens.
  • When prediction is enabled, ignore both token-limit controls and retain the existing prediction request behavior.
  • Preserve existing requests when the new fields are absent, including model-fallback retries.
  • Document the fields in the existing setting description.

Validation

Commands were run from extensions/copilot:

  • npm run test:unit -- xtabPromptOptions.spec.ts inlineEditsModelService.spec.ts xtabProvider.spec.ts chatMLFetcherRetry.spec.ts — passed, 325 tests, before the final prediction-gating adjustment.
  • npm run test:unit -- xtabProvider.spec.ts -t 'sends model request arguments|only adds configured model request arguments|applies useMaxTokens|retries with default model after NotFound' — passed, 13 focused tests, after the final adjustment.
  • .\node_modules\.bin\tsc.cmd --noEmit --project tsconfig.json --pretty false — passed after the final adjustment.
  • npm run compile — passed after committing the final implementation.
  • git diff --cached --check — passed before committing.

Manual testing against a local copilot-proxy was completed by the author.

How to Test

  1. Run the development extension against a local github-proxy that accepts the two request arguments.
  2. Add reasoningEffort (for example, low) and maxCompletionTokens (for example, 8192) to github.copilot.chat.inlineEdits.xtabProvider.modelConfiguration, retaining the model's other configuration fields.
  3. With usePrediction=false and useMaxTokens=true, trigger a next-edit suggestion and verify the serialized body contains reasoning_effort and max_completion_tokens, but no max_tokens.
  4. With useMaxTokens=false, verify neither token limit is sent.
  5. With usePrediction=true, verify both token-limit controls are ignored and neither token limit is sent.
  6. Remove the new fields and verify existing request behavior remains unchanged.

No linked issue.

Support model configuration and ExP request arguments while preserving prediction token-limit behavior.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 22:53
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Ulugbek Abdullaev (@ulugbekna)

Matched files:

  • extensions/copilot/src/extension/xtab/node/xtabProvider.ts
  • extensions/copilot/src/extension/xtab/test/node/xtabProvider.spec.ts
  • extensions/copilot/src/platform/inlineEdits/common/dataTypes/xtabPromptOptions.ts
  • extensions/copilot/src/platform/inlineEdits/test/common/xtabPromptOptions.spec.ts
  • extensions/copilot/src/platform/inlineEdits/test/node/inlineEditsModelService.spec.ts

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.

🔵 Needs a closer look

Production proxy support is unavailable, and the final prediction-gating behavior lacks end-to-end validation.

No open issues 🎉

What changed in this PR

Adds optional reasoning-effort and completion-token controls to the existing xtab model configuration for next-edit suggestions.

Changes:

  • Validates the new fields across local and experiment-driven configurations.
  • Applies request arguments while preserving prediction behavior and existing defaults.
  • Adds regression coverage and localized setting documentation.
File Description
extensions/​copilot/​src/​platform/​networking/​common/​fetch.ts Adds optional request parameter types.
extensions/​copilot/​src/​platform/​inlineEdits/​test/​node/​inlineEditsModelService.spec.ts Tests configuration sources.
extensions/​copilot/​src/​platform/​inlineEdits/​test/​common/​xtabPromptOptions.spec.ts Tests field validation and defaults.
extensions/​copilot/​src/​platform/​inlineEdits/​common/​dataTypes/​xtabPromptOptions.ts Defines and validates configuration fields.
extensions/​copilot/​src/​extension/​xtab/​test/​node/​xtabProvider.spec.ts Tests request gating and fallback behavior.
extensions/​copilot/​src/​extension/​xtab/​node/​xtabProvider.ts Applies configured request arguments.
extensions/​copilot/​src/​extension/​prompt/​node/​test/​chatMLFetcherRetry.spec.ts Tests serialized request parameters.
extensions/​copilot/​package.nls.json Documents configuration behavior.
extensions/​copilot/​package.json References the localized setting description.

Review effort: Balanced

@ulugbekna
Ulugbek Abdullaev (ulugbekna) merged commit 4279148 into microsoft:main Oct 21, 2026
59 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.144.0 milestone Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants