feat(webui): run details show inputs, outputs and workflow.call links both ways
This commit is contained in:
13 files changed
+167
-91
No files matched your search
@@ -4266,17 +4266,19 @@ type StepExecution struct {
|
||||
ExecutionId int64 `protobuf:"varint,2,opt,name=execution_id,json=executionId,proto3" json:"execution_id,omitempty"`
|
||||
Attempt int64 `protobuf:"varint,3,opt,name=attempt,proto3" json:"attempt,omitempty"`
|
||||
// parent_id is 0 for a stage at the tree's root.
|
||||
ParentId int64 `protobuf:"varint,4,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"`
|
||||
Depth int32 `protobuf:"varint,5,opt,name=depth,proto3" json:"depth,omitempty"`
|
||||
Kind string `protobuf:"bytes,6,opt,name=kind,proto3" json:"kind,omitempty"`
|
||||
Name string `protobuf:"bytes,7,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Status string `protobuf:"bytes,8,opt,name=status,proto3" json:"status,omitempty"`
|
||||
Detail string `protobuf:"bytes,9,opt,name=detail,proto3" json:"detail,omitempty"`
|
||||
TokensUsed int64 `protobuf:"varint,10,opt,name=tokens_used,json=tokensUsed,proto3" json:"tokens_used,omitempty"`
|
||||
StartedAt *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=started_at,json=startedAt,proto3" json:"started_at,omitempty"`
|
||||
FinishedAt *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=finished_at,json=finishedAt,proto3" json:"finished_at,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
ParentId int64 `protobuf:"varint,4,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"`
|
||||
Depth int32 `protobuf:"varint,5,opt,name=depth,proto3" json:"depth,omitempty"`
|
||||
Kind string `protobuf:"bytes,6,opt,name=kind,proto3" json:"kind,omitempty"`
|
||||
Name string `protobuf:"bytes,7,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Status string `protobuf:"bytes,8,opt,name=status,proto3" json:"status,omitempty"`
|
||||
Detail string `protobuf:"bytes,9,opt,name=detail,proto3" json:"detail,omitempty"`
|
||||
TokensUsed int64 `protobuf:"varint,10,opt,name=tokens_used,json=tokensUsed,proto3" json:"tokens_used,omitempty"`
|
||||
StartedAt *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=started_at,json=startedAt,proto3" json:"started_at,omitempty"`
|
||||
FinishedAt *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=finished_at,json=finishedAt,proto3" json:"finished_at,omitempty"`
|
||||
// called_execution_id is the callee task a workflow.call step started.
|
||||
CalledExecutionId int64 `protobuf:"varint,13,opt,name=called_execution_id,json=calledExecutionId,proto3" json:"called_execution_id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *StepExecution) Reset() {
|
||||
@@ -4393,6 +4395,13 @@ func (x *StepExecution) GetFinishedAt() *timestamppb.Timestamp {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *StepExecution) GetCalledExecutionId() int64 {
|
||||
if x != nil {
|
||||
return x.CalledExecutionId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type ListStepsRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
ExecutionId int64 `protobuf:"varint,1,opt,name=execution_id,json=executionId,proto3" json:"execution_id,omitempty"`
|
||||
@@ -14834,7 +14843,7 @@ const file_state_v1_state_proto_rawDesc = "" +
|
||||
"\x06reason\x18\x02 \x01(\tR\x06reason\x12\x0e\n" +
|
||||
"\x02to\x18\x03 \x01(\tR\x02to\"G\n" +
|
||||
"\x17CancelExecutionResponse\x12,\n" +
|
||||
"\x12cancelled_step_ids\x18\x01 \x03(\x03R\x10cancelledStepIds\"\x80\x03\n" +
|
||||
"\x12cancelled_step_ids\x18\x01 \x03(\x03R\x10cancelledStepIds\"\xb0\x03\n" +
|
||||
"\rStepExecution\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x03R\x02id\x12!\n" +
|
||||
"\fexecution_id\x18\x02 \x01(\x03R\vexecutionId\x12\x18\n" +
|
||||
@@ -14851,7 +14860,8 @@ const file_state_v1_state_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"started_at\x18\v \x01(\v2\x1a.google.protobuf.TimestampR\tstartedAt\x12;\n" +
|
||||
"\vfinished_at\x18\f \x01(\v2\x1a.google.protobuf.TimestampR\n" +
|
||||
"finishedAt\"O\n" +
|
||||
"finishedAt\x12.\n" +
|
||||
"\x13called_execution_id\x18\r \x01(\x03R\x11calledExecutionId\"O\n" +
|
||||
"\x10ListStepsRequest\x12!\n" +
|
||||
"\fexecution_id\x18\x01 \x01(\x03R\vexecutionId\x12\x18\n" +
|
||||
"\aattempt\x18\x02 \x01(\x03R\aattempt\"B\n" +
|
||||
|
||||
@@ -88,4 +88,6 @@ type StepExecution struct {
|
||||
TokensUsed int64
|
||||
StartedAt time.Time
|
||||
FinishedAt time.Time
|
||||
// CalledExecutionID is the callee task a workflow.call step started, or 0.
|
||||
CalledExecutionID int64
|
||||
}
|
||||
@@ -189,7 +189,7 @@ func (q *Queries) LatestStageResults(ctx context.Context, arg LatestStageResults
|
||||
}
|
||||
|
||||
const listStepExecutions = `-- name: ListStepExecutions :many
|
||||
SELECT id, execution_id, attempt, parent_id, depth, kind, name, status, detail, tokens_used, started_at, finished_at
|
||||
SELECT id, execution_id, attempt, parent_id, depth, kind, name, status, detail, tokens_used, started_at, finished_at, called_execution_id
|
||||
FROM step_executions
|
||||
WHERE execution_id = $1::bigint AND ($2::bigint = 0 OR attempt = $2::bigint)
|
||||
ORDER BY attempt, id
|
||||
@@ -201,18 +201,19 @@ type ListStepExecutionsParams struct {
|
||||
}
|
||||
|
||||
type ListStepExecutionsRow struct {
|
||||
ID int64
|
||||
ExecutionID int64
|
||||
Attempt int64
|
||||
ParentID pgtype.Int8
|
||||
Depth int32
|
||||
Kind string
|
||||
Name string
|
||||
Status string
|
||||
Detail string
|
||||
TokensUsed int64
|
||||
StartedAt pgtype.Timestamptz
|
||||
FinishedAt pgtype.Timestamptz
|
||||
ID int64
|
||||
ExecutionID int64
|
||||
Attempt int64
|
||||
ParentID pgtype.Int8
|
||||
Depth int32
|
||||
Kind string
|
||||
Name string
|
||||
Status string
|
||||
Detail string
|
||||
TokensUsed int64
|
||||
StartedAt pgtype.Timestamptz
|
||||
FinishedAt pgtype.Timestamptz
|
||||
CalledExecutionID int64
|
||||
}
|
||||
|
||||
// attempt = 0 lists every attempt of the execution, oldest first; the index
|
||||
@@ -240,6 +241,7 @@ func (q *Queries) ListStepExecutions(ctx context.Context, arg ListStepExecutions
|
||||
&i.TokensUsed,
|
||||
&i.StartedAt,
|
||||
&i.FinishedAt,
|
||||
&i.CalledExecutionID,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ RETURNING id, name;
|
||||
-- attempt = 0 lists every attempt of the execution, oldest first; the index
|
||||
-- (execution_id, attempt, id) makes both this and the single-attempt form a
|
||||
-- straight index scan.
|
||||
SELECT id, execution_id, attempt, parent_id, depth, kind, name, status, detail, tokens_used, started_at, finished_at
|
||||
SELECT id, execution_id, attempt, parent_id, depth, kind, name, status, detail, tokens_used, started_at, finished_at, called_execution_id
|
||||
FROM step_executions
|
||||
WHERE execution_id = @execution_id::bigint AND (@attempt::bigint = 0 OR attempt = @attempt::bigint)
|
||||
ORDER BY attempt, id;
|
||||
|
||||
@@ -258,6 +258,7 @@ func (s *Store) ListSteps(ctx context.Context, executionID int64, attempt int) (
|
||||
Kind: r.Kind, Name: r.Name, Status: taskstate.StepStatus(r.Status),
|
||||
Detail: r.Detail, TokensUsed: r.TokensUsed,
|
||||
StartedAt: r.StartedAt.Time, FinishedAt: r.FinishedAt.Time,
|
||||
CalledExecutionID: r.CalledExecutionID,
|
||||
}
|
||||
}
|
||||
return steps, nil
|
||||
|
||||
@@ -330,6 +330,7 @@ func stepExecutionProto(s task.StepExecution) *pb.StepExecution {
|
||||
ParentId: s.ParentID, Depth: int32(s.Depth), Kind: s.Kind, Name: s.Name,
|
||||
Status: string(s.Status), Detail: s.Detail, TokensUsed: s.TokensUsed,
|
||||
StartedAt: timestamp(s.StartedAt), FinishedAt: timestamp(s.FinishedAt),
|
||||
CalledExecutionId: s.CalledExecutionID,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,6 +343,7 @@ func stepExecutionValue(s *pb.StepExecution) task.StepExecution {
|
||||
ParentID: s.ParentId, Depth: int(s.Depth), Kind: s.Kind, Name: s.Name,
|
||||
Status: taskstate.StepStatus(s.Status), Detail: s.Detail, TokensUsed: s.TokensUsed,
|
||||
StartedAt: timeValue(s.StartedAt), FinishedAt: timeValue(s.FinishedAt),
|
||||
CalledExecutionID: s.CalledExecutionId,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,11 @@ type taskAttemptsView struct {
|
||||
// of presenting it as a first run.
|
||||
UnattributedEvents int `json:"unattributed_events"`
|
||||
Attempts []taskAttemptView `json:"attempts"`
|
||||
// Inputs are what the task was started with; Outputs what its current
|
||||
// attempt wrote; CalledBy the task whose workflow.call started it.
|
||||
Inputs map[string]any `json:"inputs,omitempty"`
|
||||
Outputs map[string]any `json:"outputs,omitempty"`
|
||||
CalledBy int64 `json:"called_by,omitempty"`
|
||||
}
|
||||
|
||||
// taskAttemptView is one attempt, bounded by its first and last event.
|
||||
@@ -65,6 +70,8 @@ type taskStageView struct {
|
||||
Error string `json:"error"`
|
||||
FinishedAt *time.Time `json:"finished_at,omitempty"`
|
||||
Agents []taskAgentView `json:"agents,omitempty"`
|
||||
// Calls are the callee tasks this stage's workflow.call steps started.
|
||||
Calls []int64 `json:"calls,omitempty"`
|
||||
}
|
||||
|
||||
type taskAgentView struct {
|
||||
@@ -103,6 +110,9 @@ func (s *Server) handleTaskAttempts(w http.ResponseWriter, r *http.Request) {
|
||||
CurrentAttempt: t.Attempt,
|
||||
UnattributedEvents: unattributed,
|
||||
Attempts: attempts,
|
||||
Inputs: t.Inputs,
|
||||
Outputs: t.Outputs,
|
||||
CalledBy: t.CallParentTaskID,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -260,6 +270,9 @@ func stageViewsFromSteps(steps []task.StepExecution, inFlight bool) []taskStageV
|
||||
view.DurationMS = &duration
|
||||
}
|
||||
for _, child := range steps {
|
||||
if child.ParentID == s.ID && child.CalledExecutionID != 0 {
|
||||
view.Calls = append(view.Calls, child.CalledExecutionID)
|
||||
}
|
||||
if child.ParentID != s.ID || child.Kind != task.StepKindAgent {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user