From a697ad8a2be2ba29c225418d5c21ce68111ecf2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=AB=E6=88=91=E5=B0=8F=E6=9D=A8=E5=90=8C=E5=AD=A6?= <188421097+HunYiSage@users.noreply.github.com> Date: Thu, 17 Sep 2026 17:54:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20#4/#26/#27=20=E5=AE=98=E6=96=B9=E6=97=A0?= =?UTF-8?q?=E8=BA=AB=E4=BB=BD=E5=89=AF=E6=9C=AC=E4=B8=8D=E5=86=8D=E6=8C=A1?= =?UTF-8?q?=E5=88=AB=E4=BA=BA=20Apply?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- lib/core.js | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/lib/core.js b/lib/core.js index 055524f..e412025 100644 --- a/lib/core.js +++ b/lib/core.js @@ -1435,6 +1435,21 @@ const PATCHES = [ " You are a coding agent powered by the {{model}} model.", replace: 'prefix: ""', }, + { + pattern: + " You are a coding agent powered by the {{model}} model, running on the DeepSeek Harness.\n\n", + replace: IDENTITY_STRIP, + }, + { + pattern: + "You are a coding agent powered by the {{model}} model, running on the DeepSeek Harness.", + replace: IDENTITY_STRIP, + }, + { + pattern: + "You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.", + replace: IDENTITY_STRIP, + }, { pattern: "personaPrefix: >-\n" + @@ -3050,10 +3065,14 @@ function patchHasRemainingWork(text, patch) { return false; } +function isIdentityLayoutPatch(patch) { + return Boolean(patch && (patch.id === 4 || patch.id === 26 || patch.id === 27)); +} + function filePatchSettled(text, patch) { if (patchApplied(text, patch)) return true; - // #26/#27 扫多份官方副本:有的本来没有身份段,不能当成 pattern 失败。 - if (patch.id === 26 || patch.id === 27) return !patchHasRemainingWork(text, patch); + // #4/#26/#27 会扫多份官方副本:有的本来没有身份段,不能当成失败。 + if (isIdentityLayoutPatch(patch)) return !patchHasRemainingWork(text, patch); return false; } @@ -3085,9 +3104,9 @@ function applyReplacementsToText(text, patch) { return { text: out, changed }; } -function rollupPatchStatus({ applied, already, missing, notFound, lastError, keyCount }) { +function rollupPatchStatus({ applied, already, missing, notFound, lastError, keyCount, layoutSoft }) { if (applied > 0) return "applied"; - if (already > 0 && notFound === 0) return "already"; + if (already > 0 && (notFound === 0 || layoutSoft)) return "already"; if (missing === keyCount) return "missing_file"; if (lastError) return lastError; return "pattern_not_found"; @@ -3101,6 +3120,7 @@ export function isPatchResultSoftOk(row, patch = null) { if (ALWAYS_SOFT_STATUSES.has(row.status)) return true; const p = patch || ALL_PATCHES.find((x) => x.id === row.patch_id || x.id === row.id); if (p?.optional && row.status === "pattern_not_found") return true; + if (isIdentityLayoutPatch(p) && row.status === "pattern_not_found") return true; return false; } @@ -3193,6 +3213,7 @@ export async function applyPatches(aiBase, patches = ALL_PATCHES) { } const status = rollupPatchStatus({ applied, already, missing, notFound, lastError, keyCount: keys.length, + layoutSoft: isIdentityLayoutPatch(p), }); report.push({ patch_id: p.id,