Give the phase brief a protocol, and end the session it advances
The brief told the agent to ask for a phase change and never carried the asking. The agent asked in prose, no code represented the request, and the session idled until its lease expired. That is what failed run 3. F21. The agent asks with .orchestra/phase-request.json, and seals research.json or plan.json where the phase it is leaving produces one. At a verified turn boundary the worker checks the phase belief, the transition and the artifact, then calls the coordinator with its lease epoch and a derived operation id. AdvanceWorkPhase is unchanged, so a request cannot reach a move the operator surface could not also make. Redelivery is idempotent. F22. A session now records the phase it was launched to run. One that no longer matches its task rotates with reason phase_changed, whether this worker asked for the change or an operator made it. F20. CLIAdapter.prompt sent handoff and rotation prompts without confirming them, which is the failure F20 exists to catch. Fixed at the shared call site. F23 needed no change. Issue comments already become decisions with no submission, through Reconciler.Reconcile at PreLease and at every turn boundary. The earlier finding searched internal/operations alone and was wrong. Tests now cover the boundary it turns on. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011xsXyr5J1RACo71YeKG3Pu
This commit is contained in:
@@ -306,3 +306,48 @@ func TestAcceptanceCriteriaRenderInOrder(t *testing.T) {
|
||||
t.Fatalf("absent acceptance did not render Not stated:\n%s", got.Task)
|
||||
}
|
||||
}
|
||||
|
||||
// The brief used to tell an agent to ask for a phase change while nothing
|
||||
// carried the asking. Whatever else the wording says, it has to name the file
|
||||
// the worker actually reads, or the instruction is a promise again.
|
||||
func TestPhaseBriefNamesTheRequestFile(t *testing.T) {
|
||||
for _, phase := range []domain.WorkPhase{
|
||||
domain.WorkPhaseFrame, domain.WorkPhaseResearch, domain.WorkPhasePlan, domain.WorkPhaseImplement,
|
||||
} {
|
||||
out, err := Build(Input{
|
||||
Task: domain.Task{ID: "t1", Title: "demo"},
|
||||
Phase: phase,
|
||||
Git: GitState{Worktree: "/w", Branch: "orchestra/t1"},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("%s: %v", phase, err)
|
||||
}
|
||||
if !strings.Contains(out.Task, ".orchestra/phase-request.json") {
|
||||
t.Fatalf("%s brief does not name the request file", phase)
|
||||
}
|
||||
if !strings.Contains(out.Task, `"from"`) || !strings.Contains(out.Task, `"to"`) {
|
||||
t.Fatalf("%s brief does not state the request shape", phase)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A phase that seals an artifact must say so where it says how to ask,
|
||||
// because the request is refused without it.
|
||||
func TestPhaseBriefNamesTheArtifactToSeal(t *testing.T) {
|
||||
for phase, file := range map[domain.WorkPhase]string{
|
||||
domain.WorkPhaseResearch: "research.json",
|
||||
domain.WorkPhasePlan: "plan.json",
|
||||
} {
|
||||
out, err := Build(Input{
|
||||
Task: domain.Task{ID: "t1", Title: "demo"},
|
||||
Phase: phase,
|
||||
Git: GitState{Worktree: "/w", Branch: "orchestra/t1"},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("%s: %v", phase, err)
|
||||
}
|
||||
if !strings.Contains(out.Task, ".orchestra/"+file) {
|
||||
t.Fatalf("%s brief does not name %s", phase, file)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user