gh agent list: Remove repo-scoped session listing - #11758
Conversation
There was a problem hiding this comment.
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
ListSessionsForViewerwithListLatestSessionsForViewerthat 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.
There was a problem hiding this comment.
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.
babakks
left a comment
There was a problem hiding this comment.
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.
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>
c41f3ba to
169f45d
Compare
|
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>
|
@BagToad I pushed a few more commits to fix other issues with the |
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.