Skip to content

agentHost: attribute edits to the HydraFusion model - #341165

Merged
Bhavya U (bhavyaus) merged 2 commits into
mainfrom
bhavyaus/agent-host-edit-hydrafusion
Oct 12, 2026
Merged

Bhavya U (bhavyaus) merged 2 commits into
mainfrom
bhavyaus/agent-host-edit-hydrafusion

Conversation

@bhavyaus

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

Copy link
Copy Markdown
Collaborator

Follow-up to #340437, which added the committed Auto tier to Agent Host edit attribution. This change records which HydraFusion model routed an edit, so HydraFusion (hydrafusion) and HydraFusion Max (hydrafusion-max) edits can be told apart.

  • Which edits get tagged: an edit is tagged only when the runtime attributes its tool call to HydraFusion (tool.execution_start fusion.syntheticModel). Only the known HydraFusion models are accepted. Selecting HydraFusion in the picker doesn't tag anything by itself, so turns that fell back to another model aren't tagged. A tool call inside a running HydraFusion phase that has no attribution of its own uses the HydraFusion model the runtime reported for the turn.
  • modelId: for HydraFusion edits, modelId is now the concrete model the runtime attributed the call to (fusion.sourceModel), instead of the last model the session reported.
  • editTelemetry.editSources.details (Microsoft and GitHub): adds fusionModel and a $fusionModel:<id> segment in sourceKey, after $autoTier. sourceKeyCleaned and the edit-arc event leave it out. HydraFusion rows are split out only after the 30-source cap is applied, as with Auto tiers, so they can't push other sources out of the report.
  • agentHost.trackEditSurvival: adds fusionModel, omitted for non-HydraFusion edits.
  • Workbench reload correlation: keeps the HydraFusion model, and won't attribute a reload that mixes HydraFusion and HydraFusion Max edits to either.

Test:

  1. Enable "chat.copilot.hydraFusion.enabled": "v2" and run with --log trace.
  2. Have the agent edit a file with HydraFusion, then with HydraFusion Max (Default/Max tier picker), then with Auto on Intelligence in a new chat.
  3. Commit the changes.

agentHostTelemetry.log should show fusionModel: hydrafusion / hydrafusion-max, or autoTier: intelligence for the Auto edit, on both trackEditSurvival and editSources.details.

Known issue, not addressed here: when an existing chat switches from HydraFusion to Auto, the chosen Auto tier is dropped. The switch restarts the session, and the resume only passes an admin-overridden tier, not the user's selection. Neither the runtime's session.model_change nor session.resume carries a tier, so the tier is correctly left out of telemetry. Auto may also be routing on the default tier in that case.

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 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 12, 2026 20:45

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

Unknown synthetic models currently alter edit model attribution despite the stated known-HydraFusion-only constraint, and key fallback paths lack coverage.

3 open findings
What changed in this PR

Adds HydraFusion model-specific edit attribution across Agent Host tracking, reload correlation, and telemetry.

Changes:

  • Captures runtime-reported HydraFusion and concrete source models.
  • Propagates attribution through edit markers, survival telemetry, and source details.
  • Separates HydraFusion variants while preserving source-cap behavior.
File Description
src/​vs/​editor/​common/​textModelEditSource.ts Adds Fusion metadata to edit sources.
src/​vs/​platform/​agentHost/​common/​fileEditAttribution.ts Extends attribution records and validation.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentSession.ts Captures runtime Fusion attribution.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotFusionProgress.ts Exposes the current synthetic model.
src/​vs/​platform/​agentHost/​node/​shared/​agentEditAttributionService.ts Emits Fusion-specific attribution rows.
src/​vs/​platform/​agentHost/​node/​shared/​editSurvivalReporter.ts Adds Fusion model telemetry.
src/​vs/​platform/​agentHost/​node/​shared/​fileEditTracker.ts Propagates Fusion metadata.
src/​vs/​platform/​agentHost/​test/​node/​agentEditAttributionService.test.ts Tests separated telemetry rows.
src/​vs/​platform/​agentHost/​test/​node/​copilotAgentSession.test.ts Tests runtime attribution capture.
src/​vs/​platform/​agentHost/​test/​node/​shared/​editSurvivalReporter.test.ts Tests optional telemetry fields.
src/​vs/​platform/​telemetry/​common/​editTelemetry.ts Defines and classifies Fusion telemetry.
src/​vs/​workbench/​contrib/​editTelemetry/​browser/​telemetry/​agentHostEditMarkerService.ts Preserves Fusion identity across reloads.
src/​vs/​workbench/​contrib/​editTelemetry/​browser/​telemetry/​arcTelemetrySender.ts Removes Fusion metadata from arc keys.
src/​vs/​workbench/​contrib/​editTelemetry/​browser/​telemetry/​editSourceTrackingImpl.ts Groups and emits Fusion details.
src/​vs/​workbench/​contrib/​editTelemetry/​test/​browser/​agentHostEditMarkerService.test.ts Tests reload correlation behavior.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

…llbacks

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 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: f0efecdc Current: dc4b9e16

The screenshot report exceeds GitHub's comment size limit. View the full report in the workflow summary.

@connor4312 Connor Peet (connor4312) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the diff and relevant attribution, fusion lifecycle, telemetry grouping, and reload-correlation context. No concrete P1 or P2 security or correctness findings.

Written by Connor's agent running GPT-6.1 Sol

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

The attribution flow is consistently propagated and the previously identified edge cases now have focused regression coverage.

0 open findings

3 resolved since last review

🧠 Review effort: Balanced

@bhavyaus
Bhavya U (bhavyaus) enabled auto-merge (squash) October 12, 2026 21:06
@bhavyaus Bhavya U (bhavyaus) added the ~release-cherry-pick Trigger: cherry-pick this PR to the latest release branch label Oct 12, 2026
@bhavyaus Bhavya U (bhavyaus) added this to the 1.142.0 milestone Oct 12, 2026
@vs-code-engineering

Copy link
Copy Markdown
Contributor

This PR will be automatically cherry-picked to release/1.142 when merged.

@bhavyaus
Bhavya U (bhavyaus) merged commit 1576464 into main Oct 12, 2026
56 of 57 checks passed
@bhavyaus
Bhavya U (bhavyaus) deleted the bhavyaus/agent-host-edit-hydrafusion branch October 12, 2026 21:50
@vs-code-engineering vs-code-engineering Bot added release-cherry-pick Automated cherry-pick between release and main branches and removed ~release-cherry-pick Trigger: cherry-pick this PR to the latest release branch labels Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-cherry-pick Automated cherry-pick between release and main branches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants