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

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
This commit is contained in:
Mathias Fredriksson
2026-01-30 16:09:45 +02:00
committed by GitHub
parent 536bca7ea9
commit 21eabb1d73
8 changed files with 432 additions and 33 deletions
+3 -1
View File
@@ -351,7 +351,9 @@ curl -X GET http://coder-server:8080/api/v2/tasks/{user}/{task}/logs \
"time": "2019-08-24T14:15:22Z",
"type": "input"
}
]
],
"snapshot": true,
"snapshot_at": "string"
}
```