Skip to content

agentHost: fix incorrect model attribution in Codex subagent responses - #340470

Merged
Giuseppe Cianci (Giuspepe) merged 3 commits into
microsoft:mainfrom
AAAkater:fix/codex-subagent-model-display
Nov 9, 2026
Merged

Giuseppe Cianci (Giuspepe) merged 3 commits into
microsoft:mainfrom
AAAkater:fix/codex-subagent-model-display

Conversation

@AAAkater

@AAAkater AAAkater commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Codex subagent responses could display the parent model in the response
footer and token breakdown, even when the subagent used a different model.

For example, the parent session uses model A, while config.toml
specifies model B as the default model for subagents. The subagent
actually runs on model B, but opening its session shows model A in the
response footer and token breakdown. This is a display-only bug.

Pass the model reported by the completed spawnAgent item into the local
subagent session, preserving the parent's effective provider without
inheriting the parent model's configuration.

When the item does not report a model, preserve the existing fallback to
the parent model.

This changes local usage attribution only, not Codex model selection.

Testing

Added regression coverage for:

  • An explicit child model using the Copilot provider.
  • A missing child model falling back to the parent model.
  • An explicit child model using the OpenAI provider.
Copilot AI balanced review requested due to automatic review settings October 8, 2026 09:54

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 implementation matches the intended attribution behavior and includes focused regression coverage.

0 open findings

What changed in this PR

Fixes Codex subagent usage attribution so response metadata reflects the child model while retaining the parent’s provider.

Changes:

  • Builds child model selections from the reported subagent model.
  • Adds regression coverage for Copilot, OpenAI, and fallback attribution.
File Description
src/​vs/​platform/​agentHost/​node/​codex/​codexAgent.ts Assigns the correct model to local subagent sessions.
src/​vs/​platform/​agentHost/​test/​node/​codex/​codexCreateChat.test.ts Tests subagent usage-model attribution scenarios.

🧠 Review effort: Balanced


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

@AAAkater

AAAkater commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

…model-display

# Conflicts:
#	src/vs/platform/agentHost/node/codex/codexAgent.ts
…model-display

# Conflicts:
#	src/vs/platform/agentHost/test/node/codex/codexCreateChat.test.ts
@Giuspepe
Giuseppe Cianci (Giuspepe) merged commit cf2ba55 into microsoft:main Nov 9, 2026
55 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.147.0 milestone Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

6 participants