diff --git a/dev/ACTIVE_TASK.json b/dev/ACTIVE_TASK.json index 304917d..0aff802 100644 --- a/dev/ACTIVE_TASK.json +++ b/dev/ACTIVE_TASK.json @@ -1,5 +1,5 @@ { - "task_file": "dev/tasks/DEV-000249-task-evaluation-model-failover.json", - "task_id": "DEV-000249", + "task_file": "dev/tasks/DEV-000250-task-evaluation-terminal-callback.json", + "task_id": "DEV-000250", "task_revision": 1 } diff --git a/dev/tasks/DEV-000250-task-evaluation-terminal-callback.json b/dev/tasks/DEV-000250-task-evaluation-terminal-callback.json new file mode 100644 index 0000000..b51a8f9 --- /dev/null +++ b/dev/tasks/DEV-000250-task-evaluation-terminal-callback.json @@ -0,0 +1,23 @@ +{ + "task_id": "DEV-000250", + "task_revision": 1, + "architecture_revision": "ADR-0018", + "base_repo_revision": "2b8cea5aa8f43f597b2af7d92c2eaa305d68256e", + "risk_tier": "E", + "intent": "Preserve the scheduled Work Graph revision in task-evaluation dispatch context so verifier callbacks complete the current immutable graph revision and reach terminal state.", + "requirement_ids": ["live task evaluation", "Work Graph integration", "durable callback lineage"], + "allowed_change_scope": {"modules": ["work"], "paths": ["modules/work/application/**", "modules/work/domain/**", "dev/ACTIVE_TASK.json", "dev/tasks/DEV-000250-task-evaluation-terminal-callback.json"]}, + "forbidden_change_scope": {"paths": ["architecture/**", "security/**", "database/**", "deploy/**", "contracts/**", "LLM-local/**", "cmd/cognitive-worker/**", "cmd/agent-worker/**"]}, + "allowed_architecture_delta": {"new_cross_module_dependencies": 0, "new_canonical_owners": 0, "new_privileges": 0, "new_third_party_dependencies": 0, "new_database_owner_roles": 0}, + "contracts": {"consume": ["existing WorkGraph scheduler", "existing TaskEvaluationDispatchContext", "existing callback contract"], "may_change": []}, + "semantic_owner": "Work Graph task-evaluation scheduling", + "canonical_state": ["existing immutable graph revisions and node states only"], + "state_transitions": ["scheduled revision -> evaluator callback -> completed revision -> terminal graph"], + "side_effects_and_privileges": ["existing work and capability owner writes; no new privileges"], + "persistence_and_migrations": ["none"], + "failure_retry_restart": ["callback uses the revision that contains the leased node; duplicate callback remains protected by existing immutable revision/idempotency behavior"], + "assumptions": ["scheduler increments the draft graph revision exactly once before enqueueing dispatches"], + "acceptance_scenarios": ["live task-evaluation callback updates scheduled revision", "unknown evaluation reaches graph terminal state", "successful verified evaluation reaches graph terminal state", "callback lineage remains serializable"], + "required_tests": ["go test ./modules/work/application ./modules/work/domain", "go vet ./modules/work/application ./modules/work/domain", "go run ./cmd/devctl preflight -active dev/ACTIVE_TASK.json", "go run ./cmd/devctl check-diff -active dev/ACTIVE_TASK.json", "go run ./cmd/devctl check-architecture", "git diff --check", "independent", "CI", "production health smoke", "live task-evaluation canary"], + "terminal_gap_states": ["BLOCKED_BY_MISSING_CAPABILITY", "BLOCKED_BY_SPEC_GAP"] +} diff --git a/modules/work/application/graph_runtime.go b/modules/work/application/graph_runtime.go index bf617b9..0ef6598 100644 --- a/modules/work/application/graph_runtime.go +++ b/modules/work/application/graph_runtime.go @@ -218,7 +218,11 @@ func AdmitAndScheduleTaskEvaluation(ctx context.Context, store ports.GraphStore, intents[i].TaskEvaluationProfile = &profile } intents[i].TaskEvaluationCases = append([]capability.TaskEvaluationCase(nil), node.TaskCases...) - intents[i].TaskEvaluationExecution = &work.TaskEvaluationDispatchContext{GraphID: graph.ID, GraphRevision: graph.Revision, NodeID: node.ID, BindingRevision: request.Plan.BindingRevision, ActorID: identity.ActorID(request.Plan.ActorID), PrincipalID: identity.PrincipalID(request.Plan.PrincipalID), ScopeID: authority.ScopeID(request.Plan.ScopeID)} + // AdmitAndSchedule increments the draft revision before persisting + // the leased node. The callback must target that scheduled revision; + // using the draft revision would save a completed copy that loses to + // the already-persisted immutable scheduled revision. + intents[i].TaskEvaluationExecution = &work.TaskEvaluationDispatchContext{GraphID: graph.ID, GraphRevision: graph.Revision + 1, NodeID: node.ID, BindingRevision: request.Plan.BindingRevision, ActorID: identity.ActorID(request.Plan.ActorID), PrincipalID: identity.PrincipalID(request.Plan.PrincipalID), ScopeID: authority.ScopeID(request.Plan.ScopeID)} break } } diff --git a/modules/work/application/task_evaluation_dispatch_test.go b/modules/work/application/task_evaluation_dispatch_test.go index 1d51727..ab6d4b8 100644 --- a/modules/work/application/task_evaluation_dispatch_test.go +++ b/modules/work/application/task_evaluation_dispatch_test.go @@ -41,7 +41,7 @@ func TestAdmitAndScheduleTaskEvaluationCarriesSpecialistContext(t *testing.T) { if _, _, err := AdmitAndScheduleTaskEvaluation(context.Background(), store, request); err != nil { t.Fatal(err) } - if len(store.intents) != 1 || store.intents[0].TaskEvaluationProfileID != "profile-general" || store.intents[0].TaskEvaluationBindingID != "binding-a" || len(store.intents[0].TaskEvaluationCaseIDs) != 2 || store.intents[0].SpecialistPurpose != string(work.GraphNodePurposeTaskEvaluation) { + if len(store.intents) != 1 || store.intents[0].TaskEvaluationProfileID != "profile-general" || store.intents[0].TaskEvaluationBindingID != "binding-a" || len(store.intents[0].TaskEvaluationCaseIDs) != 2 || store.intents[0].SpecialistPurpose != string(work.GraphNodePurposeTaskEvaluation) || store.intents[0].TaskEvaluationExecution == nil || store.intents[0].TaskEvaluationExecution.GraphRevision != 2 { t.Fatalf("specialist context was not carried into dispatch: %+v", store.intents) } }