Merge branch 'kw/1003-gh-agent-task-list-respects--l--limit' into kw/1004-gh-agent-task-list-respects--w--web

This commit is contained in:
Kynan Ware 2025-08-29 19:14:52 -06:00 committed by GitHub
commit 61c8b5ef09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 6 deletions

View file

@ -104,11 +104,13 @@ func listRun(opts *ListOptions) error {
defer opts.IO.StopProgressIndicator()
var sessions []*capi.Session
ctx := context.Background()
var repo ghrepo.Interface
if opts.BaseRepo != nil {
repo, err := opts.BaseRepo()
if err != nil {
return err
}
repo, _ = opts.BaseRepo()
}
if repo != nil && repo.RepoOwner() != "" && repo.RepoName() != "" {
sessions, err = capiClient.ListSessionsForRepo(ctx, repo.RepoOwner(), repo.RepoName(), opts.Limit)
if err != nil {
return err

View file

@ -159,10 +159,12 @@ func Test_listRun(t *testing.T) {
wantOut: "no agent tasks found\n",
},
{
name: "repo resolution error surfaces",
name: "repo resolution error does not surface",
tty: true,
baseRepoErr: errors.New("ambiguous repo"),
wantErr: errors.New("ambiguous repo"),
wantErr: nil,
stubs: func(reg *httpmock.Registry) { registerEmptySessionsMock(reg) },
wantOut: "no agent tasks found\n",
},
{
name: "repo scoped many sessions (tty)",