Skip to main content

Module chat_worker

Module chat_worker 

Source
Expand description

Independent conversation execution, publication fencing and restart recovery.

These workers belong to persisted conversations. They retain their executable, turn lease and submission reservation across web and scheduler restarts.

Functions§

drain_turns
Run the talk’s turns under lease until no draft is owed.
publication_guard
Serialize queue/record -> worker acknowledgement against a drainer’s generation scan + promotion. Never hold this fence across an agent call.
run_turn_worker
Hidden worker entry point. The original talk/session and cross-process lease stay authoritative even when an older worker is still responding.
spawn_recorded_turn
Continue an operator turn already persisted by the HTTP admission path. Reserve this job before releasing the caller’s turn lease.
spawn_turn
Reserve and launch a detached drainer for an explicitly submitted draft.
try_publication_guard
Try the short cross-process draft-publication fence for one talk.
turn_worker_active
Includes startup reservations, before the child acquires the turn lease.