Training is a spawned supervisor worker task. Image reads, record validation, extraction, and adaptation never run in the Qt GUI event loop. The supervisor owns cancellation and a bounded shared-memory progress channel; the worker is the only progress writer, and the UI only renders authenticated protocol records.
Live stages
| Stage | Meaning | Progress unit |
|---|---|---|
manifest | Open and parse the explicit training plan. | Indeterminate until budgets are known. |
recipe | Validate feature binding against the attachment and Monk policy. | One contract step. |
records | Exact-read records/evidence, enforce owner and byte limits, verify SHA-256, preflight extraction. | One step per record. |
training | Evaluate, bind feedback, and build the next in-memory head proposal. | One step per record per epoch. |
finalizing | Build candidate and audit fingerprints. | Non-cancellable final snapshot. |
complete | Proposal and ledger are ready for review. | Total reached. |
Cancellation
The worker checks the supervisor-owned cancellation flag before every corpus record and every adaptation step. Acknowledged cancellation returns a typed cancelled result with the completed-step count. The current attachment and VFS bytes were never mutated, so discarding the local candidate is the rollback.
Thread and process discipline
- The GUI thread performs presentation and protocol dispatch only.
- The supervisor uses a spawn-based process pool, avoiding inherited GUI state.
- A lock protects task-control lifecycle in the supervisor.
- A sequence-locked shared-memory snapshot prevents the UI from observing a partially written status record.
- Progress messages are bounded and contain no corpus payload.
Fast jobs may expose only a subset of intermediate snapshots because the channel intentionally carries the latest truthful state, not an unbounded event queue. The final training ledger remains complete.