feat: Add agent tasks API support#4225
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4225 +/- ##
=======================================
Coverage 97.46% 97.46%
=======================================
Files 192 193 +1
Lines 19258 19355 +97
=======================================
+ Hits 18770 18865 +95
- Misses 270 271 +1
- Partials 218 219 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @danyalahmed1995!
Just a couple tweaks/questions, then we should be ready for a second LGTM+Approval from any other contributor to this repo before merging.
cc: @stevehipwell - @alexandear - @zyfy29 - @Not-Dhananjay-Mishra - @munlicode
Co-authored-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
|
@gmlewis Thanks, sounds good. I’ll address the review comments and push an update shortly. |
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @danyalahmed1995!
LGTM.
cc: @stevehipwell - @alexandear - @zyfy29 - @Not-Dhananjay-Mishra - @munlicode
stevehipwell
left a comment
There was a problem hiding this comment.
Thanks for the PR @danyalahmed1995, I've added a couple of comments.
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
|
@stevehipwell @alexandear updated, thanks for the reviews. Changes in the latest update:
Validation:
|
|
@alexandear @stevehipwell Thanks for pointing me to the right direction. Root cause was generator-side: the Agent Tasks documentation URLs did not include an explicit I added a narrow metadata mapping for Validation:
|
| IsArchived bool `url:"is_archived,omitempty"` | ||
|
|
||
| // Since filters tasks updated at or after this time. | ||
| Since *time.Time `url:"since,omitempty"` |
There was a problem hiding this comment.
All fields should be non-pointer types with url tags:
| Since *time.Time `url:"since,omitempty"` | |
| Since time.Time `url:"since,omitempty"` |
There was a problem hiding this comment.
@danyalahmed1995 - this comment has not yet been addressed.
There was a problem hiding this comment.
@gmlewis This was tested both ways.
The linter failed because Since has url:"since,omitempty" and is an optional query parameter. I restored it to *time.Time, which keeps the absent-vs-zero-value behavior and passes the fork CI/linter.
So this is intentionally kept as:
Since *time.Time url:"since,omitempty"
| HTMLURL *string `json:"html_url,omitempty"` | ||
| Name *string `json:"name,omitempty"` | ||
| Creator *User `json:"creator,omitempty"` | ||
| CreatorType *string `json:"creator_type,omitempty"` |
There was a problem hiding this comment.
missing user_collaborators field:
"user_collaborators": {
"type": "array",
"items": {
"type": "object",
"description": "A GitHub user",
"properties": {
"id": {
"type": "integer",
"format": "int64",
"description": "The unique identifier of the user"
}
}
},
"description": "User objects of collaborators on this task",
"deprecated": true
},
There was a problem hiding this comment.
@danyalahmed1995 - user_collaborators is still missing from this struct. Stopping review here.
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
| AgentTaskListOptions | ||
|
|
||
| // CreatorIDs filters tasks by creator user IDs. | ||
| CreatorIDs []int64 `url:"creator_id,omitempty"` |
There was a problem hiding this comment.
| CreatorIDs []int64 `url:"creator_id,omitempty"` | |
| CreatorID []int64 `url:"creator_id,omitempty"` |
There was a problem hiding this comment.
I'm curious why our linter didn't catch this one.
There was a problem hiding this comment.
Sincere apology for the inconvenience , I went through the reviews and this time properly double checked all the missing pieces and linter errors on my fork . Kindly when you guys have time confirm if everything is good . I will keep this and the other review thread open , until you guys verify it.
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
|
Guys is anything left 🤔 |
Please read all our comments and apply fixes. Also, do not forget to fix lint issues and tests. Run the following commands: |
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
| HTMLURL *string `json:"html_url,omitempty"` | ||
| Name *string `json:"name,omitempty"` | ||
| Creator *User `json:"creator,omitempty"` | ||
| CreatorType *string `json:"creator_type,omitempty"` |
There was a problem hiding this comment.
@danyalahmed1995 - user_collaborators is still missing from this struct. Stopping review here.
| IsArchived bool `url:"is_archived,omitempty"` | ||
|
|
||
| // Since filters tasks updated at or after this time. | ||
| Since *time.Time `url:"since,omitempty"` |
There was a problem hiding this comment.
@danyalahmed1995 - this comment has not yet been addressed.


Summary
Adds typed client support for GitHub's Agent Tasks REST API.
This implements the documented public-preview Agent Tasks endpoints:
GET /agents/repos/{owner}/{repo}/tasksPOST /agents/repos/{owner}/{repo}/tasksGET /agents/repos/{owner}/{repo}/tasks/{task_id}GET /agents/tasksGET /agents/tasks/{task_id}Closes #4213.
Changes
AgentTasksServiceand registered it onClient.Notes
The Agent Tasks API is currently in public preview, so this PR keeps the implementation scoped to the fields and endpoints currently documented by GitHub.
Validation
Ran the repository validation flow from
CONTRIBUTING.md:script/fmt.shscript/test.sh ./...script/lint.shscript/generate.shgit diff --checkscript/test.shwith the default race configuration could not run on this Windows machine becausecgo/gccwas not available. I reran the full test script with the non-race fallback across all modules, and it passed.