Skip to content

feat(coderd): return log snapshot for paused tasks#21771

Merged
mafredri merged 5 commits intomainfrom
mafredri/feat-coderd-return-log-snapshot-for-paused-task
Jan 30, 2026
Merged

feat(coderd): return log snapshot for paused tasks#21771
mafredri merged 5 commits intomainfrom
mafredri/feat-coderd-return-log-snapshot-for-paused-task

Conversation

@mafredri
Copy link
Member

Previously the task logs endpoint only worked when the workspace was
running, leaving users unable to view task history after pausing.

This change adds snapshot retrieval with state-based branching: active
tasks fetch live logs from AgentAPI, paused/initializing/pending tasks
return stored snapshots (providing continuity during pause/resume), and
error/unknown states return HTTP 409 Conflict.

The response includes snapshot metadata (snapshot, snapshot_at) to
indicate whether logs are live or historical.

Closes coder/internal#1254

Previously the task logs endpoint only worked when the workspace was
running, leaving users unable to view task history after pausing.

This change adds snapshot retrieval with state-based branching: active
tasks fetch live logs from AgentAPI, paused/initializing/pending tasks
return stored snapshots (providing continuity during pause/resume), and
error/unknown states return HTTP 409 Conflict.

The response includes snapshot metadata (snapshot, snapshot_at) to
indicate whether logs are live or historical.

Closes coder/internal#1254
@mafredri mafredri force-pushed the mafredri/feat-coderd-return-log-snapshot-for-paused-task branch from 99bbb6f to a556c72 Compare January 29, 2026 18:44
@mafredri mafredri marked this pull request as ready for review January 30, 2026 08:53
@mafredri mafredri requested review from SasSwart and johnstcn January 30, 2026 08:54
ownerSubject := coderdtest.AuthzUserSubject(ownerUser)

// Helper to create a task in the desired state.
createTaskInState := func(ctx context.Context, t *testing.T, status database.TaskStatus) uuid.UUID {
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a really useful test helper. Might be worth a refactor later?

@mafredri mafredri force-pushed the mafredri/feat-coderd-return-log-snapshot-for-paused-task branch from 7cfd7a5 to 9f11a56 Compare January 30, 2026 13:49
@mafredri mafredri merged commit 21eabb1 into main Jan 30, 2026
29 of 31 checks passed
@mafredri mafredri deleted the mafredri/feat-coderd-return-log-snapshot-for-paused-task branch January 30, 2026 14:09
@github-actions github-actions bot locked and limited conversation to collaborators Jan 30, 2026
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: Return log snapshot from logs endpoint when paused

2 participants