Skip to content

gh agent-task view: add --web flag - #11704

Merged
BagToad merged 7 commits into
github-cli-epic-990from
babakks/add-web-flag-to-view-cmd
Sep 10, 2025
Merged

gh agent-task view: add --web flag#11704
BagToad merged 7 commits into
github-cli-epic-990from
babakks/add-web-flag-to-view-cmd

Conversation

@babakks

@babakks babakks commented Sep 10, 2025

Copy link
Copy Markdown
Member

This PR adds --web to agent-task view.

Note that the /agent-sessions page of PRs, is only available (i.e. not returning HTTP 404) when there's at least one session attached to the PR. This means, even in --web mode we have to fetch the sessions associated with a PR to make sure navigating user to the /agent-sessions page does not show any error. I've added an A/C for this at the end.

A/C verification

Directly open named session ID

Given I have a session ID to view (a1234b-a1234b) attached to PR 1234
Given My CWD is repo foo/bar
When I run gh agent-task view a1234b-a1234b --web
Then my browser opens a new tab to https://github.com/foo/bar/pull/1234/agent-sessions/a1234b-a1234b

Confirmed:
gh-agent-task-view-web-session-id

Require no disambiguation with --web and PR number

Note

Since https://github.com/foo/bar/pull/1234/agent-sessions/ is a valid PR specific page requiring no session ID, we can simply open that page, expecting the user to disambiguate which session in the UI. Thus, we do not need to prompt for it. This flow deviates from the non --web flow.

Given I have a session ID to view (a1234b-a1234b) attached to PR 1234
Given My CWD is repo foo/bar
When I run gh agent-task view 1234 --web
Then my browser opens a new tab to https://github.com/foo/bar/pull/1234/agent-sessions/

Confirmed (PR with only one session attached):

gh-agent-task-view-web-pr-single-session

Confirmed (PR with more than one sessions attached):

gh-agent-task-view-web-pr-multi-session

No sessions associated with a PR

Given I have PR (1234) without any sessions attached to it
When I run gh agent-task view 1234 --web
Then I get the same error as running in non-web mode

Confirmed:
gh-agent-task-view-web-no-session

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 changed the base branch from trunk to github-cli-epic-990 September 10, 2025 10:07
Signed-off-by: Babak K. Shandiz <babakks@github.com>
@babakks
babakks marked this pull request as ready for review September 10, 2025 10:50
@babakks
babakks requested a review from a team as a code owner September 10, 2025 10:50
@babakks
babakks requested review from BagToad and removed request for a team September 10, 2025 10:50
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Comment thread pkg/cmd/agent-task/view/view.go
Comment thread pkg/cmd/agent-task/view/view.go
Comment thread pkg/cmd/agent-task/view/view.go
Comment thread pkg/cmd/agent-task/view/view_test.go

@BagToad BagToad 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

@BagToad
BagToad merged commit 20c8904 into github-cli-epic-990 Sep 10, 2025
7 of 8 checks passed
@BagToad
BagToad deleted the babakks/add-web-flag-to-view-cmd branch September 10, 2025 17:55
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.

2 participants