Skip to content

fix: DSML token leakage in DeepSeek-V4 and 3.2#1647

Merged
AlpinDale merged 1 commit into
mainfrom
fix/dsv4_stream
Apr 27, 2026
Merged

fix: DSML token leakage in DeepSeek-V4 and 3.2#1647
AlpinDale merged 1 commit into
mainfrom
fix/dsv4_stream

Conversation

@AlpinDale

Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: AlpinDale <alpindale@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e113d544f4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +255 to +257
if self.tool_call_start_token not in current_text:
overlap = partial_tag_overlap(current_text, self.tool_call_start_token)
sendable_idx = len(current_text) - overlap

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Emit held-back suffix when no tool-call block is found

When current_text has no full start marker, this code withholds any suffix overlapping <|DSML|function_calls> (including a trailing <). In streams that never enter a tool-call block, that buffered suffix is never flushed at EOS because the only EOS fallback is gated on self.prev_tool_call_arr, so plain-text responses can lose their final characters.

Useful? React with 👍 / 👎.


# Inside tool-call region: emit any newly completed invokes.
content = self._extract_content(current_text)
delta_tool_calls = self._extract_delta_tool_calls(current_text, request)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Gate invoke parsing on the function_calls start marker

This now parses <|DSML|invoke ...</|DSML|invoke> blocks unconditionally on every chunk, even before <|DSML|function_calls> has been seen. If the model outputs DSML invoke syntax as normal text (for example, showing an example call), it will be emitted as real tool_calls, which can trigger unintended tool handling; the previous logic avoided this by waiting until the start marker was detected.

Useful? React with 👍 / 👎.

@AlpinDale AlpinDale merged commit 8556a53 into main Apr 27, 2026
1 check passed
@AlpinDale AlpinDale deleted the fix/dsv4_stream branch April 27, 2026 07:55
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