Skip to main content

classify_unclean_exit

Function
This function is defined in the protocols module.
Classify the previous boot’s exit and return a fresh boot record (pure). Given the record persisted by the previous process, decide whether that process exited cleanly and stamp a new phase="running" record for this boot. Side-effect free so it is provable in isolation, mirroring :func:classify_exit_reason. Rules:
  • No prior record ⇒ first boot / fresh store: exit_kind="unknown" (the caller must never treat "unknown" as healthy, but there is nothing to resume).
  • Prior phase == "exited" ⇒ the previous process reached its graceful stop: exit_kind="clean".
  • Prior phase in ("running", "draining") ⇒ the previous process died before recording a clean exit (SIGKILL/OOM/segfault/orchestrator kill): exit_kind="unclean", and suspected_oom when its last memory sample was at/above oom_fraction of the budget.
The returned record carries forward the prior restart_events so the persistent restart-loop guard sees the full cross-boot history.

Signature

Parameters

Optional[LifecycleRecord]
required
The previous process’s persisted :class:LifecycleRecord, or None on a fresh store.

Returns

LifecycleRecord
class:LifecycleRecord for this boot.

Uses

  • LifecycleRecord

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 4904