fix(work-graph): preserve scheduled task evaluation revision #228

Merged
m merged 2 commits from codex/dev-000248-self-development-runtime-status into main 2026-08-23 18:01:19 +00:00
4 changed files with 31 additions and 4 deletions
+2 -2
View File
@@ -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
}
@@ -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"]
}
+5 -1
View File
@@ -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
}
}
@@ -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)
}
}