mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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:
Generated
+8
-4
@@ -7802,15 +7802,19 @@ Only certain features set these fields: - FeatureManagedAgentLimit|
|
||||
"time": "2019-08-24T14:15:22Z",
|
||||
"type": "input"
|
||||
}
|
||||
]
|
||||
],
|
||||
"snapshot": true,
|
||||
"snapshot_at": "string"
|
||||
}
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|--------|---------------------------------------------------------|----------|--------------|-------------|
|
||||
| `logs` | array of [codersdk.TaskLogEntry](#codersdktasklogentry) | false | | |
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|---------------|---------------------------------------------------------|----------|--------------|-------------|
|
||||
| `logs` | array of [codersdk.TaskLogEntry](#codersdktasklogentry) | false | | |
|
||||
| `snapshot` | boolean | false | | |
|
||||
| `snapshot_at` | string | false | | |
|
||||
|
||||
## codersdk.TaskSendRequest
|
||||
|
||||
|
||||
Generated
+3
-1
@@ -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"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user