Skip to main content

Module provider_end

Module provider_end 

Source
Expand description

The end of a provider session (SPEC_HISTORY_COMPACT_FORM_ONLY_2026_11_23.md section 5.2 to 5.4): prove that the store holds what the provider’s files hold, import what it does not, and only then remove the files, by session id.

Nothing here decides when a session ends or which ids AgentMux started; the caller passes one session’s files. The proof is super::provider’s: a file’s records matched against the store’s, in order. What does not match is written to the zone as it is (import/<session>/<file>), a provider file that is not line records (a spill file) is imported whole, and the fields a matched record has that the store’s line lacks go to output.provider. After the import the written data is read back and compared; a file is removed only when every record and every file of the session is matched or read back equal. A failure removes nothing and reports counts only.

Structs§

FsZone
One zone of a FileStore.
Outcome
What the end of a session did, in counts.
ProofCounts
What the proof alone found in one session. Nothing is written, imported or removed.
SessionFiles
One session’s files under a project folder: <sid>.jsonl and the <sid>/ folder beside it.

Constants§

SIDECAR_FILE
The file in a zone that keeps what the provider’s matched records carry beyond the store’s lines.

Traits§

Hold
What the caller holds across the removal (an agent’s lease): the removal asks before each file whether it is still held, and stops when it is not.
Zone
A zone of the store, as the proof and the import use it.

Functions§

end_session
Prove, import, verify and remove one session’s files. before_remove runs after the verify and before any file is touched: an Err stops with nothing removed, and what it returns is kept until the removal is done and asked before each file whether it is still held. erase is called for each file after it is overwritten and before it is unlinked (a test’s hook; pass a no-op otherwise). Nothing is removed unless every record and file is matched or read back equal; an Err has removed nothing.
fingerprint
What every file of the session holds right now, in order: its name inside the session, its size and its SHA-256. A copy of a session is the same session when its fingerprint is equal (the container path compares the staged copy with what the container holds before it removes anything there). A link or a special file is an error.
index_store
The store’s items for a session, read from each zone’s output in turn (the oldest conversation first, so the order the proof matches in is the order the conversation was written in).
measure
How many files a session holds and their bytes, read from the folder alone (no file is opened).
newest_modified_ms
When anything the session holds was last written, as ms since the epoch: the newest of its session file and every file under its folder. None when it has no file.
prove_session
The proof of end_session and nothing after it: the same reads, the same match, no write. An Err is a session whose proof could not be made.
valid_sid
A session id that names a file safely: letters, digits, - and _, and no longer than a path part needs.