P340 · Workflow control

Drain Completion before Stopping the Observer

Keep the completion observer alive while its producer finalizes pending work.

Editorially reviewed

These examples and illustrative results are independently authored teaching materials, not measured model results.

Use case

Capture run-a finalizes after stopping; its artifact event can arrive later. Teaching logs also contain old run-b exported. Wait for run-a’s own terminal state without killing observation early or accepting stale evidence.

Mechanism

Stop the owned producer under protocol while retaining observation. Within a deadline filter current-run completion/failure and record artifact identity/state. After result or explicit unresolved timeout, clean owned observation; reconcile disconnect/uncertain outcomes through status rather than duplicate capture.

Bad example

Kill the listener first, stop run-a and accept run-b exported as current completion without run-a evidence/artifact identity.

Good example

Stop teaching run-a while retaining its observer. Await matching run-a exported/failed, ignoring run-b. Record terminal/artifact identity then clean owned observation. Timeout remains unconfirmed with status reconciliation/cleanup handling, not blind restart or completion. Verify current process ownership.

Why the change matters

Producer shutdown can begin export rather than finish it. Observation plus run identity distinguish stop/completion/stale logs and define cleanup timing.

Observable expectation

Stop run-a→run-b exported→run-a exported confirms only the last event. Failed/timeout yield failure/unconfirmed states.

Inspect observer survival and stale-event rejection; receipts do not establish quality.

Limits

Events/shutdown/reconciliation are service-specific; frozen PID/path commands are not current host values. Receipts promise neither durability nor quality, and cleanup targets owned resources only. No real capture is controlled here.

Sources and evidence

Read the editorial criteria