Headless mode's resume logic adds an extra safety wait before reusing a stale cancelled prompt after a worker restart
In headless (print) mode, when Claude Code resumes work after a worker restart, it now waits for an extra notification flush in one more case: when there are no orphaned background tasks, but there is a stale cancelled prompt or superseded tool calls left over, and the pending message was itself an interrupted prompt. This matches a flush that was already being done for the orphaned-background-task case.
This closes a gap where a resumed session could act on stale, already-cancelled state after a restart, making resume behavior more consistent between the two cases.