喜欢一个人 on Discord (v0.1.1299, macOS arm64, a Responses client
translated to Chat, deepseek-v4.1-flash through a relay, 232312 in /
645 out, stop "stop"): the client got the text "\n</||DSML|| calls>"
and the agent loop ended mid-turn. Their history has ||DSML|| calls>
712 times against 133 <||DSML||invoke.
Reproduced on origin/main 9b0f48612 (v0.1.1316+1) with those bytes. A
whole block of invokes closed with </||DSML|| calls> was already the
call on every route (the junk regex takes any DSML tag; 7ea8aeaba and
d0c587aee). What leaked was the close with no block before it in the
text:
- after a call the upstream made itself (a relay that made the calls of
DeepSeek's invokes and left the wrapper's close as text):
textCallSee and textCallTidy stopped reading text once a native call
came, and wholeTextCalls left such a message alone, so the close went
to the client on every route, the Responses translation the reporter
uses included (a final_answer message after the function_call);
- with no call: textCallAt found only DSML opens (dsmlMark closing
false), so a lone close was never held and went out as text.
Now textCallAt finds a DSML close as it finds an open, and held text
that is tags and nothing else goes, with the spaces before it after a
native call (spaceBack, settled). No call is read out of a native
reply's text; text that isn't only tags goes on as it came (prose about
</|DSML|invoke> keeps it).
Not rewritten by magpie: nothing in magpie turns tool_calls into
" calls". The only Go source with | is textcalls.go; redact's Writer
restores only {{KIND_xxxxxxxx}} placeholders, and #3143 (88119d4f6,
10-21) changed masking of the request, not reply text. The reporter's
earliest is 10-13, and OKURBITO's capture on #2623 (10-17, workbuddy
deepseek-flash, observedPipes) already has <||DSML|| calls> as the
model wrote it: DeepSeek's own spelling.
Tests (textcalls_close_test.go), from the reporter's bytes:
- TestDSMLCloseLeftAfterCalls: a native call, then "\n</||DSML|| calls>"
cut at every valid byte, with no opener, <||DSML|| calls> or
<||DSML||tool_calls> before the call; Chat stream, Chat whole,
Responses stream and whole, Anthropic stream and whole.
- TestDSMLCloseAlone: "Done.\n</||DSML|| calls>" with no call, every cut,
Chat stream and whole, Responses both; prose with a close kept.
- TestDSMLBlockClosedWithCalls: the full invoke/parameter block closed
with " calls>", opened three ways, every cut on Chat, every 5th on
Responses stream and whole. Green on the old code too (a guard).
Red on the old code: TestDSMLCloseLeftAfterCalls and TestDSMLCloseAlone
FAIL with origin/main's textcalls.go. Broken by hand, each red alone:
textCallSee.settle without settled (responses stream=true keeps the
close), wholeTextCalls' native branch off (chat whole keeps it),
textCallAt back to opens only (chat stream and alone keep it).
Docs: gateway-routing.md's text-calls entry.
Run at the tree pushed (go test -timeout 45m ./... in a sandbox HOME at
308f693df, tree cfd91bbea, on origin/main c358e7660; only messages
changed since): 68 packages ok, exit 0. The one red at an earlier run
(770c5fc48), TestGeminiCompatRelayEndedShort, is answered in the finish
commit. gofmt -l clean; go vet ./internal/gateway for darwin, linux
-tags nogui and windows clean.
Not tried: a real relay or the reporter's client; the bytes are the
reporter's, from their usage row and client history. A close spelled
another way than DeepSeek's DSML marks is not covered.
Reported by 喜欢一个人 on Discord.