Document extension concurrency and ownership

This commit is contained in:
2026-11-26 03:09:32 +00:00
parent fed376351f
commit 753cd2081c
11 changed files with 54 additions and 2 deletions

View File

@@ -96,7 +96,25 @@ Preparation transfers returned values and callbacks to that operation; a shared
module must not store mutable operation state. Own mutable slices/maps that a
callback might modify and respect the existing detached input boundaries.
Optional evidence projections are lazy and only invoked when capture is enabled.
This does not promise thread safety for caller-supplied writers or observers.
The selected extractor instance and its extraction validators are reused across
chunk jobs, so preparation and validation calls can overlap. Registered codecs
are shared and their methods can overlap too. Keep mutable operation state in
the invocation or synchronize retained mutable fields; detached validator views
do not protect receiver state. Parsed source and its shared index are read-only.
Chunk preparation precedes extraction. A lane's merge and normalization run in
order after its extracts, but can overlap other lanes' work; this is not a claim
that every stage method is universally concurrent.
Callbacks and evidence projections belong to their operation. Borrowed source,
references, writers, and other collaborators must not be used after their valid
lifetime. If an extension starts background work, it owns stopping and joining
it before releasing those collaborators: the runner joins dispatched operations,
not arbitrary extension goroutines. Shared callbacks and explicitly supplied
evidence writers must support concurrent calls when used by concurrent jobs.
The [recorder](../../internal/framework/debug/recorder.go) is synchronized;
per-operation wrappers do not serialize a shared external writer. Native client
and observer obligations are owned by the pinned [PromptKit contract](llm.md#native-evidence-and-sensitive-data).
## Validators And Deterministic Work