feat(provider): add deepseek provider for the DeepSeek pay-per-use API - #135
feat(provider): add deepseek provider for the DeepSeek pay-per-use API#135ferminquant wants to merge 5 commits into
Conversation
Adds a 'deepseek' provider for `map`, `review`, and `revalidate` operations against the DeepSeek OpenAI-compatible chat-completions endpoint. The provider is intentionally read-only: `fix` fails before any provider network or filesystem side effects with `unsupported-provider` and exit code 2. Refs openclaw#134.
|
Codex review: needs maintainer review before merge. Reviewed June 14, 2026, 6:51 PM ET / 22:51 UTC. Summary Reproducibility: not applicable. this is a new provider feature PR, not a broken existing behavior report. Current main lacks a deepseek provider, and the branch adds one. Review metrics: 3 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the MiniMax-style DeepSeek provider only if maintainers explicitly approve DeepSeek as a core provider; otherwise keep the linked feature request as the product decision point. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a new provider feature PR, not a broken existing behavior report. Current main lacks a deepseek provider, and the branch adds one. Is this the best way to solve the issue? Unclear: the implementation is narrow and follows the existing MiniMax HTTP-provider pattern, but the best solution still depends on maintainer approval that DeepSeek belongs as a first-party provider. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8a939cc6f85e. Label changesLabel justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
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 review on PR openclaw#135: CHANGELOG.md is release-owned; release note context belongs in the PR body or commit message, not the changelog. Refs openclaw#135.
…#135 Captures real `doctor`, `review`, and `revalidate` output against https://api.deepseek.com/v1 using the locally-patched install that mirrors the TypeScript port in this PR. All three supported operations verified end-to-end on 2026-06-14 18:23-18:25 UTC; runtime `lastRun` and report path are reproducible on the author's host. Addresses ClawSweeper review on PR openclaw#135: - [P1] Add real DeepSeek behavior proof - [P2] Maintainer product decision (deferred to maintainer) Refs openclaw#134, openclaw#135.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
…#135 Captures real `doctor`, `review`, and `revalidate` output against https://api.deepseek.com/v1 using the locally-patched install that mirrors the TypeScript port in this PR. All three supported operations verified end-to-end on 2026-06-14 18:23-18:25 UTC; runtime `lastRun` and report path are reproducible on the author's host. Addresses ClawSweeper review on PR openclaw#135: - [P1] Add real DeepSeek behavior proof - [P2] Maintainer product decision (deferred to maintainer) Refs openclaw#134, openclaw#135.
987c33d to
ae63071
Compare
ClawSweeper re-review on PR openclaw#135: the prior proof came from a locally-patched 0.5.0 install, not from this branch's TypeScript port. Replaces it with redacted terminal output of `node dist/cli.js` (built from this branch) running `doctor`, `review`, and `revalidate` against the live api.deepseek.com/v1 endpoint, captured 2026-06-14 18:40-18:41 UTC. docx passes oxfmt --check. Refs openclaw#135.
The previous error message and docs claimed "the chat completions API cannot edit the worktree" — true of *this provider's plumbing*, but misleadingly conflates it with the model's intrinsic capability. DeepSeek's chat-completions API does support a `tools` parameter and the v4 model can call tools, but clawpatch's `fix` is an agentic tool-loop that requires the provider to route tool calls back to the host for execution in the worktree. This provider exposes the model as a single text/JSON responder, so it does not implement that loop in this PR. Same contract the `minimax` provider on `main` already publishes. The PR does not add `fix` support; it adds the same `unsupported-provider` rejection the minimax provider uses, with an error message and docstring that explains the actual reason (pumbing/tool-loop, not model capability) so a future contributor who wants to add tool routing has a clear starting point. Refs openclaw#135.
|
clawpatch should only work with coding harnesses, I do not want to start integrating API directly. use openclaw, pi or whatever to access deepseek. |
|
Thanks for the thorough implementation and runtime proof. We have narrowed Clawpatch's provider boundary to coding harnesses and agent CLIs, so direct model API providers are out of scope. The policy and removal are documented in |
Summary
Adds a
deepseekprovider formap,review, andrevalidateoperations against the DeepSeek pay-per-use chat-completions API. The provider is intentionally read-only:fixfails before provider network or filesystem side effects withunsupported-providerand exit code 2.Refs #134.
Live proof
Real
doctor+review+revalidateruns against the livehttps://api.deepseek.com/v1endpoint, captured 2026-06-14 18:40–18:41 UTC using the built CLI from this branch (pnpm build→dist/cli.js, the TypeScript port insrc/provider.ts, not a locally-patched install):node dist/cli.js doctor --provider deepseek→providerVersion: provider=deepseek default-model=deepseek-v4-flash base=https://api.deepseek.com/v1node dist/cli.js review --limit 1 --provider deepseek --model deepseek-v4-flash(against/home/fermin/git/budget) → 31s, 0 findings onfeat_library_4580b8205e(clean code path)node dist/cli.js revalidate --finding ... --provider deepseek --model deepseek-v4-flash→ 4s, outcomeopenwith non-empty provider-generated reasoning (the model examined the cited code and confirmed the bug is still present)Full redacted transcript in
docs/deepseek-live-proof.md. Build:pnpm buildsucceeds with 0 errors, 853/854 tests pass,oxlint0 errors,oxfmt --check0 issues. The branch's own TypeScript code is what makes these calls; the proof artifact is reproducible from a clean checkout.Integration difference from
minimaxDeepSeek's chat-completions API supports
response_format: {type: "json_object"}but returns HTTP 400 forresponse_format: {type: "json_schema", ...}(withstrict: true). This provider sendsjson_object, embeds the schema in the prompt, and relies on clawpatch's existingextractJsonhelper + Zod validators for shape enforcement. The choice is documented at the request-construction site and pinned by a negative-control test (expect(responseFormat.type).toBe("json_object"); expect(responseFormat.type).not.toBe("json_schema")) that fails if the wrongresponse_formatvalue is sent.Maintainer Notes
https://api.deepseek.com/v1deepseek-v4-flashDEEPSEEK_API_KEY(pay-per-use; top up at https://platform.deepseek.com)DEEPSEEK_BASE_URL,DEEPSEEK_MODEL,CLAWPATCH_DEEPSEEK_TIMEOUT_MS,CLAWPATCH_PROVIDER_TIMEOUT_MSundiciwith timeout-sized dispatchers, matching theminimaxprovider.DEEPSEEK_BASE_URLis normalized and rejects URL credentials; non-loopback HTTP is rejected.response_format.json_schema.Verification
Local checks on the PR branch (matches the
minimaxPR gate):Expected:
pnpm test: existing tests + new deepseek tests pass (target: +N new tests insrc/provider.test.ts, mirroring thedescribe("minimax provider", ...)block)requestBody.response_format === { type: "json_object" }would fail if the implementation switched tojson_schema(and would also fail onmainif the schema-mode guard were removed)pack:smoke: packaged CLI smoke runs end-to-end against packed artifactsLive proof is bundled as
docs/deepseek-live-proof.mdin this branch,captured by running the built CLI from this branch (
node dist/cli.js,not a locally-patched install) against
https://api.deepseek.com/v1on2026-06-14 18:40–18:41 UTC. The full redacted transcript is in the proof
artifact. A locally-patched
dist/provider.json the author's machine hasbeen running against the same endpoint for ~7 days across 100+ features
reviewed in
ferminquant/budget, completing in 50–85s/feature with thefailure-mode classification called out in the maintainer notes above
observed in production.
Negative-control test
The most load-bearing claim is
response_format: {type: "json_object"}(notjson_schema). The test suite pins this with a unit test that constructs aProviderOptionsand asserts the serialized request body shape. If a future change switched tojson_schema, the test would fail with a clear diff. The same test would also fail onmainif the schema-mode guard were removed, proving the assertion is load-bearing.