Skip to content

fix(server): the loop guard looks up </think> only for a guarded reply (17 server tests pass again) - #15

Merged
bertholomus merged 1 commit into
bertholomus:deepseek-v41-tp2from
willjriley:fix/loop-guard-lookup
Oct 17, 2026
Merged

bertholomus merged 1 commit into
bertholomus:deepseek-v41-tp2from
willjriley:fix/loop-guard-lookup

Conversation

@willjriley

Copy link
Copy Markdown

_think_loop calls self.tok.token_to_id("</think>") before it checks whether the guard is on, so every request makes
that call, even with the guard off (the default). The server tests' TextTokenizer has no token_to_id, so every
request in tests/test_cuda_server_disconnect.py now fails before it reaches the engine, and 17 tests time out waiting
for it (PacedEngine.held).

Fix: look </think> up only after the on / thinking / grammar / budget checks pass. A guarded reply builds the
same close sequence as before; a reply without the guard no longer touches the tokenizer.

on 8b1fe21 before after
tests/test_cuda_server_disconnect.py 17 failed, 1 skipped 17 passed, 1 skipped
tests/test_cuda_server*.py 231 passed, 2 skipped

src/tensorfold/cuda/server.py +4/-2.

Prepared with Claude Code.

_think_loop asked the tokenizer for </think> before checking whether the guard is on. With the guard off (the
default) every request still made that call, and a tokenizer without token_to_id (the server tests' TextTokenizer)
failed every request before it reached the engine: 17 tests in tests/test_cuda_server_disconnect.py. The lookup now
follows the on / thinking / grammar / budget checks; a guarded reply builds the same close sequence as before.
@bertholomus
bertholomus merged commit f6f4690 into bertholomus:deepseek-v41-tp2 Oct 17, 2026
@bertholomus

Copy link
Copy Markdown
Owner

Thank you @willjriley, merged. With it the server tests pass again on a CPU-only host (232 passed, none failed, where the branch had 141 failing), and a guarded reply still gets the same loop guard.

bertholomus added a commit that referenced this pull request Oct 24, 2026
….7.1)

The README's fork note: v0.7.0's nine changes on the four-node branch's v0.3.1, then v0.7.1's seven (the shared DSML
reader and the streamed-prose fix with #25's tests, TF_DS_PROMPT_ALIAS, the stopped-rank watch, the GPU-context
stop, #14 and the test addresses), the merge of the four-node branch's v0.3.2 and the fix that keeps cache_salt on
compaction notes; the two-node recipe's pool of 2,097,152 positions and its v0.7.1. NOTICE names v0.3.2's cache_salt
and the DSML reader with their tests among the new files and compact_test.zig among the changed ones, and
ATTRIBUTION.md's #25 row names the two commits that carry #25's tests. ATTRIBUTION.md adds two reports, @den13501's
(two-node recipe issue #15: the kit rebuild's mapping error, which #14 fixes) and @plyldavid-maker's (issue #25: the
ranks that waited on each other), and says what the export changed in v0.7.1's messages.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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