Tell the terminal phase how to finish
The worker finalises a task when .orchestra/done appears. No brief ever named that file: grepping a rendered launch.md for it returned nothing, in any phase. review is terminal. Its only legal move is backwards to implement, so a review that passes has nothing to ask for and, until now, nothing to write either. Run 5 halted exactly there after four clean rotations, with no error anywhere, because stopping was the correct reading of its instructions. The brief now names the marker in the terminal phase, says when to write it, and says it is exclusive with asking to go back. The test asserts the negative too, so a phase that can still ask is never told to finish instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011xsXyr5J1RACo71YeKG3Pu
This commit is contained in:
@@ -385,3 +385,26 @@ func TestPhaseSealSchemasDecode(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestTerminalPhaseNamesTheCompletionSignal guards F40. The worker finalises a
|
||||
// task when .orchestra/done appears, but no brief ever named that file. review
|
||||
// is terminal, its only legal move is backwards to implement, so a review that
|
||||
// passed had nothing to ask for and no way to finish. Run 5 halted there after
|
||||
// four clean rotations, silently.
|
||||
func TestTerminalPhaseNamesTheCompletionSignal(t *testing.T) {
|
||||
for phase := range completionPhase {
|
||||
if forward := domain.NextPhases(phase); len(forward) > 0 && forward[0] != domain.WorkPhaseImplement {
|
||||
t.Fatalf("%s is treated as terminal but moves forward to %s", phase, forward[0])
|
||||
}
|
||||
brief := phaseRequestBrief(phase)
|
||||
if !strings.Contains(brief, ".orchestra/done") {
|
||||
t.Fatalf("%s brief never names the completion signal:\n%s", phase, brief)
|
||||
}
|
||||
}
|
||||
// A phase that can still ask must not be told to finish instead.
|
||||
for _, phase := range []domain.WorkPhase{domain.WorkPhaseFrame, domain.WorkPhaseResearch, domain.WorkPhasePlan, domain.WorkPhaseImplement} {
|
||||
if strings.Contains(phaseRequestBrief(phase), ".orchestra/done") {
|
||||
t.Fatalf("%s can still ask for a phase change, so it must not be told to finish", phase)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user