Skip to content

feat(coderd): add experimental tasks logs endpoint - #19958

Merged
mafredri merged 5 commits into
mainfrom
mafredri/feat-coderd-tasks-logs
Sep 25, 2025
Merged

mafredri merged 5 commits into
mainfrom
mafredri/feat-coderd-tasks-logs

Conversation

@mafredri

@mafredri mafredri commented Sep 25, 2025 •

Copy link
Copy Markdown
Member

Both follow and tail have been omitted for now.

Fixes coder/internal#901

@mafredri
mafredri force-pushed the mafredri/feat-coderd-tasks-logs branch 2 times, most recently from 472270a to ff2b3a2 Compare September 25, 2025 11:38
@mafredri
mafredri marked this pull request as ready for review September 25, 2025 11:40
@mafredri
mafredri force-pushed the mafredri/feat-coderd-tasks-logs branch 2 times, most recently from 9e17127 to b7830b0 Compare September 25, 2025 11:56
@mafredri mafredri changed the title feat(coderd): add tasks logs endpoint feat(coderd): add experimental tasks logs endpoint Sep 25, 2025
Base automatically changed from mafredri/feat-coderd-tasks-send to main September 25, 2025 12:12
@mafredri
mafredri force-pushed the mafredri/feat-coderd-tasks-logs branch from 562d075 to daec105 Compare September 25, 2025 12:13

@DanielleMaywood DanielleMaywood left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

just a small nit on the httperror.WriteResponseError

Comment thread coderd/aitasks.go Resolved
Co-authored-by: Danielle Maywood <[email protected]>

@johnstcn johnstcn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, some comments below but I wouldn't consider them blocking in an experimental endpoint.

Comment thread coderd/aitasks.go
body, _ := io.ReadAll(io.LimitReader(resp.Body, 128))
return httperror.NewResponseError(http.StatusBadGateway, codersdk.Response{
Message: "Task app rejected the request.",
Detail: fmt.Sprintf("Upstream status: %d; Body: %s", resp.StatusCode, body),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍 this should give a good indication to the user

Comment thread coderd/aitasks.go
Comment on lines +750 to +753
case "user":
typ = codersdk.TaskLogTypeInput
case "agent":
typ = codersdk.TaskLogTypeOutput

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason to have these be different? Could we instead use codersdk.TaskLogTypeUser / codersdk.TaskLogTypeAgent?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm somewhat indifferent and open to changing this, this is just the last option we discussed/settled on with @DanielleMaywood (correct me if I misremember). It seemed like a good idea to try to tie the concept of send input into the logs (input/output) to make the origin clear.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's go with this for now. We can adjust if need be.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah that was pretty much the reason, I'm also indifferent on what we pick here as well.

@mafredri
mafredri enabled auto-merge (squash) September 25, 2025 13:09
@mafredri
mafredri force-pushed the mafredri/feat-coderd-tasks-logs branch from 91730fe to e2db31a Compare September 25, 2025 14:51
@mafredri
mafredri merged commit 0bac5a4 into main Sep 25, 2025
@mafredri
mafredri deleted the mafredri/feat-coderd-tasks-logs branch September 25, 2025 15:12
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tasks API: Implement GET /tasks/{id}/logs

3 participants