Validate providers and retain complete run debugging context

This commit is contained in:
2026-10-09 23:21:01 +01:00
parent f3d829bea5
commit 08b8647d5b
51 changed files with 1036 additions and 159 deletions
+4 -3
View File
@@ -296,7 +296,8 @@ func (r *runner) run(ctx context.Context, id int64, d *protocol.PipelineDetail,
return
}
useAgent := stage.EffectiveType(def.Type) == stage.ModelType && (len(tools) > 0 || !explicitTools)
client := &stage.AgentClient{OpenCodeClient: stage.OpenCodeClient{Directory: workspace}, WritePaths: request.WritePaths, Tools: tools}
operations := &stage.OperationLog{}
client := &stage.AgentClient{OpenCodeClient: stage.OpenCodeClient{Directory: workspace, Operations: operations}, WritePaths: request.WritePaths, Tools: tools}
client.OnSession = func(session string, active bool) error {
c, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
@@ -309,7 +310,7 @@ func (r *runner) run(ctx context.Context, id int64, d *protocol.PipelineDetail,
} else if useAgent {
result, err = (stage.ModelStage{Client: client}).Run(ctx, def, input)
} else if stage.EffectiveType(def.Type) == stage.ModelType {
plain := &stage.OpenCodeClient{Directory: workspace}
plain := &stage.OpenCodeClient{Directory: workspace, Operations: operations}
plain.OnGenerationSession = func(session, backend, reference string, active bool) error {
c, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
@@ -320,7 +321,7 @@ func (r *runner) run(ctx context.Context, id int64, d *protocol.PipelineDetail,
} else {
result, err = stage.DefaultRegistry().Run(ctx, def, input)
}
step := protocol.RunStep{Sequence: sequence, Stage: key, Status: "completed", Outcome: result.Outcome, Output: result.Output, Transcript: client.Transcript}
step := protocol.RunStep{Sequence: sequence, Stage: key, Status: "completed", Outcome: result.Outcome, Output: result.Output, Transcript: operations.Transcript(client.Transcript)}
if err != nil {
step.Status = "failed"
step.Diagnostic = err.Error()