Skip to content

reach: a non-array top_logprobs is reported malformed and moves the R4 digest - #80

Merged
githubscum merged 1 commit into
mainfrom
lotor-lane/reach-nonarray-top-logprobs
Oct 26, 2026
Merged

githubscum merged 1 commit into
mainfrom
lotor-lane/reach-nonarray-top-logprobs

Conversation

@githubscum

Copy link
Copy Markdown
Owner

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 whose top_logprobs was present but not an array was skipped by malformedTopLogprobs and canonicalized to [], the same as absent. At 10,000 such entries the malformed list stayed [] and the digest matched a body with no top_logprobs at all.

Change (non-core, src/reach only):

  • undefined / null: still absent, [], not malformed.
  • array: unchanged; digests are byte-identical to main.
  • present but not an array: reported as { entry: i, index: null }; canonicalizes to null, so the digest differs from absent.

Tested: npm test 1296/1296 (main 1292, +4 tests H-K in test/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.model and 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:

  1. Every malformed shape hashes to the same null, so "garbage" swapped for 42 does not move the digest. That matches the existing per-element convention (a malformed element hashes as null), 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.
  2. Treating null as absent is a choice. If Ollama ever sends top_logprobs: null to mean "requested but withheld," that should be a separate signal, not silence. Not observed in the 2026-10-18 measurement.
  3. index: null is a new shape in the malformed list; any consumer that assumes index is a number needs checking. No consumer in the repo reads it today (grep).

…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>
@githubscum
githubscum merged commit 844b066 into main Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant