Commit graph

218 commits

Author SHA1 Message Date
Andy Feller
e85877dd75 Remove extra flag default from help usage
Fixes #12153
2025-11-17 10:09:17 -05:00
William Martin
8a4154cfe7 Refactor cfg out of CAPI Client 2025-11-14 20:21:54 +01:00
Kynan Ware
44653c5aeb Add example for --custom-agent usage
Added a usage example to the help text demonstrating how to create a task with a custom agent using the --custom-agent flag.
2025-10-31 16:18:10 -06: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
0dcb1d1e43 Add shorthand flag for custom-agent option
Introduces the '-a' shorthand for the --custom-agent flag in the agent-task create command, improving CLI usability.
2025-10-31 15:59:23 -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
64de314640 Clarify custom agent flag description
Updated the help text for the --custom-agent flag to provide an example usage, making it clearer how to specify a custom agent for the task.
2025-10-31 15:10:03 -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
91c6bc609a Add new displaying message to test expectation
Updated the Test_createRun test to expect a message indicating that session logs are being displayed for the job
2025-10-07 23:37:43 -06:00
Kynan Ware
a78bb5e899 Fix --follow not killing the progress indicator
Fixes --follow not stopping the progress indicator. Also includes a nice message to indicate what is happening because even after we create the agent task, there's a period of time where we poll and receive nothing as the task session starts. We want there to be some sort of feedback in that period of time to not make the user panic and think it has hanged.
2025-10-07 23:19:45 -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
002ba54683
Merge pull request #11763 from cli/babakks/display-session-error
`gh agent-task view`: display session error if any
2025-09-22 11:57:29 +01:00
Babak K. Shandiz
eb3c842818
test(agent-task view): populate Session.Name in all test cases
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 17:39:06 +01:00
Babak K. Shandiz
ecfbb67e99
fix(agent-task view): improve session overview
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 17:37:25 +01:00
Babak K. Shandiz
3e43a98814
refactor(agent-task view): merge empty println calls with next
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 16:47:40 +01:00
Babak K. Shandiz
3091c21320
fix(agent-task view): re-fetch session to get all pieces of data
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 16:45:42 +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
123c9eaba8
fix(agent-task view): improve session error
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 16:14:31 +01:00
Babak K. Shandiz
beba8f6387
fix(agent-task view): display session error
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 16:12:11 +01: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
863329b4c1
fix(agent-task create): block empty problem statement arg
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 14:14:59 +01:00
Babak K. Shandiz
c7a811e567
fix(agent-task create): use pager when following logs
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 13:55:37 +01:00
Babak K. Shandiz
cb9808fa6e
fix(agent-task create): avoid prompting when problem statement is provided
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 13:51:13 +01:00
Babak K. Shandiz
4a0c32ef9f
fix(agent-task list): show capitalised session state
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 12:34:27 +01:00
Babak K. Shandiz
764376836c
fix(agent-task/shared): fix session state value
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 12:33:47 +01:00
Babak K. Shandiz
7d163eaf27
docs(agent-task list): add "(preview)" note to cmd docs
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 12:20:34 +01:00
Babak K. Shandiz
169f45daf9
chore(agent-task/shared): regenerate LogRenderer mock
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 12:00:55 +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
5f73d3b438
refactor(agent-task list): remove unused BaseRepo from ListOptions
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 12:00:54 +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
c02a8d8c94
Merge pull request #11760 from cli/kw/update-gh-agent-root-cmd-help
`gh agent-task`: update help text
2025-09-18 11:11:44 +01:00
Babak K. Shandiz
a7c8fa4b84
docs(agent-task): use heredoc.Doc
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 10:48:53 +01:00
Babak K. Shandiz
151b971933
Merge pull request #11755 from cli/babakks/polish-agent-task-view
`gh agent-task view`: polish and fix some issues
2025-09-18 10:38:15 +01:00
Babak K. Shandiz
f0a0c4b856
fix(agent-task view): display zero premium requests
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 10:18:40 +01:00
Babak K. Shandiz
6927d642f6
fix(agent-task/shared): make capitalised status names consistent
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 10:16:00 +01:00
Kynan Ware
7d2dfd3493
Update pkg/cmd/agent-task/agent_task.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-17 20:37:12 -06:00