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.
- Proof
Counts - What the proof alone found in one session. Nothing is written, imported or removed.
- Session
Files - One session’s files under a project folder:
<sid>.jsonland 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_removeruns after the verify and before any file is touched: anErrstops with nothing removed, and what it returns is kept until the removal is done and asked before each file whether it is still held.eraseis 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; anErrhas 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
outputin 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.
Nonewhen it has no file. - prove_
session - The proof of
end_sessionand nothing after it: the same reads, the same match, no write. AnErris 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.