Introduce gh agent-task list#11606
Merged
BagToad merged 10 commits intogithub-cli-epic-990from Aug 29, 2025
Merged
Conversation
Introduces a new 'list' subcommand under agent-task for listing agent tasks. Implements a Copilot API client for fetching agent sessions and hydrating them with pull request data. Updates PullRequest and PRRepository types to support new fields. Adds dependencies for msgpack and tagparser. Co-Authored-By: Babak K. Shandiz <babakks@github.com>
babakks
reviewed
Aug 29, 2025
Member
babakks
left a comment
There was a problem hiding this comment.
Haven't yet checked the tests, but, overally, it looks very good! 🙏
Just had a couple of comments.
Renames the import of the shared package to 'prShared' and updates its usage in list.go to avoid naming conflicts and improve code clarity.
Simplifies logic for filtering sessions to only include those with valid pull request and repository data. This reduces nested conditionals and improves code readability.
babakks
approved these changes
Aug 29, 2025
Moves CAPI client initialization to a deferred function in ListOptions, simplifying command setup and improving testability. Updates tests to use the new client initialization pattern and adds more comprehensive test cases for session listing.
a426959 to
7b71b5f
Compare
Cleaned up the sessionPullRequest struct by deleting unused commented-out fields related to Author and MergedBy.
Renamed 'Sessions' to 'result' for clarity and consistency in the ListSessionsForViewer method when hydrating session pull requests.
Changed the API query from 'FetchPRs' to 'FetchPRsForAgentTaskSessions' in hydrateSessionPullRequests to match updated backend endpoint.
Simplified error handling by inlining the encoder.Encode call and removing redundant comments for improved code clarity.
Replaces linear search with a map for associating sessions with pull requests, improving performance and simplifying code in hydrateSessionPullRequests.
Moved the session state color selection logic from list.go to a new shared/display.go file as ColorFuncForSessionState. This improves code reuse and maintainability by centralizing the color mapping for session states.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new
agent-taskcommand group with alistsubcommand for interacting with GitHub Copilot agent tasks, including listing in-flight agent sessions and hydrating them with pull request data. It also adds supporting infrastructure for Copilot API communication, updates the API models, and includes comprehensive tests for the new functionality.