[dotnet-code] Cache agent mode display internals - #927
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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
modeNamesDisplayonce inNew(...)instead of rebuilding it insidecreateTools(...). - Add a
modeNamesDisplayfield toProviderand 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.
Go API Consistency ReviewScope: internal-only This PR caches the mode-names display string at construction time instead of recomputing it on every
No parity issues found. The
|
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_modeNamesDisplayduring 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/agentmodeNotes
Rejected candidates:
dotnet/src/Microsoft.Agents.AI.Abstractions/AgentSessionStateBagValue.csoverlapped with the existing open PR [dotnet-code] Consolidate portable value delayed decode helper #900.dotnet/src/Microsoft.Agents.AI.Workflows/HandoffToolCallFilteringBehavior.cshas no matching Go implementation; adding it would be a feature.dotnet/src/Microsoft.Agents.AI.Workflows/Configured.csdid not expose a similarly small, behavior-preserving Go cleanup after comparison with workflow executor internals.Closes #911