summaryrefslogtreecommitdiff
path: root/internal/task/currentattempt_test.go
diff options
context:
space:
mode:
authorAgent <agent@claudomator>2026-07-09 19:53:26 +0000
committerAgent <agent@claudomator>2026-07-09 19:53:26 +0000
commit65b96c0dc82e011bac18b24cff197fb16963d3d2 (patch)
treeecf9ba45ced8e12af54c3b91f92dd231ca60b310 /internal/task/currentattempt_test.go
parenta90ac76f3ccf0bf1259b7ef45e5f331d2b4ec26f (diff)
fix(task): add role check to CurrentAttempt so evaluators are not mistaken for fix attempts; also exclude .agent-home from git
Diffstat (limited to 'internal/task/currentattempt_test.go')
-rw-r--r--internal/task/currentattempt_test.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/internal/task/currentattempt_test.go b/internal/task/currentattempt_test.go
index 76661d8..58f7b08 100644
--- a/internal/task/currentattempt_test.go
+++ b/internal/task/currentattempt_test.go
@@ -122,6 +122,45 @@ func TestCurrentAttempt_DependentWithMultipleDependsOn_NotTreatedAsFixAttempt(t
}
}
+// TestCurrentAttempt_DependentWithDifferentRole_NotTreatedAsFixAttempt proves
+// a top-level evaluator task depending on a top-level builder task (both with
+// ParentTaskID=="") is not mistaken for the builder's fix attempt, because its
+// role differs from the builder's. This is the story-orchestrator scenario:
+// builder (role="builder") has evaluator dependents (role="evaluator_quality"
+// etc.) and later a fix-attempt (role="builder") -- only the fix-attempt must
+// be resolved as "next", not the evaluators.
+func TestCurrentAttempt_DependentWithDifferentRole_NotTreatedAsFixAttempt(t *testing.T) {
+ lookup := newFakeLookup()
+ lookup.tasks["builder"] = &Task{ID: "builder", ParentTaskID: "", Agent: AgentConfig{Role: "builder"}}
+ lookup.tasks["evaluator"] = &Task{ID: "evaluator", ParentTaskID: "", Agent: AgentConfig{Role: "evaluator_quality"}, DependsOn: []string{"builder"}}
+
+ got, err := CurrentAttempt(lookup, "builder")
+ if err != nil {
+ t.Fatalf("CurrentAttempt: %v", err)
+ }
+ if got.ID != "builder" {
+ t.Errorf("got %q, want builder (evaluator with different role must not be treated as a fix attempt)", got.ID)
+ }
+}
+
+// TestCurrentAttempt_FixAttemptWithSameRole_ResolvedCorrectly proves that a
+// fix-attempt task with the same role as the anchor IS resolved as "next",
+// even when evaluators with different roles also depend on the anchor.
+func TestCurrentAttempt_FixAttemptWithSameRole_ResolvedCorrectly(t *testing.T) {
+ lookup := newFakeLookup()
+ lookup.tasks["builder"] = &Task{ID: "builder", ParentTaskID: "", Agent: AgentConfig{Role: "builder"}}
+ lookup.tasks["evaluator"] = &Task{ID: "evaluator", ParentTaskID: "", Agent: AgentConfig{Role: "evaluator_quality"}, DependsOn: []string{"builder"}}
+ lookup.tasks["fix1"] = &Task{ID: "fix1", ParentTaskID: "", Agent: AgentConfig{Role: "builder"}, DependsOn: []string{"builder"}}
+
+ got, err := CurrentAttempt(lookup, "builder")
+ if err != nil {
+ t.Fatalf("CurrentAttempt: %v", err)
+ }
+ if got.ID != "fix1" {
+ t.Errorf("got %q, want fix1 (same-role fix attempt must be resolved as current)", got.ID)
+ }
+}
+
func TestCurrentAttempt_UnknownAnchor_ReturnsError(t *testing.T) {
lookup := newFakeLookup()
if _, err := CurrentAttempt(lookup, "does-not-exist"); err == nil {