Ville Skyttä
d8b8655f21
Grammar fixes
2026-05-01 10:22:13 +03:00
Kynan Ware
78b958f9ae
fix(agent-task): resolve Copilot API URL dynamically ( #12956 )
...
* fix(agent-task): resolve Copilot API URL dynamically
Query viewer.copilotEndpoints.api to get the correct Copilot API URL
for the user's host instead of hardcoding api.githubcopilot.com. This
fixes 401 errors for ghe.com tenancy users whose Copilot API lives at
a different endpoint.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-18 18:14:02 +00:00
Max Beizer
d908af3484
Emit null for zero createdAt/updatedAt values
...
Consistent with completedAt handling. Addresses Copilot review feedback
from companion PR #12807 .
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-01 10:18:37 -06:00
Max Beizer
c5c107aa8b
Polish --json support for agent-task list
...
- Fix empty results returning error instead of [] when --json is used
- Rename 'status' field to 'state' for consistency with struct and UI
- Add missing JSON fields: completedAt, user, pullRequestTitle, pullRequestState
- Add test for empty results with --json
- Add test for nil PullRequest with --json
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-01 09:08:18 -06:00
Max Beizer
0d9e6af3da
Add --json support to gh agent-task list
...
Add --json, --jq, and --template flags to `gh agent-task list`,
consistent with the pattern used by `gh pr list --json`,
`gh issue list --json`, etc.
This implements the ExportData interface on capi.Session and defines
SessionFields for the available JSON fields:
id, name, status, repository, createdAt, updatedAt,
pullRequestNumber, pullRequestUrl.
Closes https://github.com/cli/cli/issues/12805 (partial)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-28 09:20:13 -06:00
Babak K. Shandiz
4681b40e70
fix(agent-task/capi): fix capi API version
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2026-02-20 18:04:12 +00:00
William Martin
8a4154cfe7
Refactor cfg out of CAPI Client
2025-11-14 20:21:54 +01:00
Kynan Ware
5d17666a69
Update error messages in job creation tests
2025-10-31 16:16:03 -06:00
Kynan Ware
591050a8d2
Update pkg/cmd/agent-task/capi/job.go
...
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-31 16:06:37 -06:00
Kynan Ware
24885040cb
Fix: do not swallow job creation error
...
Reads the response body before decoding to allow multiple decoding attempts. Enhances error reporting by including HTTP status and error messages from both Job and JobError structures when job creation fails.
2025-10-31 15:54:01 -06:00
Kynan Ware
17085d3c5e
Add custom agent support to job creation
...
Introduces a 'customAgent' parameter to the CreateJob API, CLI options, and related mocks and tests.
2025-10-31 14:57:48 -06:00
Kynan Ware
8c75079bf2
Add math package import to sessions.go
...
Imported the math package in sessions.go
2025-09-23 09:33:26 -06:00
Kynan Ware
e673dfe61c
Add TODO for better integer handling in GetPullRequestDatabaseID
2025-09-23 09:28:08 -06:00
Babak K. Shandiz
6fc5742a68
fix(agent-task/capi): return proper error message when resp is not a JSON
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-22 12:59:51 +01:00
Babak K. Shandiz
597cdaf081
fix(agent-task/capi): remove fallback to viewer when user id is zero
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 15:37:46 +01:00
Babak K. Shandiz
eba31343a8
test(agent-tassk/capi): update ListSessionsByResourceID tests
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 14:31:03 +01:00
Babak K. Shandiz
2fe60d9105
docs(agent-task/capi): add TODO note for dropping local ID generation
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 14:30:29 +01:00
Babak K. Shandiz
a108b4ee95
fix(agent-task/capi): fetch viewer when resource session user id is zero
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 14:29:44 +01:00
Babak K. Shandiz
9148f41cc6
fix(agent-task/capi): handle unpopulated resource session LastUpdatedAt
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 14:28:46 +01:00
Babak K. Shandiz
546ab1cf4b
refactor(agent-task/capi): keep resource private
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 14:27:08 +01:00
Ariel Deitcher
185e36c60f
update agents resource route
2025-09-18 17:20:16 -07:00
Babak K. Shandiz
e5739cc545
fix(agent-task/capi): add WorkflowRunID field to Session
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 16:11:17 +01:00
Babak K. Shandiz
b6816ad89a
refactor(agent-task/capi): remove unused slice
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 15:05:28 +01:00
Babak K. Shandiz
3ed9034ff8
fix(agent-task/capi): add Error field to Session
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 15:04:06 +01:00
Babak K. Shandiz
6235c33ff0
test(agent-task/capi): assert session with zero resource ID are kept
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 12:00:55 +01:00
Babak K. Shandiz
c68d1a31c0
fix(agent-task/capi): keep sessions with no resource attached
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 12:00:55 +01:00
Babak K. Shandiz
6ec4324d6d
docs(agent-task/capi): fix test case explanation
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 12:00:54 +01:00
Kynan Ware
08bc1a8d29
Fix session deduplication and add test for paging
...
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.
2025-09-18 12:00:54 +01:00
Kynan Ware
680ebade59
Remove repo-scoped session listing and related code
...
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.
2025-09-18 12:00:50 +01:00
Babak K. Shandiz
fe95cd86f1
fix(agent-task/capi): add PremiumRequests field to Session
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-17 13:28:49 +01:00
Kynan Ware
ab796c80ef
Fix comment for GetSessionLogs method
2025-09-15 13:07:00 -06:00
Babak K. Shandiz
fbcdeed41f
feat(agent-task/capi): add GetSessionLogs method
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-15 10:13:55 -06:00
Babak K. Shandiz
ab7e4039da
refactor: move Copilot Agents home URL to capi
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-10 11:05:28 +01:00
Babak K. Shandiz
6b29c2905c
fix(agent-task/capi): also return PR URL from GetPullRequestDatabaseID
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-10 11:05:28 +01:00
Babak K. Shandiz
8b1f722911
docs(agent-task/capi): remove redundant comment
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-09 12:09:34 +01:00
Babak K. Shandiz
0a9a4a4250
test(agent-task/capi): fix test case args
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-09 11:37:49 +01:00
Babak K. Shandiz
d52502b638
fix(agent-task/capi): skip unpopulated resource ID when hydrating
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-09 11:37:28 +01:00
Babak K. Shandiz
f8f7b0e09b
fix(agent-task/capi): add GetPullRequestDatabaseID to CapiClient interface
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-08 13:50:09 +01:00
Babak K. Shandiz
abd2d8a06d
test(agent-task/capi): add tests for GetPullRequestDatabaseID
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-08 13:49:27 +01:00
Babak K. Shandiz
f57114accc
feat(agent-task/capi): add GetPullRequestDatabaseID method
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-08 13:48:56 +01:00
Babak K. Shandiz
d80b25fbf2
test(agent-task/capi): add tests for GetSessionByResourceID
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-08 11:27:40 +01:00
Babak K. Shandiz
9b2ecf4c0e
feat(agent-task/capi): add ListSessionsByResourceID method to CapiClient interface
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-05 16:55:46 +01:00
Babak K. Shandiz
a6dd9c1679
feat(agent-task/capi): add ListSessionsByResourceID
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-05 16:55:04 +01:00
Babak K. Shandiz
87b772dc83
feat(agent-task/capi): add GetSession method to CapiClient interface
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-05 12:44:21 +01:00
Babak K. Shandiz
ee8fc06077
test(agent-task/capi): add tests for GetSession
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-05 12:44:21 +01:00
Babak K. Shandiz
dcadeb75d4
feat(agent-task/capi): add GetSession method
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-05 12:44:21 +01:00
Babak K. Shandiz
4e1fcf1da9
refactor(agent-task/capi): populate PRs IsDraft
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-05 12:44:20 +01:00
Babak K. Shandiz
1e36e9f1e3
refactor(agent-task/capi): hydrate user data
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-05 12:44:11 +01:00
Babak K. Shandiz
19e17c54fd
refactor(agent-task/capi): drop embedding of unexported struct
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:12:56 +01:00
Babak K. Shandiz
585b639273
test(agent-task/capi): add CapiClientMock
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:12:56 +01:00