Skip to content

Server: retain a full SHA-256 of accepted reply token IDs - #862

Merged
ashhart merged 1 commit into
ashhart:mainfrom
jayleaton:shared/token-sha256
Oct 16, 2026
Merged

ashhart merged 1 commit into
ashhart:mainfrom
jayleaton:shared/token-sha256

Conversation

@jayleaton

Copy link
Copy Markdown
Contributor

What this changes

Expose the full SHA-256 of accepted native reply token IDs as tensorfold.token_sha256. The existing 12-hex token_sha fingerprint stays unchanged; clients can now retain a full digest for drafted/plain, resumed/fresh and concurrent/solo receipts.

Illustrative wire change:

 tensorfold.token_sha:    12 hex characters
+tensorfold.token_sha256: 64 hex characters

Both fields hash decimal token IDs joined by commas, with no trailing comma. The shared generation path supplies the field for ordinary replies and final streaming metadata. The frozen Python corpus stays unchanged; its comparison validates the full native digest's shape and short-prefix agreement before comparing the existing fields.

Receipt

  • Environment: Linux CPU host, Zig 0.17.0; candidate c734dd076296cd5e42d47ebbcb5954cf02a46194, base c7137bb31a7dad924fb541a7068422127b9a94b2. No GPU or checkpoint used.
  • Exactness: a known ID sequence and the empty sequence match independently computed SHA-256 values; distinct ID sequences stay distinct, and the short fingerprint is the full digest's first 12 hex characters. Frozen HTTP goldens: 309/319 equal, 10 inherited known differences, zero unexpected differences.
  • Decode speed before and after: n/a; this changes reply metadata without model arithmetic or scheduling.
  • Prompt speed before and after: n/a; the digest is computed from accepted reply IDs after generation.
  • Tests run: final committed-tree checks below. Targets using Zig's cache do not imply fresh execution of every unit. The initial uncached host run recorded 744 passed and 5 skipped.
Gresume-token-sha-committed: commit c734dd076296cd5e42d47ebbcb5954cf02a46194 tree 8594c57a8a7a4abe907fc829a8b6adcbba6c00e7 dirty 0 2026-10-15T01:22:36Z
install rc=0 Build Summary: 10/10 steps succeeded
test rc=0 Build Summary: 46/46 steps succeeded
test-golden rc=0 Build Summary: 4/4 steps succeeded
fuzz-cortheon rc=0 Build Summary: 3/3 steps succeeded
test-cuda-host rc=0 Build Summary: 27/27 steps succeeded
test-server-cpu rc=0 Build Summary: 3/3 steps succeeded
zig fmt --check rc=0 0 files
git diff --check rc=0
c734dd07 lean: 527 problems, 527 on the base, 0 new
FAILED STEPS 0
  • Not run: served CUDA/Metal/checkpoint exactness and performance; host wire tests do not qualify a device. Before: native metadata supplied only the 12-hex fingerprint. After: native goldens include and validate the additive full digest, while preserving every frozen legacy comparison.

Merge Danger — Door: two-way. Blast Radius: server. Reverting removes the additive field. Strict consumers that reject extra metadata keys must adapt. The frozen comparator checks digest shape/prefix agreement, while the independent known-vector test checks the full digest value.

Checklist

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.
  • No precision traded for speed. If the bits change, the description says which sums change and why.
  • Prompt processing is no slower than the last release.
  • The description says which platforms I ran, Metal M1 to M5 and CUDA, and which I could not.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths. No AI attribution lines.

@ashhart

ashhart commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Thanks, @jayleaton. Ready at c734dd0. zig/src/server/tokens.zig:101 retains the existing comma-separated decimal token encoding, returns the complete SHA-256, and preserves the old 12-character fingerprint as its prefix. Both fields come from the same accepted-token slice. No new correctness or lifetime issue found in the source review; tests were not rerun here.

@ashhart
ashhart merged commit 8c120a8 into ashhart:main Oct 16, 2026
4 checks passed
ashhart added a commit that referenced this pull request Oct 16, 2026
Layout only, by zig fmt after closing commas.
ashhart added a commit that referenced this pull request Oct 16, 2026
ashhart added a commit that referenced this pull request Oct 16, 2026
…rry one

reuse_served read the reply's 12-character token_sha, and two missing digests compared equal. It now reads
token_sha256, keeps it only when it is 64 hex digits, and fails a reply when either arm has none. A resumed reply
that is no sooner than the fresh one is listed on its own timing line instead of failing the equality check.
#890's auth fixtures answer with a full token_sha256 beside their short fingerprint, as the server does, so the
clients' #862/#863 digest checks see a valid reply.
@ashhart

ashhart commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Thank you, @jayleaton. The full token SHA-256 beside the short fingerprint means two replies can be called equal without trusting a 12-character prefix, and keeping the short field as the full digest's first 12 characters keeps every old receipt comparable.

Your commit ships in TensorFold 1.0.12 as it is, merged in 8c120a82b, so this pull request shows as merged. One commit of ours, 5ad1019e0, wraps the two new test lines at 120 columns. The server tests pass on macOS and Linux, and the golden suite's replies are unchanged.

Posted by Ash's AI Assistant Synthena

BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
Layout only, by zig fmt after closing commas.
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
…rry one

reuse_served read the reply's 12-character token_sha, and two missing digests compared equal. It now reads
token_sha256, keeps it only when it is 64 hex digits, and fails a reply when either arm has none. A resumed reply
that is no sooner than the fresh one is listed on its own timing line instead of failing the equality check.
ashhart#890's auth fixtures answer with a full token_sha256 beside their short fingerprint, as the server does, so the
clients' ashhart#862/ashhart#863 digest checks see a valid reply.
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.

2 participants