Skip to content

[dotnet-code] Consolidate todo remaining item filtering #514

Description

@github-actions

Summary

Consolidates the todo provider's incomplete-item filtering into a single unexported helper used by both GetRemainingItems and the todos_get_remaining tool. This keeps the Go internals closer to the .NET TodoProvider shape, where remaining todos are computed consistently with the same Where(t => !t.IsComplete).ToList() query pattern.

.NET Reference

  • dotnet/src/Microsoft.Agents.AI/Harness/Todo/TodoProvider.cs - GetRemainingTodosAsync and the todos_get_remaining tool both return incomplete todo items using the same filtering expression.
  • dotnet/tests/Microsoft.Agents.AI.UnitTests/Harness/Todo/TodoProviderTests.cs - sampled tests covering remaining todo behavior.

Public API and Behavior

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

Tests

  • go test ./agent/harness/todo

Notes

Rejected sampled candidates:

  • dotnet/src/Microsoft.Agents.AI.Workflows/Execution/IRunEventStream.cs versus workflow/internal/execution/eventstream.go: corresponding Go event stream logic is concurrency-sensitive, so helper extraction there was riskier for a nightly portability cleanup.
  • dotnet/src/Microsoft.Agents.AI.Workflows/Checkpointing/DirectEdgeInfo.cs versus workflow/internal/checkpoint/info.go and workflow/info.go: Go checkpoint and edge matching already have focused tests and no obvious tiny structural cleanup from this sample.
  • dotnet/src/Microsoft.Agents.AI/AnonymousDelegatingAIAgent.cs versus agent/agent.go: no small equivalent internal delegate-agent cleanup was found without touching broader agent construction behavior.

Open [dotnet-code] PR checks via the GitHub read tool returned HTTP 503 during this run, including candidate-specific todo searches, so this PR was kept narrowly scoped to reduce overlap risk.

Generated by .NET-to-Go Code Portability Refactoring Agent · 414.8 AIC · ⌖ 44.2 AIC · ⊞ 20.8K ·


Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch dotnet-code-todo-remaining-helper-5ebe744e4e4ab38c.

Click here to create the pull request

To fix the permissions issue, go to SettingsActionsGeneral and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch (65 lines)
From ec677806055d64b4a97dbd28399efcc5c0a1561b Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Thu, 16 Jul 2026 22:41:28 +0000
Subject: [PATCH] Consolidate todo remaining item filtering

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 agent/harness/todo/todo.go | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/agent/harness/todo/todo.go b/agent/harness/todo/todo.go
index f2db516ea..fee13e1a8 100644
--- a/agent/harness/todo/todo.go
+++ b/agent/harness/todo/todo.go
@@ -137,13 +137,7 @@ func (p *Provider) GetRemainingItems(opts ...agent.Option) []Item {
 	mu.Lock()
 	defer mu.Unlock()
 	st := p.loadState(opts)
-	var remaining []Item
-	for _, item := range st.Items {
-		if !item.IsComplete {
-			remaining = append(remaining, item)
-		}
-	}
-	return remaining
+	return remainingItems(st.Items)
 }
 
 func (p *Provider) loadState(opts []agent.Option) *state {
@@ -313,13 +307,7 @@ func (p *Provider) createTools(opts []agent.Option) []tool.FuncTool {
 			mu.Lock()
 			defer mu.Unlock()
 			st := p.loadState(opts)
-			var remaining []Item
-			for _, item := range st.Items {
-				if !item.IsComplete {
-					remaining = append(remaining, item)
-				}
-			}
-			return remaining, nil
+			return remainingItems(st.Items), nil
 		},
 	)
 
@@ -340,6 +328,16 @@ func (p *Provider) createTools(opts []agent.Option) []tool.FuncTool {
 	return []tool.FuncTool{addTool, completeTool, removeTool, getRemainingTool, getAllTool}
 }
 
+func remainingItems(items []Item) []Item {
+	var remaining []Item
+	for _, item := range items {
+		if !item.IsComplete {
+			remaining = append(remaining, item)
+		}
+	}
+	return remaining
+}
+
 func formatTodoListMessage(items []Item) string {
 	if len(items) == 0 {
 		return "### Current todo list\n- none yet"
-- 
2.54.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions