fix(turns): keep the run task in every stage's input

Later visits' input.md held only the previous stage's output, so the
operator's task reached only the first stage; when a Prepare stage
summarised (paths, HEAD), Code never saw the task or its acceptance
checklist and either blocked (run #202) or did part of it (#195, #197,
#198). Later inputs now carry the run prompt under '# Run task' (headings
demoted) before '# Previous turn output'.
This commit is contained in:
2026-10-31 02:52:16 +00:00
parent ea0f22dfc7
commit 13c4035175
8 changed files with 35 additions and 23 deletions
+10 -4
View File
@@ -6,14 +6,20 @@ import (
"strings"
)
// RenderInput renders the markdown a turn receives. The first turn receives the
// run prompt as-is. Later turns receive the previous turn's output verbatim
// under a heading; prompt is not repeated.
// RenderInput is a visit's input.md: the run prompt on the first visit, and on
// later visits the run prompt under "# Run task" followed by the previous
// visit's body under "# Previous turn output". Every stage keeps the operator's
// task: a stage that summarised its own work must not be the only carrier of
// what the run is for.
func RenderInput(prompt string, previousOutput string) string {
if strings.TrimSpace(previousOutput) == "" {
return prompt
}
return "# Previous turn output\n\n" + previousOutput
if strings.TrimSpace(prompt) == "" {
return "# Previous turn output\n\n" + previousOutput
}
task := strings.TrimRight(prompt, "\n")
return "# Run task\n\n" + demoteHeadings(task) + "\n\n# Previous turn output\n\n" + previousOutput
}
// MemoryEntry is one completed turn in a later turn's memory file. Output is