Skip to content

Conversation

@BagToad
Copy link
Member

@BagToad BagToad commented Aug 29, 2025

This pull request introduces a new agent-task command group with a list subcommand 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.

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>
@BagToad BagToad marked this pull request as ready for review August 29, 2025 04:18
@BagToad BagToad requested a review from a team as a code owner August 29, 2025 04:18
@BagToad BagToad requested review from williammartin and removed request for a team August 29, 2025 04:18
@BagToad BagToad requested a review from babakks August 29, 2025 04:19
Copy link
Member

@babakks babakks left a comment

Choose a reason for hiding this comment

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

Haven't yet checked the tests, but, overally, it looks very good! 🙏

Just had a couple of comments.

Copy link
Member

@babakks babakks left a comment

Choose a reason for hiding this comment

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

A couple more notes.

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.
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.
@BagToad BagToad force-pushed the kw/1001-gh-agent-task-list-responds-with-table-of-the-users-agent-sessions branch from a426959 to 7b71b5f Compare August 29, 2025 20:09
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.
@BagToad BagToad merged commit c10ac8a into github-cli-epic-990 Aug 29, 2025
7 of 8 checks passed
@BagToad BagToad deleted the kw/1001-gh-agent-task-list-responds-with-table-of-the-users-agent-sessions branch August 29, 2025 21:41
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