feat: include latest build id in task responses (#20181)

Adding the latest build ID is necessary to locate the logs associated
with the tasks in the UI.
This commit is contained in:
Bruno Quaresma
2025-10-06 13:12:56 -03:00
committed by GitHub
parent 1783ee13ab
commit 23a44d10ac
6 changed files with 7 additions and 0 deletions
+1
View File
@@ -272,6 +272,7 @@ func taskFromWorkspace(ws codersdk.Workspace, initialPrompt string) codersdk.Tas
WorkspaceAgentID: taskAgentID,
WorkspaceAgentLifecycle: taskAgentLifecycle,
WorkspaceAgentHealth: taskAgentHealth,
LatestBuildID: uuid.NullUUID{Valid: true, UUID: ws.LatestBuild.ID},
CreatedAt: ws.CreatedAt,
UpdatedAt: ws.UpdatedAt,
InitialPrompt: initialPrompt,
+2
View File
@@ -270,6 +270,7 @@ func TestTasks(t *testing.T) {
assert.Equal(t, wantPrompt, got.InitialPrompt, "task prompt should match the AI Prompt parameter")
assert.Equal(t, workspace.Name, got.Name, "task name should map from workspace name")
assert.Equal(t, workspace.ID, got.WorkspaceID.UUID, "workspace id should match")
assert.Equal(t, workspace.LatestBuild.ID, got.LatestBuildID.UUID, "latest build id should match")
// Status should be populated via app status or workspace status mapping.
assert.NotEmpty(t, got.Status, "task status should not be empty")
})
@@ -320,6 +321,7 @@ func TestTasks(t *testing.T) {
assert.Equal(t, workspace.Name, task.Name, "task name should map from workspace name")
assert.Equal(t, wantPrompt, task.InitialPrompt, "task prompt should match the AI Prompt parameter")
assert.Equal(t, workspace.ID, task.WorkspaceID.UUID, "workspace id should match")
assert.Equal(t, workspace.LatestBuild.ID, task.LatestBuildID.UUID, "latest build id should match")
assert.NotEmpty(t, task.Status, "task status should not be empty")
// Stop the workspace