Skip to content

fix(compress): make preemptive acknowledgeRisk a no-op instead of an error - #302

Merged
ranxianglei merged 1 commit into
2026-08-14_fix-acknowledge-risk-stablefrom
2026-08-14_fix-acknowledge-risk-301
Aug 16, 2026
Merged

fix(compress): make preemptive acknowledgeRisk a no-op instead of an error#302
ranxianglei merged 1 commit into
2026-08-14_fix-acknowledge-risk-stablefrom
2026-08-14_fix-acknowledge-risk-301

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Fixes #301

问题

⚙ compress [acknowledgeRisk=true, dangerous=true]
content[0] needs a topic — provide content[0].topic or the top-level topic
⚙ compress [acknowledgeRisk=true, dangerous=true, topic=xxx]
Parameter "acknowledgeRisk": true was provided, but no quality gate rejection is pending.

模型从质量门拒绝模板学到"重试要加 acknowledgeRisk: true",于是把它带进了所有重试——包括参数校验失败(如缺 topic)这类与质量门无关的错误。校验错误不会置位 qualityGateRetryPending,重试即撞上 preemptive 错误,形成混乱的错误循环。

修复

无 pending 拒绝时的 acknowledgeRisk 改为 no-op

  • 质量检查照常运行(质量门保护不变——只有真实拒绝后才允许 bypass)
  • 成功结果附带提示,教模型正确用法
  • 删除 buildPreemptiveAcknowledgeError

变更

  • lib/compress/range.ts — no-op 语义 + 结果中的 ignore 提示
  • lib/compress/quality-gate/{rejection,index}.ts — 移除 preemptive 错误构造器
  • lib/state/types.ts — 更新 qualityGateRetryPending 生命周期文档
  • tests/quality-gate-enforcement.test.ts — preemptive 拒绝测试替换为 no-op 覆盖(坏摘要+ack 仍被质量门拒绝;好摘要+ack 成功并带 ignore 提示)

验证

  • tsc --noEmit 通过
  • tests/quality-gate-enforcement.test.ts 13/13
  • 全量 975/975 通过

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown

📦 Built Plugin Artifact

Branch: 2026-08-14_fix-acknowledge-risk-301 (053987c)

Option A — Install from npm PR tag (recommended)

opencode plugin opencode-acp@pr-302 --global

Each push to this PR publishes a new version under the pr-302 npm tag.

Option B — Install from GitHub

opencode plugin "github:ranxianglei/opencode-acp#2026-08-14_fix-acknowledge-risk-301" --global

Option C — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf opencode-acp-pr302.tgz
cp -r package/dist ~/.cache/opencode/packages/opencode-acp@latest/node_modules/opencode-acp/dist
  1. Restart opencode to pick up changes.

This comment is automatically updated on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

追加第二个修复(同一 issue 的另一半):topic 缺失不再报错

原行为:entry 无 topic 且无顶层 topic → 硬错误 content[0] needs a topic — provide content[0].topic or the top-level topic,和 acknowledgeRisk 一样构成重试死循环的第一环。

新行为:topic 完全可选,三级 fallback —— entry.topic → 顶层 topic → 从 summary 首行自动派生(去 markdown 标题符、截断 80 字符),保证 search_context 仍有可检索的 topic。

验证:batch-compress 11/11,全量 977/977,tsc 通过。

…ring (#301)

'content[0] needs a topic' hard-failed compress calls whose entries had
no topic and no top-level fallback — another retry dead-end of the same
class as the acknowledgeRisk error. Topics are now optional: an entry
without its own topic falls back to the top-level topic, then to one
derived from the summary's first line (markdown headings stripped,
capped at 80 chars), so search_context still has something useful to
match on.

- lib/compress/range-utils.ts: drop the topic throw; add
  deriveFallbackTopic; resolveRanges fills the fallback
- lib/compress/types.ts, prompts: topic documented as fully optional
- tests: the three throw-cases now assert validity; deriveFallbackTopic
  unit coverage (heading strip, length cap, empty summary)
@ranxianglei
ranxianglei force-pushed the 2026-08-14_fix-acknowledge-risk-301 branch from 44e73d1 to 053987c Compare August 14, 2026 15:31
@ranxianglei
ranxianglei changed the base branch from master to 2026-08-14_fix-acknowledge-risk-stable August 14, 2026 15:32
@ranxianglei

Copy link
Copy Markdown
Owner Author

已按 stable-first 拆分:核心 acknowledgeRisk 修复移至 PR #303(base master,先合这个);本 PR 现在只含 topic 自动派生那一个 commit,base 已指向 stable 分支——#303 合并后 GitHub 会自动把本 PR retarget 到 master,届时直接合并即可。两个分支均基于最新 master(8a2bee3)rebase 并全量验证通过(976/976)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

发版改走 release PR #304(v1.14.17,包含本 PR 与 #303 的全部 commit,per AGENTS.md §5.4.2)。#304 合并后本 PR 可直接关闭(superseded)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

更正之前的说法:本 PR 与 #303 不再被 #304 superseded——发版流程已修正为 fix PR 先行合并,release PR #304 只含发版文件。请先合 #303,再合本 PR。

@ranxianglei

Copy link
Copy Markdown
Owner Author

最终顺序确认:先合 #305(stable 发版,不含 #301 修复)→ 再合 #303 → 再合本 PR。#301 修复随下个版本发布。

@ranxianglei
ranxianglei merged commit e0321cc into 2026-08-14_fix-acknowledge-risk-stable Aug 16, 2026
5 of 6 checks passed
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.

compress acknowledgeRisk failed

1 participant