Skip to content

fix: add DeepSeek to non-standard providers (fixes developer role issue) - #3581

Closed
DavidSt49 wants to merge 1 commit into
openclaw:mainfrom
DavidSt49:fix/deepseek-developer-role
Closed

DavidSt49 wants to merge 1 commit into
openclaw:mainfrom
DavidSt49:fix/deepseek-developer-role

Conversation

@DavidSt49

Copy link
Copy Markdown

Summary

This PR fixes the Message ordering conflict error when using DeepSeek models.

Problem

DeepSeek API does not support the developer role, only system, user, assistant, and tool. When using DeepSeek models (deepseek-chat, deepseek-reasoner), the API returns:

400 Failed to deserialize the JSON body into the target type: messages[0].role: unknown variant `developer`, expected one of `system`, `user`, `assistant`, `tool`

Solution

This PR adds a pnpm patch for @mariozechner/pi-ai that adds DeepSeek to the list of "non-standard" providers in the detectCompat() function. This makes supportsDeveloperRole return false for DeepSeek, causing the code to use system role instead of developer.

Changes

  • Added patches/@[email protected] with the fix
  • Updated package.json to reference the patch via pnpm patchedDependencies

Testing

Tested locally by applying the patch directly to the installed package. DeepSeek Chat works correctly after the fix.

Fixes #3566

🤖 Generated with Claude Code

DeepSeek API does not support the `developer` role, only `system`.
This patch adds DeepSeek to the list of non-standard providers in
@mariozechner/pi-ai so that it uses `system` role instead.

Fixes #3566

@SynthWorkIO SynthWorkIO 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.

Review Summary

Pragmatic fix for DeepSeek API compatibility.

Findings

  • [P1] package.json — Patching @mariozechner/pi-ai creates maintenance burden. Submit this fix upstream and add a TODO comment linking to the upstream PR.
  • [P2] package.json:249 — Patch pinned to exact version 0.49.3. Add comment noting this must be verified on pi-ai updates.

Overall

COMMENT — Fix is correct and follows existing provider detection patterns. Acceptable to merge as temporary workaround; track upstream submission to eliminate patch debt.


🦞 Reviewed by SynthWork.io multi-agent review system

@DavidSt49 DavidSt49 closed this Feb 1, 2026
@DavidSt49
DavidSt49 deleted the fix/deepseek-developer-role branch February 1, 2026 12:56
supmo668 added a commit to Syntropy-Health/openclaw that referenced this pull request Jul 13, 2026
…th deny-unknown posture (CTO openclaw#3578) (#62)

SECURITY (PHI boundary). B5 render-policy's KNOWN_THIRD_PARTY_CHANNELS was an explicit DENYLIST that omitted 'irc' — so an operator could put 'irc' (or any unlisted/future channel) in phiApprovedChannels and leak a health-bearing ui.summary. A runtime fail-open, not just a lint gap.

FIX (deny-unknown posture, per CTO openclaw#3578): flip isThirdPartyChannel from denylist-membership to a FIRST_PARTY_PHI_CHANNELS allowlist — a channel is third-party (PHI-denied) UNLESS explicitly first-party {shrinemobile, webchat, matrix}. So irc AND any unknown/future channel is REFUSED AT RUNTIME (not merely linted); a newly-added channel is safe-by-default (denied) until deliberately allowlisted. Added 'irc' to KNOWN_THIRD_PARTY_CHANNELS (now documentation only; the allowlist is enforcement).

Red-first: 5 new SEC-IRC tests went red→green — incl. the BEHAVIORAL pin (a phiApproved-irc config → minimized, no health leak), a deny-unknown pin (arbitrary unknown channel refused), a CHAT_CHANNEL_ORDER registry-completeness assertion (no core channel can be first-party by omission), and a regression guard (shrinemobile/webchat/matrix stay approvable). 65 tests pass (render-policy 29 + deliver 36, zero regression), tsgo clean, oxlint clean.

QG: 2-reviewer (security + correctness). Security: SOUND, no CRIT/HIGH/MED — deny-unknown closes the fail-open at runtime for irc/unknown/case-variants, all asymmetries fail-closed. Correctness: CORRECT, no findings. Both LOW/INFO notes applied (tightened the KNOWN_THIRD_PARTY_CHANNELS docstring to reflect it's documentation not enforcement; moved the CHAT_CHANNEL_ORDER import to the top).

FOLLOW-UP (CTO openclaw#3581, separate): demote matrix to third-party (federated protocol, counsel-gate class) → first-party = {shrinemobile, webchat}. Precondition verified: no live config depends on matrix-PHI (only a test). Lands next under the same deny-unknown completeness pin.

Generated-With: Claude Code

Co-authored-by: cto <[email protected]>
Co-authored-by: Claude <[email protected]>
supmo668 added a commit to Syntropy-Health/openclaw that referenced this pull request Jul 13, 2026
…rated messaging is the counsel-gate class (CTO openclaw#3581) (#64)

Follow-up to the deny-unknown PHI fix (#62), under the same completeness pin. CTO openclaw#3581 ruled matrix is NOT first-party: a federated messaging provider is squarely the SEC-4 counsel-gate class ('third-party messaging providers can NEVER be phiApproved'). Removed matrix from FIRST_PARTY_PHI_CHANNELS → first-party = {shrinemobile, webchat} only (the app's own surfaces).

Precondition verified (per CTO): NO live operator config depends on matrix-PHI — matrix only appeared in a single test. Red-first: added a MATRIX-DEMOTED test (isThirdPartyChannel(matrix)===true + behavioral planChannelRender(matrix, phiApproved:[matrix]) → minimized, no health leak) that went red→green. Switched the deliver positive-path test from matrix→webchat (preserves 'first-party channel gets full summary' coverage on a genuine first-party surface). 66 tests pass (render-policy 30 + deliver 36), tsgo clean, oxlint clean.

STRICTLY MORE RESTRICTIVE: this removes an approval, so it can only reduce PHI egress — it cannot create a leak; the deny-unknown mechanism itself (already 2-reviewer-QG'd in #62) is unchanged. A federation-disabled self-hosted homeserver may re-argue first-party later WITH deployment evidence (documented inline).

Generated-With: Claude Code

Co-authored-by: cto <[email protected]>
Co-authored-by: Claude <[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.

DeepSeek: Message ordering conflict due to unsupported developer role

2 participants