Repository navigation
fix: concise quality-gate rejection message (issue #396) - #397
Conversation
The pre-commit quality gate rejection error embedded the full HOW_TO_COMPRESS_RULES (~1,234 tokens) plus a multi-line CRITICAL warning on every rejection — content already present in the system prompt (lib/prompts/system.ts:58) — so a failed compression injected ~5.4K chars of mostly redundant text into the model's context (issue #396). - drop HOW_TO_COMPRESS_RULES embedding + CRITICAL paragraph - add the gate reason line (result.reason was previously unused) - rewrite retry guidance to 3 sentences; correct the acknowledgeRisk description to match #301/#303 semantics (flag bypasses only after a prior rejection set qualityGateRetryPending; a passing rewrite needs no flag) - tests: invert rules-presence assertion to absence, assert reason, add <1,000-char size-budget regression guard; E2E marker strings preserved Fixes #396
📦 Built Plugin ArtifactBranch: Option A — Install from npm PR tag (recommended)opencode plugin opencode-acp@pr-397 --globalEach push to this PR publishes a new version under the Option B — Install from GitHubopencode plugin "github:ranxianglei/opencode-acp#2026-09-15_concise-quality-rejection" --globalOption C — Download artifact
tar xzf opencode-acp-pr397.tgz
cp -r package/dist ~/.cache/opencode/packages/opencode-acp@latest/node_modules/opencode-acp/dist
This comment is automatically updated on each push. |
[bot] 🏷 Verification complete for PR #397 ( Diff review — clean, exactly as described. 4 files: Verified against code:
Local runs on the PR head:
CI status (head commit): One note: the branch base ( Conclusion: verified, no defects found. Ready to merge once 中文摘要:已拉取分支逐条核对——拒绝消息不再重注入压缩规则(实测 672 字符)、Reason 行在两条失败路径下均有内容、acknowledgeRisk 说明与 range.ts 实际语义一致、E2E 标记字符串保留、本地全量测试 1133/0 通过;CI 除 e2e(运行中)外全绿,改动文件与 master 无冲突,e2e 通过后可合并。 |
Round-1 code review NIT: qualityGateRetryPending is cleared at the start of every compress call (lib/compress/range.ts:338), so the bypass window is exactly the next compress call — not a strict one-shot bound to 'this rejection'.
[bot] 🏷 Update: the last outstanding check PR #397 is fully verified — code, tests, and CI. Ready for you to merge whenever. 中文摘要:e2e 检查已通过,全部 6 项 CI 全绿,PR 验证完毕,可以合并。 |
Review & CI status for this PR:
Ready for human merge per §5.1.1.2. 中文摘要:质量门拒绝信息去掉了与系统提示重复的全量压缩规则注入(~1.2K tokens),改为失败原因+关键指标+三句重试指引,单次拒绝注入量从 ~5.8K 降到 ~620 字符;双 agent 评审通过(含变异验证)、CI 全绿(含 e2e),可以合并。 |
Problem (issue #396)
When the pre-commit quality gate rejects a compression, the error returned to the model embedded the complete⚠️ CRITICAL" warning paragraph — on every rejection. For a failed compression whose purpose is to save context, this re-injects ~5.4K chars of new text into the model's context. The content is also 100% redundant: the same constant is already in the ACP system prompt (
HOW_TO_COMPRESS_RULES(~4,936 chars ≈ ~1,234 tokens) plus a multi-line "lib/prompts/system.ts:58), sent with every request.Secondary defects found while fixing:
reasonfield ("Summary too short: …" / "Content coverage too low: …") was never included, even though the issue's expected behavior asks for the failure reason.qualityGateRetryPending.Fix (
lib/compress/quality-gate/rejection.ts)HOW_TO_COMPRESS_RULESimport/embedding and the CRITICAL warning paragraph.Reason:line fromresult.reason.acknowledgeRisk: truebypasses this rejection once if you're confident the summary is correct despite the metrics.Result: standard rejection payload drops from ~5.4K chars (~1.4K tokens) to ~600 chars (~150 tokens), ~85% smaller.
Not changed: the blocking gate itself, its config/metrics, the throw/bypass mechanics in
lib/compress/range.ts, and the E2E fake-LLM marker strings (COMPRESSION REJECTED/QUALITY GATE FAILUREremain in the header —scripts/e2e/fake-llm-server.ts:222,503). Advisory mode / auto-bypass after N rejections stays out of scope (open design discussion in #339).Tests (
tests/quality-gate-enforcement.test.ts)buildRejectionFixture().HOW TO COMPRESS/KEEP VERBATIM/CRITICALmust NOT appear) + reason inclusion asserted.Full suite: 1,133 pass / 0 fail; typecheck + build green. New/changed lines kept prettier-conformant (repo baseline has 430 pre-existing flagged files — no unrelated reformatting mixed in).
Devlog:
devlog/2026-09-15_concise-quality-rejection/(REQ + WORKLOG).Fixes #396
中文摘要:质量门拒绝压缩时返回给模型的信息不再重复注入完整的 HOW TO COMPRESS 规则(该内容已在系统提示中),改为「失败原因 + 关键指标 + 简短重试指引」,单次拒绝的注入量从约 5.4K 字符降到约 600 字符;同时修正了 acknowledgeRisk 说明与实际行为不符的问题。可以合并。