Skip to content

[dotnet-code] Cache agent mode display internals - #927

Merged
Quim Muntal (qmuntal) merged 1 commit into
mainfrom
dotnet-code-agentmode-display-1787697166-0d28664376ddac17
Aug 28, 2026
Merged

[dotnet-code] Cache agent mode display internals#927
Quim Muntal (qmuntal) merged 1 commit into
mainfrom
dotnet-code-agentmode-display-1787697166-0d28664376ddac17

Conversation

@michelle-clayton-work

Copy link
Copy Markdown
Contributor

Summary

Cache the agent-mode provider's supported-mode display string during construction instead of rebuilding it each time tools are created. This mirrors the .NET provider's stored mode-name display field and keeps future .NET-to-Go ports structurally easier to compare without changing public APIs or behavior.

.NET Reference

  • dotnet/src/Microsoft.Agents.AI/Harness/AgentMode/AgentModeProvider.cs - stores _modeNamesDisplay during provider construction and reuses it in tool descriptions and validation errors.

Public API and Behavior

No public Go API changed. No intentional behavior change was made.

Tests

  • go test ./agent/harness/agentmode

Notes

Rejected candidates:

  • dotnet/src/Microsoft.Agents.AI.Abstractions/AgentSessionStateBagValue.cs overlapped with the existing open PR [dotnet-code] Consolidate portable value delayed decode helper #900.
  • dotnet/src/Microsoft.Agents.AI.Workflows/HandoffToolCallFilteringBehavior.cs has no matching Go implementation; adding it would be a feature.
  • dotnet/src/Microsoft.Agents.AI.Workflows/Configured.cs did not expose a similarly small, behavior-preserving Go cleanup after comparison with workflow executor internals.

Generated by .NET-to-Go Code Portability Refactoring Agent · gpt55 · 78.8 AIC · ⌖ 15.8 AIC · ⊞ 23.2K ·

Closes #911

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 27, 2026 17:45
@github-actions github-actions Bot added area:agent Changes files in the agent area size:medium At most 100 changed lines across at most 5 files labels Aug 27, 2026

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.

Pull request overview

Caches the agent-mode provider’s supported-modes display string at construction time so tool descriptions and validation errors reuse a prebuilt value, aligning the Go provider’s internal structure more closely with the referenced .NET implementation without changing public APIs.

Changes:

  • Build and store modeNamesDisplay once in New(...) instead of rebuilding it inside createTools(...).
  • Add a modeNamesDisplay field to Provider and use it in tool descriptions and invalid-mode error formatting.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot added the parity-approved Go API consistency review found no parity issues label Aug 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Go API Consistency Review

Scope: internal-only
Changed Go contract: None — only unexported field modeNamesDisplay added to Provider struct in agent/harness/agentmode/agentmode.go
Upstream evidence reviewed: dotnet/src/Microsoft.Agents.AI/Harness/AgentMode/AgentModeProvider.cs_modeNamesDisplay private field cached during construction and reused in mode_set tool description and validation error message
Result: aligned


This PR caches the mode-names display string at construction time instead of recomputing it on every createTools call. The change is a pure internal refactor:

  • No exported Go APIs changed.
  • Observable behavior is identical — callers see the same tool description and error message strings.
  • The structural pattern directly mirrors the upstream .NET AgentModeProvider._modeNamesDisplay private field referenced in the PR description.

No parity issues found. The parity-approved label has been added.

Generated by Go API Consistency Review Agent for #927 · sonnet46 · 20.3 AIC · ⌖ 4.06 AIC · ⊞ 6.4K ·

@github-actions github-actions Bot added kind:code Changes production behavior or code pending-auto-risk Automatic risk classification is in progress risk:low Limited blast radius and straightforward rollback and removed pending-auto-risk Automatic risk classification is in progress labels Aug 27, 2026
@qmuntal
Quim Muntal (qmuntal) added this pull request to the merge queue Aug 28, 2026
Merged via the queue into main with commit 82aae64 Aug 28, 2026
37 checks passed
@qmuntal
Quim Muntal (qmuntal) deleted the dotnet-code-agentmode-display-1787697166-0d28664376ddac17 branch August 28, 2026 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Changes files in the agent area kind:code Changes production behavior or code parity-approved Go API consistency review found no parity issues risk:low Limited blast radius and straightforward rollback size:medium At most 100 changed lines across at most 5 files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[dotnet-code] Cache agent mode display internals

3 participants