Skip to content

[dotnet-port-api] Add TodoProvider session helpers #575

Description

@github-actions

Summary

Add session-first TodoProvider read helpers in Go with GetAllTodos(*agent.Session) and GetRemainingTodos(*agent.Session), while keeping the existing option-based helpers as compatibility wrappers. This ports the narrow public API portion of the upstream .NET todo provider graduation work so the Go harness exposes direct session-based todo reads, and it updates focused tests plus the parity comparison doc.

Ported .NET PRs

Breaking Changes

No. Existing GetAllItems and GetRemainingItems helpers remain available; this change only adds the session-first exported helpers.

Tests and Examples

  • go test ./agent/harness/todo
  • go test -race ./agent/harness/todo
  • Added focused tests for session-based todo reads and nil-session behavior.
  • No examples updated; this upstream change was a narrow helper API addition.

Notes

  • Skipped the broader AgentMode portion of upstream PR #7052 because open tracking issue [dotnet-port-api] Align agentmode session helpers #568 already covers that area.
  • Left the remaining graduation work from #7052 and larger harness changes for separate PRs to keep this nightly port small and reviewable.

Generated by .NET to Go API Porting Agent · 599.5 AIC · ⌖ 58 AIC · ⊞ 21.7K ·


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-port-api-todo-session-helpers-c7ebc42e6a54636e.

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 preview (337 of 337 lines)
From 2a46b67630442a206135a2bde9a8b3db78612a68 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Tue, 21 Jul 2026 06:21:52 +0000
Subject: [PATCH] [dotnet-port-api] Add TodoProvider session helpers

Port the session-first TodoProvider read helpers from upstream .NET so Go exposes direct session-based access alongside the existing option-based helpers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 agent/harness/todo/todo.go               | 89 +++++++++++++-----------
 agent/harness/todo/todo_test.go          | 55 ++++++++++++++-
 docs/dotnet-go-sdk-feature-comparison.md |  2 +-
 3 files changed, 102 insertions(+), 44 deletions(-)

diff --git a/agent/harness/todo/todo.go b/agent/harness/todo/todo.go
index 73df2df00..d96bb70eb 100644
--- a/agent/harness/todo/todo.go
+++ b/agent/harness/todo/todo.go
@@ -124,29 +124,31 @@ func (p *Provider) Invoked(ctx context.Context, invoked agent.InvokedContext) er
 
 // GetAllItems returns all todo items from the session state.
 func (p *Provider) GetAllItems(opts ...agent.Option) []Item {
-	mu := p.getSessionLock(opts)
-	mu.Lock()
-	defer mu.Unlock()
-	st := p.loadState(opts)
-	result := make([]Item, len(st.Items))
-	copy(result, st.Items)
-	return result
+	return p.GetAllTodos(sessionFromOptions(opts))
 }
 
 // GetRemainingItems returns only the incomplete todo items from the session state.
 func (p *Provider) GetRemainingItems(opts ...agent.Option) []Item {
-	mu := p.getSessionLock(opts)
+	return p.GetRemainingTodos(sessionFromOptions(opts))
+}
+
+// GetAllTodos returns all todo items stored in session.
+func (p *Provider) GetAllTodos(session *agent.Session) []Item {
+	mu := p.getSessionLock(session)
 	mu.Lock()
 	defer mu.Unlock()
-	st := p.loadState(opts)
-	return remainingItems(st.Items)
+	return copyItems(p.loadState(session).Items)
 }
 
-func (p *Provider) loadState(opts []agent.Option) *state {
-	session, ok := agent.GetOption(opts, agent.With
... (truncated)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions