fix(workflow): keep a stopped stage's notes in the parked detail

This commit is contained in:
sam committed 2026-10-27 15:22:42 +11:00
1 parent 8fbfb3c99f
commit 3c4b7b5877
2 files changed
+31

No files matched your search

+4
View File
@@ -218,6 +218,10 @@ func (a AgentStage) deliverResult(tc *TaskContext, res agentrun.Result) error {
if detail == "" {
detail = res.Summary
}
// A stage that stops short (step budget) has only its notes to show.
for _, note := range res.AppendedNotes {
detail += "\n- " + note
}
return fmt.Errorf("agent %s (%s): %s", res.Status, res.StopReason, clip(detail, 2000))
}
if !a.ReadOnly {
@@ -0,0 +1,27 @@
package workflow
import (
"strings"
"testing"
"github.com/samcharles93/archie-core/internal/domain/agentrun"
)
// A stage that stops short keeps what it found: the notes it appended reach
// the error that parks the run, not only the task notes.
func TestDeliverResultNonPassedCarriesFindings(t *testing.T) {
res := agentrun.Result{
Status: "parked", StopReason: "budget_exhausted",
Detail: "stopped after 60/60 steps, 900 tokens",
AppendedNotes: []string{"auth lives in internal/auth", "migration needs a backfill"},
}
err := AgentStage{Name: "feasibility"}.deliverResult(&TaskContext{}, res)
if err == nil {
t.Fatal("want error for parked run")
}
for _, want := range res.AppendedNotes {
if !strings.Contains(err.Error(), want) {
t.Errorf("error %q lacks finding %q", err, want)
}
}
}