Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(coderd): add tasks list and get endpoints#19468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mafredri merged 10 commits intomainfrommafredri/feat-coderd-add-tasks-list-and-get
Aug 22, 2025

Conversation

mafredri
Copy link
Member

@mafredrimafredri commentedAug 21, 2025
edited
Loading

Fixescoder/internal#899

Example API response:

{"tasks": [    {"id":"a7a27450-ca16-4553-a6c5-9d6f04808569","organization_id":"241e869f-1a61-42c9-ae1e-9d46df874058","owner_id":"9e9b9475-0fc0-47b2-9170-a5b7b9a075ee","name":"task-hardcore-herschel-bd08","template_id":"accab607-bbda-4794-89ac-da3926a8b71c","workspace_id":"a7a27450-ca16-4553-a6c5-9d6f04808569","initial_prompt":"What directory are you in?","status":"running","current_state": {"timestamp":"2025-08-22T10:03:27.837842Z","state":"working","message":"Listed root directory contents, working directory reset","uri":""      },"created_at":"2025-08-22T09:21:39.697094Z","updated_at":"2025-08-22T09:21:39.697094Z"    },    {"id":"50f92138-f463-4f2b-abad-1816264b065f","organization_id":"241e869f-1a61-42c9-ae1e-9d46df874058","owner_id":"9e9b9475-0fc0-47b2-9170-a5b7b9a075ee","name":"task-musing-dewdney-f058","template_id":"accab607-bbda-4794-89ac-da3926a8b71c","workspace_id":"50f92138-f463-4f2b-abad-1816264b065f","initial_prompt":"What is 1 + 1?","status":"running","current_state": {"timestamp":"2025-08-22T09:22:33.810707Z","state":"idle","message":"Completed arithmetic calculation","uri":""      },"created_at":"2025-08-22T09:18:28.027378Z","updated_at":"2025-08-22T09:18:28.027378Z"    }  ],"count":2}

NOTE: For now I've opted not to implement task "state" filter. Will require joining workspace apps to the workspaces query which is already complex enough. Regular workspace filters (status = running) will work, though.

@mafredrimafredriforce-pushed themafredri/feat-coderd-add-tasks-list-and-get branch fromf8660ff tobd14dddCompareAugust 21, 2025 13:02
@mafredrimafredriforce-pushed themafredri/feat-coderd-add-tasks-list-and-get branch fromff91ceb to66fbc02CompareAugust 22, 2025 10:06
@mafredrimafredri marked this pull request as ready for reviewAugust 22, 2025 10:12

// tasksFromWorkspaces converts a slice of API workspaces into tasks, fetching
// prompts and mapping status/state.
func (api*API)tasksFromWorkspaces(ctx context.Context,apiWorkspaces []codersdk.Workspace) ([]codersdk.Task,error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Are we fine with this not validating that the passed in workspaces are tasks? I understand that where it is currently called from we only pass tasks in, I'm just curious.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Probably no harm to filter out workspaces that are not "tasks", wdyt?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It would be an error if passed to this function. Handling exists in both list and get endpoints currently, before calling this, but I can add a guard here as well or try to consolidate some more of the code into this method.

johnstcn reacted with thumbs up emoji

// tasksFromWorkspaces converts a slice of API workspaces into tasks, fetching
// prompts and mapping status/state.
func (api*API)tasksFromWorkspaces(ctx context.Context,apiWorkspaces []codersdk.Workspace) ([]codersdk.Task,error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Probably no harm to filter out workspaces that are not "tasks", wdyt?

Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

:shipit:

@mafredrimafredri merged commit427b23f intomainAug 22, 2025
29 of 30 checks passed
@mafredrimafredri deleted the mafredri/feat-coderd-add-tasks-list-and-get branchAugust 22, 2025 14:11
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsAug 22, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@DanielleMaywoodDanielleMaywoodDanielleMaywood approved these changes

Assignees

@mafredrimafredri

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Tasks API: ImplementGET /tasks andGET /tasks/{id}
3 participants
@mafredri@johnstcn@DanielleMaywood

[8]ページ先頭

©2009-2025 Movatter.jp