oc_chat
Loading...
Searching...
No Matches
oc_chat.registry.auth.handover Namespace Reference

Functions

OperationLogRow initiate_handover (Registry registry, *, str from_slot, str to_slot, str reason, str|None actor_slot=None, str actor_type="orchestrator_agent", str|None command=None)
OperationLogRow accept_handover (Registry registry, *, int handover_id, str actor_slot, str actor_type="orchestrator_agent", str|None command=None)
Mapping[str, object]|None _handover_start (Registry registry, int handover_id)

Detailed Description

Orchestrator handover state machine.

Purpose
-------
Provide the M11.5 audited handover operations that prevent two
orchestrators from writing round state at the same time.

Responsibilities
----------------
- Emit ``role.handover.start`` and ``role.handover.complete`` operations.
- Recover the start payload needed by accept calls.
- Keep durable state projection inside the SQLite backend.

Diagnostics
-----------
Domain: OC_CHAT.MAIN
Levels:
    L2 - lifecycle events
    L3 - semantic details
    L4 - deep tracing

Contracts
---------
- ``role.handover.start`` enters the requested/draining state.
- ``role.handover.complete`` makes the incoming orchestrator the holder.
- Round writes are rejected unless the durable state permits the actor.

Dependencies
------------
- json (decode the stored handover-start arguments)
- oc_chat.registry.api (Registry that executes the handover domain commands)
- oc_chat.registry.errors (HandoverStateError for an unknown handover)
- oc_chat.registry.backends.base (OperationLogRow returned by both operations)
- oc_diagnostics (structured debug logging via _dbg)

Function Documentation

◆ _handover_start()

Mapping[str, object] | None oc_chat.registry.auth.handover._handover_start ( Registry registry,
int handover_id )
protected

Definition at line 121 of file handover.py.

Here is the caller graph for this function:

◆ accept_handover()

OperationLogRow oc_chat.registry.auth.handover.accept_handover ( Registry registry,
* ,
int handover_id,
str actor_slot,
str actor_type = "orchestrator_agent",
str | None command = None )
Emit a handover-complete operation for ``handover_id``.

Definition at line 83 of file handover.py.

Here is the call graph for this function:

◆ initiate_handover()

OperationLogRow oc_chat.registry.auth.handover.initiate_handover ( Registry registry,
* ,
str from_slot,
str to_slot,
str reason,
str | None actor_slot = None,
str actor_type = "orchestrator_agent",
str | None command = None )
Emit a handover-start operation.

Definition at line 57 of file handover.py.