Repository navigation
fix(agents): suppress DeepSeek DSML stream artifacts - #78331
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f92fdb330
ℹ️ 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".
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. at source level: current main appends string Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Keep the compat-gated suppress-only design, but preserve filter state across chunk boundaries, stream safe text promptly, remove unrelated changelog claims, and require real DSML-exercising proof before merge. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main appends string Is this the best way to solve the issue? No. The suppress-only, Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 74e930870e35. |
4f92fdb to
c42a375
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c42a375ede
ℹ️ 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".
c42a375 to
4c42652
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c42652f42
ℹ️ 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".
4c42652 to
e867c7b
Compare
e867c7b to
d5c1352
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5c1352e40
ℹ️ 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".
d5c1352 to
81aa7ba
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81aa7ba68e
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b13734f6a1
ℹ️ 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".
b13734f to
8efb264
Compare
|
@codex review |
💡 Codex Reviewhttps://github.com/openclaw/openclaw/blob/8efb26400607a3149fd9afa2069b67f90b22afb8/src/agents/openai-transport-stream.ts#L1533-L1534 When a DeepSeek stream splits a DSML text span across chunks and the first content chunk also carries native ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
8efb264 to
ca454a8
Compare
ca454a8 to
fb0858e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb0858eb9a
ℹ️ 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".
| if (contentDelta.kind === "text") { | ||
| appendFilteredVisibleTextDelta(contentDelta.text); | ||
| } else if (currentBlock?.type === "toolCall") { |
There was a problem hiding this comment.
Flush DeepSeek text filter before non-content deltas
When a DeepSeek content chunk ends with a possible DSML-open prefix (for example a lone <), appendFilteredVisibleTextDelta can keep that suffix buffered, but the loop immediately proceeds to reasoning/tool_calls handling without flushing the filter first. That reorders output so buffered visible text is emitted after the tool/thinking block (or only at end-of-stream) instead of at its original position, corrupting streamed transcript order for valid non-DSML text. Fresh evidence: a targeted repro with chunks "see <" then native tool_calls produced text("see ") -> toolCall -> text("<") instead of text("see <") -> toolCall.
Useful? React with 👍 / 👎.
|
Landed with maintainer fixups. Thanks @samzong. Proof:
Live/provider notes: native DeepSeek and OpenRouter streams used |
Summary
Describe the problem and fix in 2–5 bullets:
tool_use_error,tool_call,tool_calls, andfunction_callsinsidechoice.delta.content, and the core stream path would otherwise append that text to assistant-visible output.delta.tool_callsis the authoritative function-calling contract.delta.tool_callsand upstreamfinish_reason/stopReasonbehavior.toolCallblocks, does not override stop reasons from DSML text, and does not expand or redesign existing inline-thinking handling.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof (required for external PRs)
External contributors must show after-fix evidence from a real OpenClaw setup. Unit tests, mocks, lint, typechecks, snapshots, and CI are supplemental only. Screenshots are encouraged even for CLI, console, text, or log changes; terminal screenshots and copied live output count.
deepseek:default, secret redacted).pnpm openclaw infer model run --local --model deepseek/deepseek-v4-flash --prompt 'Reply exactly: OPENCLAW_DSML_LIVE_PROOF_OK' --json; pluspnpm test src/agents/deepseek-text-filter.test.ts src/agents/openai-transport-stream.test.ts.{ "ok": true, "capability": "model.run", "transport": "local", "provider": "deepseek", "model": "deepseek-v4-flash", "attempts": [], "outputs": [ { "text": "OPENCLAW_DSML_LIVE_PROOF_OK", "mediaUrl": null } ] }Targeted replay tests additionally pass through the real
processOpenAICompletionsStreamparser and assert DSML does not appear in emitted events while nativedelta.tool_callsstill produces atoolCallblock.delta.tool_callsremains intact; upstreamstopReasonremains mapped fromfinish_reason.mainappends non-emptychoice.delta.contentdirectly to assistant-visible text, so any DSML content delta leaks unchanged.Root Cause (if applicable)
For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write
N/A. If the cause is unclear, writeUnknown.choice.delta.contentstring as visible assistant text, but DeepSeek-compatible streams can include provider-private DSML transport syntax in that same field.delta.tool_callsand provider-private DSML text share the same stream, but onlydelta.tool_callsis a safe executable tool-call contract.Regression Test Plan (if applicable)
For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write
N/A.src/agents/deepseek-text-filter.test.ts;src/agents/openai-transport-stream.test.ts.delta.tool_callsordering and output are preserved.User-visible / Behavior Changes
DeepSeek-compatible provider-private DSML syntax is no longer shown in assistant-visible text. Native tool calls continue to behave as before.
Diagram (if applicable)
Security Impact (required)
Yes/No): NoYes/No): NoYes/No): NoYes/No): NoYes/No): NoYes, explain risk + mitigation: N/ARepro + Verification
Environment
pnpm openclaw infer model run --localdeepseek/deepseek-v4-flashvia configured DeepSeek auth, plus DeepSeek-compatible OpenAI completions stream shape via targeted replaySteps
processOpenAICompletionsStream.delta.tool_callschunk in the same stream.pnpm test src/agents/deepseek-text-filter.test.ts src/agents/openai-transport-stream.test.ts.pnpm openclaw infer model run --local --model deepseek/deepseek-v4-flash --prompt 'Reply exactly: OPENCLAW_DSML_LIVE_PROOF_OK' --json.pnpm check:changed.Expected
delta.tool_callsstill creates a realtoolCallblock.finish_reason/stopReasonbehavior is preserved.Actual
OPENCLAW_DSML_LIVE_PROOF_OKwithok: true,transport: "local",provider: "deepseek", andmodel: "deepseek-v4-flash".pnpm check:changedtouched-surface checks passed; unrelatedtsgofailures reproduce on cleanupstream/mainbecause of@openclaw/fs-safeAPI drift in infra files.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
tool_use_error,tool_call,tool_calls,function_calls, split open tokens, singular close tokens, multiple blocks, and unterminated blocks; nativedelta.tool_callsremains authoritative and visible text ordering is preserved.Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No): YesYes/No): NoYes/No): NoRisks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.delta.tool_callsremains the only executable path.