Skip to content

gh agent list: Remove repo-scoped session listing - #11758

Merged
babakks merged 10 commits into
github-cli-epic-990from
kw/agent-list-polish
Sep 18, 2025
Merged

gh agent list: Remove repo-scoped session listing#11758
babakks merged 10 commits into
github-cli-epic-990from
kw/agent-list-polish

Conversation

@BagToad

@BagToad BagToad commented Sep 17, 2025

Copy link
Copy Markdown
Member

This removes support for listing agent sessions scoped to a specific repository, including the ListSessionsForRepo method and related tests.

The list command now always lists the latest sessions for the viewer, simplifying the user experience.

@BagToad
BagToad requested a review from a team as a code owner September 17, 2025 23:48
@BagToad
BagToad requested review from babakks and removed request for a team September 17, 2025 23:48
@BagToad
BagToad requested a review from Copilot September 18, 2025 02:35

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

This PR removes support for listing agent sessions scoped to specific repositories, simplifying the command to only show the latest sessions for the authenticated user. The changes eliminate the --repo flag functionality and the ListSessionsForRepo method, while introducing deduplication logic to show only the latest session per resource.

  • Remove repository-scoped session listing functionality and associated tests
  • Replace ListSessionsForViewer with ListLatestSessionsForViewer that deduplicates sessions by resource ID
  • Add session count display in TTY mode with "Showing X sessions" header

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/cmd/agent-task/list/list.go Remove repo override support and simplify to always use viewer-scoped listing with session count display
pkg/cmd/agent-task/list/list_test.go Remove all repo-scoped test cases and update mocks to use new method name
pkg/cmd/agent-task/capi/sessions.go Replace viewer method with latest sessions logic including deduplication and sorting
pkg/cmd/agent-task/capi/sessions_test.go Remove repo-scoped method tests and update remaining test to use new method
pkg/cmd/agent-task/capi/client.go Update interface to remove repo method and rename viewer method
pkg/cmd/agent-task/capi/client_mock.go Update mock to reflect new interface with renamed method

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread pkg/cmd/agent-task/capi/sessions.go Outdated
Comment thread pkg/cmd/agent-task/capi/sessions.go Outdated
@BagToad
BagToad requested a review from Copilot September 18, 2025 02:49

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread pkg/cmd/agent-task/capi/sessions.go

@babakks babakks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just found a few minor fixes which I'll just push a commit for them.

However, I think Copilot is right about unpopulated resource IDs.

Comment thread pkg/cmd/agent-task/capi/sessions_test.go Outdated
Comment thread pkg/cmd/agent-task/list/list.go
BagToad and others added 7 commits September 18, 2025 12:00
This commit removes support for listing agent sessions scoped to a specific repository, including the ListSessionsForRepo method and related tests. The list command now always lists the latest sessions for the viewer, simplifying the code and user experience. Test and mock code have been updated accordingly.
Refactor ListLatestSessionsForViewer to use a map for tracking seen resource IDs, ensuring only the newest session per resource is kept. Add a test case to verify correct deduplication across paginated API responses.
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
@babakks
babakks force-pushed the kw/agent-list-polish branch from c41f3ba to 169f45d Compare September 18, 2025 11:01
@babakks

babakks commented Sep 18, 2025

Copy link
Copy Markdown
Member

Resolved conflicts, rebased and force pushed.

Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
@babakks

babakks commented Sep 18, 2025

Copy link
Copy Markdown
Member

@BagToad I pushed a few more commits to fix other issues with the list command. Merging the changes since they seem trivial.

@babakks
babakks merged commit 2116327 into github-cli-epic-990 Sep 18, 2025
7 of 8 checks passed
@babakks
babakks deleted the kw/agent-list-polish branch September 18, 2025 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants