stage turns: replace JSON results with file-based markdown turns
Each model visit now gets <run>/stages/<seq>-<stage>/ with input.md, memory.md, output.md, private/ and a shared run-level public/. The model reads the two input files, follows the stage's instructions verbatim and returns complete markdown; only the # outcome section is parsed. - add internal/turn layout, render and output parsing - write input.md/memory.md before a visit and output.md from the final message; inventory all turn files as stage artifacts - accumulate completed turns and system-written public file additions in memory, including across retries and resume - remove the JSON envelope, strict field validation, line format and the repair ladder for model stages - republish pipeline authoring prompts and docs in the new style Checks: go build ./..., go vet ./..., go test -count=1 ./..., gofmt -l .
This commit is contained in:
+16
-31
@@ -3,6 +3,7 @@ package examples_test
|
||||
import (
|
||||
"os"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.a-wan.net/alan/pipelines/examples"
|
||||
@@ -142,40 +143,24 @@ func TestThreeStagePlannerBlockedRoute(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestThreeStageReviewerMemoryKeepsPlannerAcceptance(t *testing.T) {
|
||||
func TestThreeStageUsesTurnFilesWithoutRetiredBlocks(t *testing.T) {
|
||||
graph := parsedCatalog(t)["three-stage"]
|
||||
for _, s := range graph.Stages {
|
||||
if len(s.Memory) != 0 {
|
||||
t.Fatalf("%s stage %s must not use the retired memory block: %v", "three-stage", s.Key, s.Memory)
|
||||
}
|
||||
if s.Output != "" {
|
||||
t.Fatalf("%s stage %s must not declare the retired output block", "three-stage", s.Key)
|
||||
}
|
||||
}
|
||||
var reviewer protocol.Stage
|
||||
for _, s := range graph.Stages {
|
||||
if s.Key == "reviewer" {
|
||||
reviewer = s
|
||||
}
|
||||
}
|
||||
if reviewer.Key == "" {
|
||||
t.Fatal("three-stage reviewer stage missing")
|
||||
}
|
||||
plannerOwned := map[string]string{
|
||||
"plan": "planner.plan",
|
||||
"design": "planner.design",
|
||||
"reuse_targets": "planner.reuse_targets",
|
||||
"acceptance_checks": "planner.acceptance_checks",
|
||||
"research": "planner.research",
|
||||
}
|
||||
for alias, reference := range plannerOwned {
|
||||
if got := reviewer.Memory[alias]; got != reference {
|
||||
t.Fatalf("reviewer memory %s = %q, want %q", alias, got, reference)
|
||||
}
|
||||
}
|
||||
if got := reviewer.Memory["task"]; got != "input.prompt" {
|
||||
t.Fatalf("reviewer must receive the original task, got %q", got)
|
||||
}
|
||||
for alias, want := range map[string]string{
|
||||
"changed_files": "implementer.changed_files",
|
||||
"implementation_summary": "implementer.implementation_summary",
|
||||
"evidence": "implementer.evidence?",
|
||||
} {
|
||||
if got := reviewer.Memory[alias]; got != want {
|
||||
t.Fatalf("reviewer memory %s = %q, want %q", alias, got, want)
|
||||
}
|
||||
if reviewer.Key == "" || !strings.Contains(strings.ToLower(reviewer.Prompt), "independently review") {
|
||||
t.Fatalf("three-stage reviewer must independently review the full diff: %+v", reviewer)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,11 +181,11 @@ func TestWorkProducingStartersEndInACommitter(t *testing.T) {
|
||||
if got := last.Edges["success"]; got != protocol.SuccessEnd {
|
||||
t.Fatalf("%s committer success route = %q, want %q", tc.key, got, protocol.SuccessEnd)
|
||||
}
|
||||
if got := last.Memory["server_changed_files"]; got != "input.server_changed_files" {
|
||||
t.Fatalf("%s committer must select input.server_changed_files, got %q", tc.key, got)
|
||||
if len(last.Memory) != 0 || last.Output != "" {
|
||||
t.Fatalf("%s committer must use the turn files, not retired blocks: %+v", tc.key, last)
|
||||
}
|
||||
if got := last.Memory["changed_files"]; got != tc.producer+".changed_files" {
|
||||
t.Fatalf("%s committer changed_files = %q, want %q", tc.key, got, tc.producer+".changed_files")
|
||||
if !strings.Contains(last.Prompt, "diff") {
|
||||
t.Fatalf("%s committer prompt must inspect the actual diff", tc.key)
|
||||
}
|
||||
// The producer hands its work on rather than ending the run itself.
|
||||
for _, s := range graph.Stages {
|
||||
|
||||
Reference in New Issue
Block a user