Decide which state survives each lifecycle event.
1. Transient state
A network connection and runner object are not saved-state data. Persist the minimum conversation and task identifiers needed to restore an understandable screen.
2. Process recovery
Process death can occur after a side effect but before the UI receives its result. Reconcile by operation ID rather than automatically replaying the last user message.
3. Account boundaries
Close or invalidate sessions when users sign out or switch accounts. Check ownership when restoring persisted history and avoid displaying one account’s context in another session.
Worked scenario
Task creation succeeds, then the process dies. On restart, the app finds the operation result rather than creating a second task.
Apply it
Write a recovery table for rotation, screen exit, process death and account change.
Check your understanding
Every recovery path states whether work resumes, cancels or reconciles. Explain the decision and show evidence from your implementation or design. If you cannot demonstrate it yet, revisit the relevant section before continuing.