Structure Agent kernel lifecycle (create/prepare/terminate) into state-machine-based handlers, mirroring the sokovan Coordinator pattern, and guarantee event delivery to the Manager at each stage transition.
Background: create_kernel() is a single monolithic function handling image pull → resource allocation → container creation → kernel init in hundreds of lines. Files under agent/stage/kernel_lifecycle/docker/ exist per stage but are not wired into a state machine. Task tracking is minimal (CreateTaskInfo holds only kernel_id and session_id). Agent CLAUDE.md states container state transitions MUST go through agent/stage/, but this is currently unimplemented.
JIRA Issue: BA-6074
Structure Agent kernel lifecycle (create/prepare/terminate) into state-machine-based handlers, mirroring the sokovan Coordinator pattern, and guarantee event delivery to the Manager at each stage transition.
Background: create_kernel() is a single monolithic function handling image pull → resource allocation → container creation → kernel init in hundreds of lines. Files under agent/stage/kernel_lifecycle/docker/ exist per stage but are not wired into a state machine. Task tracking is minimal (CreateTaskInfo holds only kernel_id and session_id). Agent CLAUDE.md states container state transitions MUST go through agent/stage/, but this is currently unimplemented.
JIRA Issue: BA-6074