fix(durable): pi.live version 3 gives a stored run without turns a count of 0

A database an earlier unreleased build wrote at pi.live version 2 has a run
without run.turns; a run in flight across the upgrade then counted NaN turns
and failed its next tool round with "Value contains a non-finite number and
is not strict JSON". Version 3's migrate adds turns: 0 wherever it is
missing.
This commit is contained in:
Mario Zechner 2026-10-28 14:27:53 +00:00
parent 2eb6a8d15f
commit 018fdcf43e
4 changed files with 44 additions and 9 deletions

View file

@ -4617,10 +4617,10 @@ type CompactionStatus = {
| field | value |
|---|---|
| kind | `pi.live` |
| version | `2` |
| version | `3` |
| scope/history/fork | conversation, `latest`, `initial` |
| `initial()` | `{}` |
| `migrate()` | from version 1: `reason` of each `compactions` status and of `compactionFailure` renamed `trigger`, and `run.turns` set to `0` (section 3.6); `run.first`, `run.afterRun`, and `runFailure.first` are optional and need no step |
| `migrate()` | from version 1: `reason` of each `compactions` status and of `compactionFailure` renamed `trigger`; from versions 1 and 2: `run.turns` set to `0` where it is missing (section 3.6); `run.first`, `run.afterRun`, and `runFailure.first` are optional and need no step |
| checkpoint | complete base whenever nothing runs: `generation` absent and no `running` tool or nested slot |
| view mount | `docs["pi.live"]` |
| created | with every Harness conversation (section 2.2) |