Skip to content

feat: support apply_patch for DeepSeek models - #37

Open
xupeng wants to merge 2 commits into
code-yeongyu:mainfrom
xupeng:deepseek-apply-patch
Open

feat: support apply_patch for DeepSeek models#37
xupeng wants to merge 2 commits into
code-yeongyu:mainfrom
xupeng:deepseek-apply-patch

Conversation

@xupeng

@xupeng xupeng commented Aug 11, 2026

Copy link
Copy Markdown

Requirement

The extension only enables apply_patch (replacing write/edit) when the model id starts with gpt-. DeepSeek V4 Flash used through the OpenCode Go Responses endpoint (api: openai-responses) already supports apply_patch, so the extension should support it too.

Changes

  • Extend the model id prefix allowlist from gpt- to gpt- and deepseek-, and add the isApplyPatchCapableModel predicate
  • Keep isOpenAIGptModel as a deprecated compatibility alias
  • syncToolset now uses the new predicate, so DeepSeek models exposed via openai-responses / openai-codex-responses also replace write/edit with apply_patch
  • Add toolset-switching and model-metadata test cases for DeepSeek; all 62 tests pass
  • Update the README behavior table and CHANGELOG

Review in cubic

@xupeng
xupeng marked this pull request as ready for review August 11, 2026 08:53
@xupeng
xupeng requested a review from code-yeongyu as a code owner August 11, 2026 08:53

@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: 843baaf489

ℹ️ 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 thread src/index.ts
return Boolean(error && typeof error === "object" && "code" in error && error.code === code);
}

const APPLY_PATCH_MODEL_ID_PREFIXES = ["gpt-", "deepseek-"] as const;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove DeepSeek from the activation prefixes

For every deepseek-* model using one of the accepted Responses APIs, this prefix makes syncToolset remove write and edit and activate apply_patch, directly violating the repository constraint that the extension only activates for OpenAI GPT-family models. Keep non-GPT models on the standard editing tools unless that repository-wide constraint is intentionally changed.

AGENTS.md reference: AGENTS.md:L21-L25

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in 1ecf162: the deepseek- prefix is intentional and the repository constraint is updated accordingly — AGENTS.md now states the extension activates for OpenAI GPT-family models and DeepSeek models (id prefix deepseek-) exposed through openai-responses / openai-codex-responses APIs. Non-GPT models on other APIs remain on the standard editing tools.

@xupeng
xupeng force-pushed the deepseek-apply-patch branch from 843baaf to 1ecf162 Compare August 11, 2026 09:01

@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: 1ecf162b98

ℹ️ 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 thread src/index.ts
export type ApplyPatchCandidateModel = Pick<Model<string>, "provider" | "id"> & Partial<Pick<Model<string>, "api">>;

export function isApplyPatchCapableModel(model: ApplyPatchCandidateModel | undefined): boolean {
if (!model || !APPLY_PATCH_MODEL_ID_PREFIXES.some((prefix) => model.id.startsWith(prefix))) {

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 Require a Responses API before activating DeepSeek

When a deepseek-* model uses a provider in GPT_APPLY_PATCH_PROVIDERS but a different API, such as { provider: "openai", id: "deepseek-custom", api: "openai-completions" }, this expanded prefix check admits it because the existing provider branch bypasses the API allowlist. syncToolset consequently removes write and edit, even though DeepSeek activation is restricted to openai-responses and openai-codex-responses; require an allowed API specifically for the DeepSeek prefix while retaining the provider shortcut for GPT models.

AGENTS.md reference: AGENTS.md:L24-L24

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 7d910bc: the deepseek- prefix now requires an allowed Responses API (openai-responses / openai-codex-responses) and no longer falls through the provider-allowlist shortcut, which remains exclusive to GPT models. Regression test added for { provider: "openai", id: "deepseek-custom", api: "openai-completions" } → not activated.

@xupeng
xupeng force-pushed the deepseek-apply-patch branch from 1ecf162 to b3e9427 Compare August 11, 2026 09:08
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