MACP Session Lifecycle
Status: Non-normative (explanatory). In case of conflict, the referenced RFC is authoritative. Reference: RFC-MACP-0001 Core
The MACP session lifecycle is a monotonic state machine. This is what turns coordination from emergent behavior into enforceable protocol state.
Session states
- OPEN — session is active and accepting messages
- RESOLVED — session terminated via first accepted Mode-defined terminal message
- EXPIRED — session terminated due to TTL, cancellation, or deterministic runtime policy
No transition from RESOLVED or EXPIRED back to OPEN is permitted.
stateDiagram-v2
[*] --> OPEN: SessionStart accepted
OPEN --> RESOLVED: first accepted terminal message
OPEN --> EXPIRED: TTL / CancelSession / deterministic runtime policy
RESOLVED --> [*]
EXPIRED --> [*]
Admission rules for session-scoped messages
For any message with a non-empty session_id, the runtime MUST verify that:
- the session exists,
- the session is OPEN,
- the sender is authorized,
- the message is structurally valid,
- the message is not a duplicate.
If any check fails, the message is rejected and does not enter history.
Accepted-History Discipline
Only accepted session-scoped Envelopes become part of authoritative session history. Ambient Signals may be handled ephemerally and are not required to enter durable replay history unless a deployment opts into separate signal logging. Rejected Envelopes MUST NOT:
- be appended to accepted history,
- consume
message_iddeduplication slots, - mutate session state.
All validation, authentication, authorization, deduplication, session-state checks, and Mode-specific structural validation MUST succeed before an Envelope is appended to accepted history.
Cancellation Authority
The default cancellation authority is the session initiator. Deployments may extend this through policy, but cancellation always requires authentication and authorization.
Terminal races
If multiple terminal messages are sent concurrently, the first one accepted into the session log determines the outcome. Later terminal messages are rejected because the session is no longer OPEN.