Files
kandev/docs/plans/task-runtime-cleanup/task-04-startup-reconciliation.md
T
2026-08-23 17:34:52 +00:00

1.5 KiB

id, title, status, wave, depends_on, plan, spec
id title status wave depends_on plan spec
04-startup-reconciliation Startup reconciliation completed 2
01-runtime-inventory
02-task-cleanup-ordering
plan.md ../../specs/tasks/system-design/runtime-cleanup.md

Task 04: Startup Reconciliation

Acceptance

  • Backend startup scans persisted executors_running rows.
  • Terminal and missing-session rows are stopped by agent_execution_id before runtime tracking is removed.
  • Stop failures preserve runtime rows.

Verification

cd apps/backend && go test ./internal/task/service ./internal/orchestrator/...

Files likely touched

  • apps/backend/internal/task/service/service_tasks.go
  • apps/backend/internal/orchestrator/event_handlers.go
  • apps/backend/internal/agent/runtime/lifecycle/manager_lifecycle.go
  • apps/backend/cmd/kandev/*.go

Dependencies

Tasks 01 and 02.

Inputs

  • Stale runtime inventory method from Task 01
  • Cleanup service behavior from Task 02
  • ADR-0009 fail-closed cleanup semantics

Output contract

Report where reconciliation is owned, startup order implications, files changed, tests run, and any rows intentionally left untouched.

Result

  • Orchestrator startup reconciliation owns this pass.
  • Terminal completed/cancelled sessions and rows with missing sessions now stop through StopAgentWithReason before row deletion.
  • Rows without a stoppable execution handle are intentionally preserved with a warning.
  • Verified with go test -run TestReconcileSessionsOnStartup ./internal/orchestrator.