feat: add exit code and status to workspace agent scripts (#24505)

For scripts that have not finished or in dry run cases these will be
omitted.
This commit is contained in:
Asher
2026-04-29 12:24:26 -08:00
committed by GitHub
parent 1c30d52b2b
commit be57af5ff0
25 changed files with 286 additions and 80 deletions
+3 -3
View File
@@ -40,7 +40,7 @@ type ManifestAPI struct {
func (a *ManifestAPI) GetManifest(ctx context.Context, _ *agentproto.GetManifestRequest) (*agentproto.Manifest, error) {
var (
dbApps []database.WorkspaceApp
scripts []database.WorkspaceAgentScript
scripts []database.GetWorkspaceAgentScriptsByAgentIDsRow
metadata []database.WorkspaceAgentMetadatum
workspace database.Workspace
devcontainers []database.WorkspaceAgentDevcontainer
@@ -184,7 +184,7 @@ func dbAgentMetadatumToProtoDescription(metadatum database.WorkspaceAgentMetadat
}
}
func dbAgentScriptsToProto(scripts []database.WorkspaceAgentScript) []*agentproto.WorkspaceAgentScript {
func dbAgentScriptsToProto(scripts []database.GetWorkspaceAgentScriptsByAgentIDsRow) []*agentproto.WorkspaceAgentScript {
ret := make([]*agentproto.WorkspaceAgentScript, len(scripts))
for i, script := range scripts {
ret[i] = dbAgentScriptToProto(script)
@@ -192,7 +192,7 @@ func dbAgentScriptsToProto(scripts []database.WorkspaceAgentScript) []*agentprot
return ret
}
func dbAgentScriptToProto(script database.WorkspaceAgentScript) *agentproto.WorkspaceAgentScript {
func dbAgentScriptToProto(script database.GetWorkspaceAgentScriptsByAgentIDsRow) *agentproto.WorkspaceAgentScript {
return &agentproto.WorkspaceAgentScript{
Id: script.ID[:],
LogSourceId: script.LogSourceID[:],
+3 -3
View File
@@ -114,7 +114,7 @@ func TestGetManifest(t *testing.T) {
Hidden: true,
},
}
scripts = []database.WorkspaceAgentScript{
scripts = []database.GetWorkspaceAgentScriptsByAgentIDsRow{
{
ID: uuid.New(),
WorkspaceAgentID: agent.ID,
@@ -396,7 +396,7 @@ func TestGetManifest(t *testing.T) {
}
mDB.EXPECT().GetWorkspaceAppsByAgentID(gomock.Any(), childAgent.ID).Return([]database.WorkspaceApp{}, nil)
mDB.EXPECT().GetWorkspaceAgentScriptsByAgentIDs(gomock.Any(), []uuid.UUID{childAgent.ID}).Return([]database.WorkspaceAgentScript{}, nil)
mDB.EXPECT().GetWorkspaceAgentScriptsByAgentIDs(gomock.Any(), []uuid.UUID{childAgent.ID}).Return([]database.GetWorkspaceAgentScriptsByAgentIDsRow{}, nil)
mDB.EXPECT().GetWorkspaceAgentMetadata(gomock.Any(), database.GetWorkspaceAgentMetadataParams{
WorkspaceAgentID: childAgent.ID,
Keys: nil, // all
@@ -459,7 +459,7 @@ func TestGetManifest(t *testing.T) {
}
mDB.EXPECT().GetWorkspaceAppsByAgentID(gomock.Any(), childAgent.ID).Return([]database.WorkspaceApp{}, nil)
mDB.EXPECT().GetWorkspaceAgentScriptsByAgentIDs(gomock.Any(), []uuid.UUID{childAgent.ID}).Return([]database.WorkspaceAgentScript{}, nil)
mDB.EXPECT().GetWorkspaceAgentScriptsByAgentIDs(gomock.Any(), []uuid.UUID{childAgent.ID}).Return([]database.GetWorkspaceAgentScriptsByAgentIDsRow{}, nil)
mDB.EXPECT().GetWorkspaceAgentMetadata(gomock.Any(), database.GetWorkspaceAgentMetadataParams{
WorkspaceAgentID: childAgent.ID,
Keys: nil,