@byollm/relay 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,9 @@
1
- <!-- release-note 0.1.5 -->
2
- > **`0.1.5` carries site tools and images — update the relay first.**
3
- > `PROTOCOL_VERSION` is still `2`. The relay gains the four tool endpoints
4
- > (byollm_012) and the blob routes, against a `BlobStore` its host supplies
5
- > (byollm_021). Run it before any daemon or site that turns a new kind on: a
6
- > 0.1.4 relay refuses a heartbeat that advertises one. Full note:
7
- > `docs/release-notes/0.1.5.md`.
1
+ <!-- release-note 0.1.7 -->
2
+ > **`0.1.7`: nothing in this package changed.** It moves in lockstep with
3
+ > the daemon, whose three fixes are in the note. `PROTOCOL_VERSION` is still
4
+ > `2`. Coming from 0.1.4, update the relay before any daemon or site that
5
+ > turns on a 0.1.5 kind, and give it a `BlobStore`:
6
+ > `docs/release-notes/0.1.5.md`. Full note: `docs/release-notes/0.1.7.md`.
8
7
  >
9
8
  > This README used to open with a stack of release notes instead of with the
10
9
  > package. The history moved to `docs/release-notes/` and `CHANGELOG.md`,
@@ -139,7 +138,7 @@ What the package decides, whatever the store:
139
138
  - **Sizes are read, not trusted.** A slot's size is in the blob id the relay
140
139
  mints. A job is queued only if every input it was issued a slot for is
141
140
  stored at that size, and an `ok` result is accepted only if its outputs
142
- are.
141
+ are, with the one limit below.
143
142
  - **Blobs go with the job.** Inputs when the result is accepted; outputs when
144
143
  the site says it holds them, or an hour after it collected the result; and
145
144
  whatever is left a day after the job's deadline. `Relay.sweep()` runs the
@@ -150,6 +149,28 @@ What the package decides, whatever the store:
150
149
  result and an hour after collection, need the record: keep the ledger
151
150
  somewhere that survives a restart if you want them kept across one.
152
151
 
152
+ ### A limit: keep the ledger with the leases
153
+
154
+ `RelayBlobs.outputFault` checks the output slots it finds in the ledger under
155
+ the job's lease. Unlike `inputFault`, it does not rebuild lost slots from the
156
+ store. So if the ledger loses its records while the lease survives, an `ok`
157
+ `llm.image` result is accepted without its outputs' sizes being checked. That
158
+ happens with a `MemoryBlobLedger` behind a durable or shared `RoutingStore`,
159
+ or with a ledger and a routing store in different Valkeys.
160
+
161
+ What still protects the site:
162
+
163
+ - `downloadUrl` refuses any object whose stored size is not the size in its
164
+ id, so the site gets a 404, not a wrong image.
165
+ - A store that enforces the signed length, such as GCS, cannot hold a
166
+ wrong-size object at all.
167
+
168
+ What to do about it: keep the `BlobLedger` and the leases in the same store,
169
+ as the hosted hub does. Then whatever loses the ledger loses the lease too,
170
+ and the result is refused before `outputFault` runs. The fix is to put the
171
+ lease in the object name the next time the blob path changes (byollm_021,
172
+ decision #8559).
173
+
153
174
  ## Breaking before `0.1.0`: `RelayState` is async
154
175
 
155
176
  Every method on `RelayState` now returns a `Promise`, and `Relay.sweep()` and
package/dist/index.js CHANGED
@@ -1248,6 +1248,15 @@ var RelayBlobs = class {
1248
1248
  /**
1249
1249
  * Why an `ok` result may not be accepted, or `null` when it may — the
1250
1250
  * same check an input gets, on the outputs issued under this lease.
1251
+ *
1252
+ * Unlike `inputFault`, a lost record is not rebuilt from the store,
1253
+ * so a ledger that forgot this job while its lease survived accepts the
1254
+ * result unchecked. That is a documented limit (README, "A limit: keep the
1255
+ * ledger with the leases"; decision #8559). Copying `inputFault`'s rebuild
1256
+ * here would not close it: the object name carries no lease, so the
1257
+ * rebuilt slots have none, and the loop below skips every slot whose lease
1258
+ * is not this job's. The fix is the lease in the object name, at the next
1259
+ * change to the blob path (byollm_021).
1251
1260
  */
1252
1261
  async outputFault(job) {
1253
1262
  const record = await this.#ledger.record(job.siteId, job.jobId);