Flushing before sending `TaskCompleteEvent` and ending the submission loop to avoid race conditions.
codex exec