Skip to content

fix: enable DeepSeek DSML filtering for proxy providers via model id detection - #91549

Closed
studentzhou-svg wants to merge 1 commit into
openclaw:mainfrom
studentzhou-svg:fix/dsml-card-loop-flood
Closed

studentzhou-svg wants to merge 1 commit into
openclaw:mainfrom
studentzhou-svg:fix/dsml-card-loop-flood

Conversation

@studentzhou-svg

Copy link
Copy Markdown

Root Cause

DSML filtering was gated on compat.thinkingFormat === "deepseek", which resolves only for native deepseek endpoint (api.deepseek.com) or providers with provider key "deepseek". When DeepSeek models are served through proxy providers like SiliconFlow, the endpoint class falls back to "custom" and the filter is never created.

Impact

This causes <|DSML|function_calls> markup to leak into visible text, which triggers Feishu streaming-card re-render events that create a feedback loop — resulting in explosive duplicate messages.

Fix

One-line change to shouldFilterDeepSeekDsmlText: fall back to checking whether the model id contains "deepseek" when endpoint-based detection fails. This is a defense-in-depth measure that catches any proxy-hosted DeepSeek models.

Reproduce

  1. Configure a proxy provider (e.g. SiliconFlow) with a deepseek-ai/DeepSeek-V4-* model
  2. Send a message via Feishu channel
  3. When the model emits DSML markup, observe explosive duplicate messages

Verification

Before: thinkingFormat === "deepseek" → false for proxy providers → DSML unfiltered → card re-render → feedback loop
After: thinkingFormat === "deepseek" || modelId?.includes("deepseek") → true → DSML stripped → clean text → no loop

…detection

DSML filtering was gated on thinkingFormat === "deepseek", which
resolves only for native deepseek endpoint (api.deepseek.com) or
providers with provider key "deepseek". When DeepSeek models are
served through proxy providers like SiliconFlow, the endpoint class
falls back to "custom" and the filter is never created.

This causes DSML markup to leak into visible text, which triggers
Feishu streaming-card re-render events that create a feedback loop
— resulting in explosive duplicate messages.

Fixes by also enabling the filter when the model id contains
"deepseek" as a defense-in-depth measure.
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 9, 2026
@clawsweeper

clawsweeper Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 30, 2026, 4:18 PM ET / 20:18 UTC.

Summary
The branch changes src/agents/openai-transport-stream.ts so DeepSeek DSML filtering and recovery also run when the model id contains deepseek.

PR surface: Source +3. Total +3 across 1 file.

Reproducibility: yes. for the source-level bug: current main only enables DSML filtering/recovery when resolved compat is deepseek, so a custom/proxy DeepSeek model with default non-DeepSeek compat will leak DSML text. I did not reproduce the reported Feishu feedback loop live.

Review metrics: 1 noteworthy metric.

  • New provider-detection heuristic: 1 fallback predicate added. The predicate decides whether streamed assistant text is stripped or recovered into DSML tool calls across provider routes.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🧂 unranked krab
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted real proxy-provider plus Feishu proof showing DSML is stripped and duplicate streaming-card messages stop.
  • [P1] Revise the predicate to honor explicit non-DeepSeek compat, normalize model ids, and add focused regression coverage.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body contains expected before/after reasoning but no redacted logs, terminal output, screenshots, recordings, or linked artifacts from a real proxy-provider plus Feishu run. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Proof path suggestion
A visible Feishu/proxy run would materially help prove the reported duplicate streaming-card behavior is fixed, and no dedicated Feishu lane exists. Mantis is currently scoped to Telegram, Discord, and web UI chat proof, so it is not the right proof path for this surface.
Use maintainer screenshot/manual proof, browser or Playwright proof, Crabbox where appropriate, or normal local artifact proof instead.

Risk before merge

  • [P2] The fallback can bypass explicit non-DeepSeek compat.thinkingFormat, changing visible text stripping and DSML tool-call recovery on routes that intentionally selected another compatibility dialect.
  • [P1] The raw substring check is case-sensitive and broader than adjacent normalized DeepSeek V4 handling, so it can both miss valid proxy ids and affect unrelated ids containing the same word.
  • [P1] The PR still has no redacted real proxy-provider plus Feishu proof showing DSML text is stripped and duplicate streaming-card messages stop.
  • [P1] Broadening DSML recovery by model-id substring can convert provider text into tool-call blocks outside the intended DeepSeek compatibility contract.

Maintainer options:

  1. Fix The Predicate And Prove The Route (recommended)
    Honor explicit non-DeepSeek compatibility, normalize model ids before matching, add regression coverage, and require redacted Feishu/proxy evidence before merge.
  2. Accept The Broad Heuristic Deliberately
    Maintainers could intentionally accept substring-based DSML filtering across provider routes, but should first confirm the compatibility, message-delivery, and tool-call recovery behavior is intended.
  3. Pause For Contributor Proof
    If the contributor cannot show the real Feishu/proxy behavior after the patch, keep the PR paused rather than replacing that environment proof with automation.

Next step before merge

  • [P1] Contributor or maintainer follow-up is needed because the missing real environment proof cannot be supplied by automation and the predicate changes compatibility and tool-call recovery behavior.

Security
Needs attention: The diff adds no dependency or supply-chain surface, but the widened DSML predicate can broaden text-to-tool-call recovery beyond the intended compatibility boundary.

Review findings

  • [P1] Respect explicit non-DeepSeek compat before id fallback — src/agents/openai-transport-stream.ts:3081
  • [P2] Normalize the model id before matching DeepSeek — src/agents/openai-transport-stream.ts:3081
Review details

Best possible solution:

Use a normalized DSML enablement predicate that preserves explicit non-DeepSeek compatibility overrides, add focused proxy-id and override coverage, and require redacted proxy-provider plus Feishu evidence before merge.

Do we have a high-confidence way to reproduce the issue?

Yes for the source-level bug: current main only enables DSML filtering/recovery when resolved compat is deepseek, so a custom/proxy DeepSeek model with default non-DeepSeek compat will leak DSML text. I did not reproduce the reported Feishu feedback loop live.

Is this the best way to solve the issue?

No, not yet: the response-side DSML gate is the right owner path, but this implementation should preserve explicit non-DeepSeek compat, normalize model ids, add focused coverage, and include real Feishu/proxy proof.

Full review comments:

  • [P1] Respect explicit non-DeepSeek compat before id fallback — src/agents/openai-transport-stream.ts:3081
    The fallback runs after getCompat, so a model configured with compat.thinkingFormat: "openai" or "openrouter" can still enter DSML filtering/recovery solely because its id contains deepseek. That overrides the compatibility boundary and can strip visible text or recover synthetic tool calls on routes that explicitly opted out; check the raw compat override before applying an id fallback.
    Confidence: 0.86
  • [P2] Normalize the model id before matching DeepSeek — src/agents/openai-transport-stream.ts:3081
    The new predicate is case-sensitive, while adjacent DeepSeek V4 proxy handling trims and lowercases ids such as DeepSeek-V4-Flash. A custom proxy using that casing without a lowercase namespace still leaves the filter disabled, so normalize the id and cover the proxy cases.
    Confidence: 0.84

Overall correctness: patch is incorrect
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 640258d7b31d.

Label changes

Label changes:

  • add merge-risk: 🚨 security-boundary: The widened gate can convert provider text into recovered tool-call blocks outside the intended DeepSeek compatibility contract.

Label justifications:

  • P2: This is a focused provider-stream bugfix with limited blast radius, but it affects visible Feishu message delivery and has concrete predicate defects.
  • merge-risk: 🚨 compatibility: The diff can bypass explicit provider compatibility metadata by enabling DSML filtering solely from a model-id substring.
  • merge-risk: 🚨 message-delivery: The changed gate controls whether streamed assistant text is delivered visibly or stripped/recovered as DSML output.
  • merge-risk: 🚨 security-boundary: The widened gate can convert provider text into recovered tool-call blocks outside the intended DeepSeek compatibility contract.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body contains expected before/after reasoning but no redacted logs, terminal output, screenshots, recordings, or linked artifacts from a real proxy-provider plus Feishu run. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +3. Total +3 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 7 4 +3
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 7 4 +3

Security concerns:

  • [medium] Broadens DSML text-to-tool-call recovery by substring — src/agents/openai-transport-stream.ts:3081
    The predicate can enable DSML recovery on explicit non-DeepSeek compat routes based only on model id, so provider text could be converted into executable toolCall blocks outside the intended DeepSeek contract.
    Confidence: 0.78

What I checked:

Likely related people:

What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-06-21T16:29:00.115Z sha 4dfe995 :: needs real behavior proof before merge. :: [P1] Respect explicit non-DeepSeek compat before id fallback | [P2] Normalize the model id before matching DeepSeek

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Jun 9, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. label Jul 6, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 6, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 21, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #clawtributors on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant