Structure kernel terminate stage with event delivery guarantee
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 17h 7m
- Merged PRs (30d)
- 358
Description
Refactor the termination phase (stop_container, cleanup_scratch, release_resources) into a TerminateStageHandler under agent/stage/. RETURNS A RESPONSE ONLY - no event emission. Local phase transitions: -> TERMINATING, TERMINATING -> TERMINATED. Teardown must be idempotent and leave no orphan container.
The Agent does NOT emit a CANCELLED transition - CANCELLED/reschedule belongs to sokovan session scheduling.
Do NOT emit KernelTerminating/TerminatedAnycastEvent from the handler - transitions are reported by the transition-event layer (BA-6851).
Success Criteria:
- [ ] Termination runs through TerminateStageHandler
- [ ] Handler returns a response only (no event emission)
- [ ] No orphan container remains on termination failure (retry or fallback cleanup)
- [ ] pants test passes for affected packages
JIRA Issue: BA-6079
Contributor guide
Assessment
This issue has not been assessed yet.