microsoft / microsoft/vscode

Local harness should honor `reasoning-effort` from custom `.agent.md` files

Open
#334,592 1 comment 1 reaction 1 assignee Assigned to @aeschli View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

## Problem

Custom `.agent.md` files now support the `reasoning-effort` frontmatter property:

```yaml
---
name: Code-Review
model: GPT-5.6 Sol (copilot)
reasoning-effort: xhigh
---
```

However, the behavior currently differs depending on which harness executes the custom agent.

The Copilot Agent Host path forwards `reasoning-effort` to the Copilot SDK as `CustomAgentConfig.reasoningEffort`, as implemented in #329263.

The local VS Code chat harness does not appear to preserve or apply the same custom-agent reasoning-effort value.

In the local harness, `ICustomAgent` currently contains fields such as `model`, `tools`, and agent instructions, but not the configured reasoning effort. When `runSubagent` creates the child request, its `modelConfiguration` is resolved from the selected model configuration instead:

```ts
modelConfiguration: modeModelId
? this.languageModelsService.getModelConfiguration(modeModelId)
: undefined,
```

As a result, the reasoning effort selected in the model picker / parent session is used even when the invoked custom agent explicitly declares a different `reasoning-effort`.

## Example

Given:

```yaml
# Code-Review.agent.md
---
name: Code-Review
model: GPT-5.6 Sol (copilot)
reasoning-effort: xhigh
---
```

and a parent session using:

```text
GPT-5.6 Sol
Reasoning effort: high
```

invoking `Code-Review` through the local `runSubagent` path currently results in the subagent running with:

```text
reasoning effort: high
```

rather than the expected:

```text
reasoning effort: xhigh
```

The same `.agent.md` property is honored by the Copilot Agent Host path.

## Expected behavior

`reasoning-effort` should have consistent semantics across custom-agent execution paths.

For both direct custom-agent execution and local `runSubagent` invocation:

1. If the custom agent declares a supported `reasoning-effort`, use that value.
2. If the custom agent does not declare one, inherit the current model/session configuration as today.
3. If a future explicit per-invocation reasoning-effort override is added to `runSubagent`, that explicit value should take precedence over the custom-agent default.

A reasonable precedence order would be:

```text
explicit per-invocation override
>
custom .agent.md reasoning-effort
>
picker / parent model configuration
>
model default
```

## Suggested implementation

The local custom-agent representation could retain the parsed reasoning-effort value, for example:

```ts
export interface ICustomAgent {
// ...
readonly model?: readonly string[];
readonly reasoningEffort?: string;
// ...
}
```

Then, when constructing the child request, the local harness could merge the agent-specific effort into the resolved model configuration:

```ts
const modelConfiguration = modeModelId
? this.languageModelsService.getModelConfiguration(modeModelId)
: undefined;

// Conceptually:
if (subagent?.reasoningEffort) {
modelConfiguration.reasoningEffort = subagent.reasoningEffort;
}
```

The exact implementation can of course follow the existing model-configuration helpers and validation paths.

The same resolution should also be applied when a custom agent is selected directly from the agent picker, not only when it is invoked as a subagent.

## Why this matters

Currently, `reasoning-effort` is a supported `.agent.md` property, but whether it actually affects execution depends on the selected harness.

That makes shared custom agents difficult to reason about and can silently change latency, token usage, and behavior.

It is especially useful for multi-agent workflows where different roles intentionally use different reasoning budgets, for example:

```text
Explorer -> medium
Implementation -> high
Code Review -> xhigh
Planner -> xhigh
```

These defaults should remain part of the agent definition regardless of whether the custom agent runs through the local VS Code harness or the Copilot Agent Host.

## Relationship to other issues

This is separate from #327099, which requests a dynamic reasoning-effort parameter on individual `runSubagent` invocations.

This issue is only about honoring the existing declarative `reasoning-effort` property from the target custom `.agent.md` file in the local harness.

Related:

* #313546 — Support reasoning effort configuration in custom `.agent.md` files
* #329263 — Support reasoning effort in custom agent files
* #327099 — Allow specifying reasoning effort per subagent invocation

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.