3.7 KiB
3.7 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 04-failed-predecessor-halt | Halt chains on a failed predecessor | done | 4 |
|
plan.md | ../../specs/tasks/system-design/task-dependencies.md |
Task 04: Halt Chains on a Failed Predecessor
Acceptance
- A predecessor entering
FAILEDorCANCELLEDnever resolves its edge. The dependent stays blocked and itsblocked_reasonbecomes"failed"once no predecessor is still pending. task.dependency_failedis published with{task_id, failed_task_id, failed_state}, once per (dependent, predecessor) failure transition. A repeated write of the same failed state does not re-publish.- A notification event type
task.dependency_failedis added following the existing constants ininternal/notifications/service, and fires once per transition. - No session is created for the dependent, and its
deferred_launchintent is neither consumed nor deleted — it remains available for a retry. - Retrying the failed predecessor to successful completion unblocks the dependent and fires its intent exactly once.
- Removing the edge unblocks the dependent without firing its intent.
- An archived predecessor reads as
pending, notfailedand notresolved; the dependent stays blocked and the predecessor is listed as pending. - Deleting a predecessor removes the edges in both directions, may unblock the dependent, and does not fire its intent — deletion is not success.
- Kandev never auto-retries a failed predecessor and never auto-removes an edge.
- A dependent that already launched is not stopped or rolled back when a predecessor is later reopened; it reports blocked again and its running session is untouched.
TDD sequence
- Failing test:
FAILEDpredecessor leaves the dependent blocked withblocked_reason: "failed", no session, intent intact. - Failing test:
CANCELLEDpredecessor behaves identically. - Failing test:
task.dependency_failedpublishes once; a duplicate terminal write does not re-publish. - Failing test: one notification is raised per transition.
- Failing test: retry-to-success unblocks and launches exactly once.
- Failing test: edge removal unblocks without launching.
- Failing test: archived predecessor reads as pending.
- Failing test: predecessor deletion removes both edge directions, unblocks, and launches nothing.
- Failing test: reopening a predecessor after the dependent launched leaves the running session alive and reports blocked again.
- Implement the failure branch, the event, and the notification type.
Verification
cd apps/backend
go test -tags fts5 ./internal/orchestrator ./internal/task/service ./internal/notifications/... -run 'Test.*(DependencyFailed|PredecessorFailed|DependencyArchived|DependencyDeleted)' -count=1
golangci-lint run ./... --new-from-rev=origin/main --timeout=5m
Files likely touched
apps/backend/internal/orchestrator/event_handlers_workflow.goor the state-change subscriber added in Task 03apps/backend/internal/task/events/apps/backend/internal/task/service/service_events.goapps/backend/internal/task/service/service_tasks.go(delete/archive edge cleanup interaction)apps/backend/internal/notifications/service/service.go- focused orchestrator, task-service, and notification tests
Dependencies
Task 03 — the resolution subscriber is where the failure branch lives.
Parallelism
sequential
Output contract
Mark this task in_progress before the RED tests and done only after the
listed commands pass. Record the once-per-transition mechanism, the notification
constant, and the delete-versus-archive difference in this file and plan.md.