Enforce requested adapter output paths

This commit is contained in:
2026-08-10 21:57:54 +00:00
parent 702f622e18
commit 8ff1b4fa66
15 changed files with 137 additions and 126 deletions

View File

@@ -200,7 +200,10 @@ func (trimStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*Stag
if renderRes.ValidationFailed {
return nil, fmt.Errorf("trim: scriptorium bounds render returned validation_failed=true")
}
finalRenderOutputPath := coalesceString(renderRes.OutputPath, renderReq.OutputPath)
finalRenderOutputPath, err := authoritativeOutputPath(renderReq.OutputPath, renderRes.OutputPath)
if err != nil {
return nil, fmt.Errorf("trim: %w", err)
}
if err := requireNonEmptyFile(finalRenderOutputPath, "bounds render output"); err != nil {
return nil, fmt.Errorf("trim: %w", err)
}
@@ -242,7 +245,7 @@ func (trimStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*Stag
return nil, fmt.Errorf(
"trim: scriptorium bounds validation failed (prompt_id=%q, output_path=%q, exit_code=%d, stdout_log=%q, stderr_log=%q): %w",
boundsReq.PromptID,
coalesceString(boundsRes.OutputPath, boundsReq.OutputPath),
boundsReq.OutputPath,
boundsRes.ExitCode,
coalesceString(boundsRes.StdoutLogPath, boundsReq.StdoutLogPath),
coalesceString(boundsRes.StderrLogPath, boundsReq.StderrLogPath),
@@ -255,7 +258,10 @@ func (trimStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*Stag
return nil, fmt.Errorf("trim: scriptorium bounds run returned validation_failed=true")
}
finalBoundsOutputPath := coalesceString(boundsRes.OutputPath, boundsReq.OutputPath)
finalBoundsOutputPath, err := authoritativeOutputPath(boundsReq.OutputPath, boundsRes.OutputPath)
if err != nil {
return nil, fmt.Errorf("trim: %w", err)
}
if err := requireNonEmptyFile(finalBoundsOutputPath, "session bounds output"); err != nil {
return nil, fmt.Errorf("trim: %w", err)
}