Repository navigation
reach: a non-array top_logprobs is reported malformed and moves the R4 digest - #80
Merged
Merged
Conversation
…igest
A logprobs entry whose top_logprobs was present but not an array (string,
number, boolean, object) was neither listed in malformedTopLogprobs nor
distinguished in the R4 digest: it hashed exactly like an absent field.
It now reports { entry, index: null } and canonicalizes to null instead of
[]. Absent and null stay []; array inputs hash byte-identically to before.
Executor: glm-5.3-flash:cloud (lane run 65), verified by the orchestrator.
Co-Authored-By: Claude Opus 5.5 <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.
WO: WO-REACH-TOPLP (lane run 65). Follows the side find logged in lane run 61 while pricing R4 storage against #75.
Spec section: Lotor v3, R4 (V3-05 logprob capture). R4 is recorded digest-only, so the digest is the only witness of what the logprobs said. A shape change that leaves the digest unmoved is a blind spot in the trace.
Defect: in
src/reach/index.js, a logprobs entry whosetop_logprobswas present but not an array was skipped bymalformedTopLogprobsand canonicalized to[], the same as absent. At 10,000 such entries the malformed list stayed[]and the digest matched a body with notop_logprobsat all.Change (non-core,
src/reachonly):undefined/null: still absent,[], not malformed.{ entry: i, index: null }; canonicalizes tonull, so the digest differs from absent.Tested:
npm test1296/1296 (main 1292, +4 tests H-K intest/reach-observe.test.js). Fail-first: with the source change stashed, 3 of the 4 new tests fail (J, the null-is-absent case, passes on both, as intended). Variant probe over absent / null / [] / "garbage" / 42 / false / {a:1} / "" behaves as specified. Executor glm-5.3-flash:cloud,session.modeland touched paths read on the chain (receiptSeq 39908: these two files only). The executor could not run tests under acceptEdits; the orchestrator ran them.Eval served: E2 (chain fidelity: changing an R4 entry's top_logprobs from absent to a non-array value now moves the digest). No eval number moves; this closes a hole the eval would not catch.
What a reviewer should doubt:
null, so"garbage"swapped for42does not move the digest. That matches the existing per-element convention (a malformed element hashes asnull), but it means the digest witnesses that the field was malformed, not what it held. Hashing the JSON type plus value would close it at the cost of storing a derived shape of possibly sensitive text in the hash input (it is still only hashed). Isaac's call.nullas absent is a choice. If Ollama ever sendstop_logprobs: nullto mean "requested but withheld," that should be a separate signal, not silence. Not observed in the 2026-10-18 measurement.index: nullis a new shape in the malformed list; any consumer that assumesindexis a number needs checking. No consumer in the repo reads it today (grep).