agentHost: attribute edits to the committed Auto tier by bhavyaus · Pull Request #340437 · microsoft/vscode · GitHub
Skip to content

agentHost: attribute edits to the committed Auto tier - #340437

Merged
Bhavya U (bhavyaus) merged 4 commits into
mainfrom
bhavyaus/agent-host-edit-auto-tier
Oct 8, 2026
Merged

Bhavya U (bhavyaus) merged 4 commits into
mainfrom
bhavyaus/agent-host-edit-auto-tier

Conversation

@bhavyaus

@bhavyaus Bhavya U (bhavyaus) commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes https://github.com/microsoft/vscode-internalbacklog/issues/9981

Agent Host edits now record the committed Copilot Auto tier, matching #336757 for extension-host edits.

  • The root tier is read from session.model.getCurrent() and kept current from session.model_change. It's never inferred or defaulted.
  • Each edit uses the tier captured when its tool started. Subagents only get their own tier, which survives idle/resume.
  • Different tiers are separate attribution rows. The 30-source cap applies before tiers are split out, so tiers never push other sources out of the report.
  • Adds autoTier and a $autoTier:<tier> sourceKey segment to editTelemetry.editSources.details (Microsoft and GitHub), and autoTier to agentHost.trackEditSurvival.

Test: pick Auto with a non-default "Optimize for" tier, have the agent edit a file, then commit. agentHostTelemetry.log (--log trace) shows the tier on editSources.details and trackEditSurvival. Verified live in Code OSS; the agentHost and editTelemetry unit tests pass.

Propagate the committed Copilot Auto tier into Agent Host edit telemetry,
matching extension-host attribution from #336757.

- Seed the root tier from `session.model.getCurrent()` (session.start and
  session.resume fire before the session subscribes) and keep it current from
  `session.model_change`; Auto-to-Auto changes that omit the tier keep it.
- Track subagent tiers separately; subagents never inherit the parent tier.
- Snapshot the tier per edit and add it to the `$autoTier:` source-key segment
  and `autoTier` property of `editTelemetry.editSources.details` (Microsoft
  and GitHub), the persisted edit marker, and `agentHost.trackEditSurvival`.
- Keep mixed-tier marker chains from merging in the workbench.

Fixes microsoft/vscode-internalbacklog#9981

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bhavyaus Bhavya U (bhavyaus) self-assigned this Oct 8, 2026
Copilot AI balanced review requested due to automatic review settings October 8, 2026 05:19

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.

🟡 Changes recommended

Timing, subagent lifecycle, and source-cap handling can misattribute edits or omit their telemetry contributions.

4 open findings
What changed in this PR

Extends Agent Host edit attribution with the committed Copilot Auto tier, aligning it with extension-host telemetry.

Changes:

  • Tracks root and subagent Auto tiers from runtime state.
  • Carries tier metadata through edit markers, attribution groups, and telemetry.
  • Adds tests for tier propagation and mixed-tier separation.
File Description
src/​vs/​workbench/​contrib/​editTelemetry/​test/​browser/​agentHostEditMarkerService.test.ts Tests tier-aware marker correlation.
src/​vs/​workbench/​contrib/​editTelemetry/​browser/​telemetry/​agentHostEditMarkerService.ts Preserves tiers during marker resolution.
src/​vs/​platform/​agentHost/​test/​node/​copilotAgentSession.test.ts Tests root and subagent tier attribution.
src/​vs/​platform/​agentHost/​test/​node/​agentEditAttributionService.test.ts Tests tier-separated telemetry destinations.
src/​vs/​platform/​agentHost/​node/​shared/​fileEditTracker.ts Forwards per-edit tier metadata.
src/​vs/​platform/​agentHost/​node/​shared/​editSurvivalReporter.ts Adds tier metadata to survival telemetry.
src/​vs/​platform/​agentHost/​node/​shared/​agentEditAttributionService.ts Adds tier-aware attribution keys and telemetry.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentSession.ts Tracks runtime tiers and captures edit attribution.
src/​vs/​platform/​agentHost/​common/​fileEditAttribution.ts Extends attribution contracts with tier metadata.
src/​vs/​editor/​common/​textModelEditSource.ts Forwards tiers into editor edit sources.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts Outdated
Comment thread src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts Outdated
Comment thread src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts Outdated
- Capture the Auto tier when a tool starts, including a pending runtime read,
  so a later tier change or an in-flight read cannot relabel or drop it. A read
  superseded by a later model change resolves as unknown.
- Keep a retained subagent's tier across idle and resume.
- Rank and cap reported sources by pre-tier group before subdividing by tier.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

🟡 Changes recommended

Awaiting tier resolution before claiming completed edits can overwrite same-file snapshots and attribute diffs to the wrong tool.

1 open finding
4 resolved since last review

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts Outdated
Pass the captured tier snapshot into FileEditTracker, which claims the
completed edit before awaiting it. Awaiting first let a later same-file edit
overwrite the pending snapshot, and delayed output-only tool results.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

🟡 Changes recommended

Pending tier reads can still lose multi-file edit snapshots and reorder same-file attribution.

2 open findings
1 resolved since last review

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts Outdated
Comment thread src/vs/platform/agentHost/node/shared/fileEditTracker.ts
- Claim every file of a multi-file tool before awaiting any, so a later tool
  cannot take a pending patch's snapshot.
- Process each file's completed edits in claim order, so a later edit with a
  known tier cannot reach attribution before an earlier edit waiting on a
  pending tier read.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

🟢 Approval recommended

No unresolved defects were identified, and focused regression coverage addresses tier capture, edit ordering, and source limits.

0 open findings

2 resolved since last review

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@bhavyaus
Bhavya U (bhavyaus) enabled auto-merge (squash) October 8, 2026 06:34
@bhavyaus
Bhavya U (bhavyaus) merged commit 3a7c8e0 into main Oct 8, 2026
36 checks passed
@bhavyaus
Bhavya U (bhavyaus) deleted the bhavyaus/agent-host-edit-auto-tier branch October 8, 2026 06:50
@vs-code-engineering vs-code-engineering Bot added this to the 1.142.0 milestone Oct 8, 2026
Bhavya U (bhavyaus) added a commit that referenced this pull request Oct 12, 2026
* agentHost: attribute edits to the HydraFusion model

Records the runtime-attributed HydraFusion model (`hydrafusion` or
`hydrafusion-max`) on Agent Host edits, alongside the Auto tier added in
#340437:

- `editTelemetry.editSources.details` (Microsoft and GitHub) gains
  `fusionModel` and a `$fusionModel:<id>` sourceKey segment after
  `$autoTier`. The source cap applies before HydraFusion rows are split
  out, and `sourceKeyCleaned`/edit-arc drop the segment.
- `agentHost.trackEditSurvival` gains `fusionModel`.
- HydraFusion edits use the runtime's concrete source model as `modelId`.
- Workbench marker correlation keeps HydraFusion and HydraFusion Max apart.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: ignore unrecognized HydraFusion source models and cover fallbacks

Only use the runtime's `fusion.sourceModel` as the edit's modelId when the
synthetic model is a known HydraFusion model. Add tests for the phase-level
HydraFusion model fallback and for workbench HydraFusion rows after the
source cap.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants