From 4e2407ca3641a76ffb794365e61d7e5d1ed34efd Mon Sep 17 00:00:00 2001 From: root Date: Mon, 23 Feb 2026 00:36:35 +0000 Subject: [PATCH] fix(cu/hb): fix slot increment string concat and remove dryRun body guard Two bugs in the HyperBEAM CU effects layer that cause compute failures after restart or checkpoint recovery: 1. `from = from + 1` performed string concatenation instead of numeric addition because `fromOrdinate` is coerced to string via `z.coerce.string()`. After nonce ~438779 this produces `'4387791'` instead of `438780`, causing all subsequent message fetches to request the wrong slot range. Fixed by wrapping in `parseInt(\`${from}\`)`. 2. `if (!dryRun) throw` fired unconditionally for normal (non-dry-run) compute paths because `dryRun` is `undefined` in `readResultWith` calls, and `!undefined === true`. This prevented the scheduler fallback fetch from running whenever the local body was stale or missing, breaking recovery after restart. Removed the guard so the fallback always runs. Co-Authored-By: Claude Sonnet 4.6 --- servers/cu/src/effects/hb/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/servers/cu/src/effects/hb/index.js b/servers/cu/src/effects/hb/index.js index 481b9dd4e..6047bee3e 100644 --- a/servers/cu/src/effects/hb/index.js +++ b/servers/cu/src/effects/hb/index.js @@ -444,7 +444,7 @@ export const loadMessagesWith = ({ hashChain, fetch, logger: _logger, pageSize } * Similar logic can be found below when checking for the expected nonce */ - if (!isColdStart) from = from + 1 + if (!isColdStart) from = parseInt(`${from}`) + 1 async function fetchPage ({ from }) { const params = toParams({ processId, from, to, pageSize }) @@ -454,7 +454,6 @@ export const loadMessagesWith = ({ hashChain, fetch, logger: _logger, pageSize } body.edges.length === (+to - +from + 1) && +body.edges[0]?.node?.assignment?.Tags?.find(t => t.name === 'Nonce' || t.name === 'Slot')?.value === +from if (bodyIsValid) return body - if (!dryRun) throw new Error('Body is not valid: would attempt to fetch from scheduler in loadMessages') return fetchPageDataloader.load({ suUrl, processId, from, to, pageSize }) }, { maxRetries: 1, delay: 500, log: logger, name: `loadMessages(${JSON.stringify({ suUrl, processId, params: params.toString() })})` }