From 7ce9262d0c5f329832b8dfda3c8097ccbdfebe5e Mon Sep 17 00:00:00 2001 From: zichun Date: Thu, 28 May 2026 16:14:39 +0800 Subject: [PATCH] coding.mjs: drop stale-tag freshness self-check (defensive code for already-fixed ordering bug) --- workflows/coding.mjs | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/workflows/coding.mjs b/workflows/coding.mjs index 6e5128b..1accbf1 100644 --- a/workflows/coding.mjs +++ b/workflows/coding.mjs @@ -71,12 +71,6 @@ const CHECKBOX_STATE_SCHEMA = { type:'object', additionalProperties:false, state:{type:'string', enum:['checked','unchecked']}, lineNumber:{type:'integer'} } } -// TAG_REPORT_FRESHNESS_SCHEMA:保留以发现旧版 tag → § ⑫ 错序 bug 残留(tag 指向占位符 commit)。 -const TAG_REPORT_FRESHNESS_SCHEMA = { type:'object', additionalProperties:false, - required:['fresh'], properties:{ - fresh:{type:'boolean'}, - tagReportValue:{type:'string'} } } - const ALREADY_MERGED_SCHEMA = { type:'object', additionalProperties:false, required:['alreadyMerged'], properties:{ alreadyMerged:{type:'boolean'} } } @@ -691,21 +685,6 @@ function createTagPromptM(phaseId, fe) { ].join('\n') } -// 校验 milestone tag 指向的 commit 中报告 § ⑫ 是否已是 targetTag(而非 placeholder)。 -// 用于识别旧 bug 残留:报告 § ⑫ commit 顺序在 tag 之后时,tag 指向占位符版本。 -function checkTagReportFreshPromptM(targetTag, reportPath) { - return [ - `# 校验 tag \`${targetTag}\` 指向的 commit 中 \`${reportPath}\` § ⑫ 是否新鲜`, - microStepContract(), - '', - `跑 \`git -C ${ROOT} show ${targetTag}:${reportPath}\`。在输出中定位 § ⑫("里程碑"小节)的 tag 字段值。`, - '## 输出(TAG_REPORT_FRESHNESS_SCHEMA)', - `- § ⑫ 字段值 == \`${targetTag}\`:\`{ "fresh": true, "tagReportValue": "${targetTag}" }\``, - `- § ⑫ 字段值 == \`{{milestone_tag}}\` 或其它陈旧值:\`{ "fresh": false, "tagReportValue": "<实际值>" }\``, - '- `git show` 失败(tag 不存在 / 报告路径不在 tag commit 中)→ 本步骤失败(schema 失败即可)。', - ].join('\n') -} - function findReportPromptM(phaseId) { return [ `# 找最新的 \`${phaseId}\` 完成报告并读取 § ⑫ 的 milestone tag 字段当前值`, @@ -928,16 +907,9 @@ async function runMilestone(module) { } // else: 已是 targetTag → 静默跳过(resume 幂等) - // step 6: annotated tag (idempotent + stale-tag 自检) - // 注:HEAD 此刻已包含 § ⑫ 更新 commit(或本来就在 targetTag 上),tag 指向新鲜 commit。 + // step 6: annotated tag (idempotent — tag exists 时静默跳过) const tag = await agent(checkTagExistsPromptM(targetTag), {label: lbl('tag?'), phase: 'Milestone', schema: EXISTS_SCHEMA}) - if (tag.exists) { - // 旧版 bug 残留:tag 可能指向 § ⑫ 仍为占位符的 commit。检查并要求人工 `git tag -f`。 - const fresh = await agent(checkTagReportFreshPromptM(targetTag, rpt.path), {label: lbl('tag-fresh?'), phase: 'Milestone', schema: TAG_REPORT_FRESHNESS_SCHEMA}) - if (!fresh.fresh) { - throw new Error(`HALT milestone-stale-tag ${phaseId}: tag \`${targetTag}\` 指向的 commit 中 ${rpt.path} § ⑫ = ${JSON.stringify(fresh.tagReportValue || '?')},不是 ${targetTag}(旧版顺序 bug 残留)。请人工跑 \`git -C ${ROOT} tag -f ${targetTag}\` 把 tag 重指到 HEAD 后再重跑 coding-start。`) - } - } else { + if (!tag.exists) { const r = await agent(createTagPromptM(phaseId, fe), {label: lbl('tag'), phase: 'Milestone', schema: ACTION_RESULT_SCHEMA}) if (!r.success) throw new Error(`HALT milestone-tag ${phaseId}: ${r.error || ''}`) } -- libgit2 0.22.2