fix(cu/hb): fix slot increment string concat and remove dryRun body guard#1295
Open
atticusofsparta wants to merge 1 commit intopermaweb:feat/hb-unitfrom
Open
fix(cu/hb): fix slot increment string concat and remove dryRun body guard#1295atticusofsparta wants to merge 1 commit intopermaweb:feat/hb-unitfrom
atticusofsparta wants to merge 1 commit intopermaweb:feat/hb-unitfrom
Conversation
…uard
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 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two bugs in
servers/cu/src/effects/hb/index.jsthat cause compute failures after restart or checkpoint recovery when running as a HyperBEAM CU:String concatenation in slot increment:
from = from + 1performs string concatenation instead of numeric addition becausefromOrdinateis coerced to a string viaz.coerce.string(). After nonce ~438779 this produces'4387791'instead of438780, causing all subsequent message fetches to request the wrong slot range and stalling compute indefinitely. Fixed withparseInt(\${from}`) + 1` (matching the pattern already used on line 536).dryRunguard throws unconditionally on normal compute paths:if (!dryRun) throwfired for all non-dry-run calls becausedryRunisundefined(notfalse) inreadResultWith— 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 tofetchPageDataloader.load()always runs when the body is invalid.Test plan
loadMessagesWithcovering string-typedfromvalues and undefineddryRun🤖 Generated with Claude Code