Repository navigation
fix: keep quality-gate rejection concise — strip internal details, log full diagnostics (#444) - #447
Conversation
…g full diagnostics (#444) The pre-commit quality gate rejection message leaked internal implementation detail into model context: the 'Full compression rules are already in your system prompt' line, an 'acknowledgeRisk ... to bypass' framing, and raw gate algorithm internals (Gate layer / rougeF1 / top20Recall / threshold config). Fix: - rejection.ts: model-facing message now carries only why-it-failed + how-to-retry (core reason with threshold/config detail stripped via coreReason()). Full diagnostics are written to the ACP debug log via a new optional logger param. - range.ts: pass ctx.logger into buildQualityRejectionError so diagnostics land in logs. - tests: 4 new cases asserting no-leak, coreReason stripping, and diagnostics-to-log. E2E markers COMPRESSION REJECTED / QUALITY GATE FAILURE preserved.
📦 Built Plugin ArtifactBranch: Option A — Install from npm PR tag (recommended)opencode plugin opencode-acp@pr-447 --globalEach push to this PR publishes a new version under the Option B — Install from GitHubopencode plugin "github:ranxianglei/opencode-acp#2026-09-20_quality-rejection-no-leak" --globalOption C — Download artifact
tar xzf opencode-acp-pr447.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] 🏷 PR #447 verified — ready for human merge. (This is the agent PR for issue #444; per the Verification performed (branch
Code review findings:
No small fixes were needed — nothing actionable found during review. Per §5.1.1.2 I will not merge; please merge from your side once you're happy: #447 中文摘要:质量门禁拒绝消息瘦身(去掉系统提示词引用、bypass 措辞、Gate layer/rougeF1/top20Recall 等算法内部细节,完整诊断改写入 ACP 日志)——已逐行核对代码、本地复跑 typecheck/build/全量测试并做了变异验证(回退修复后 3 个新泄漏测试确实失败),2 个失败用例在干净 master 上同样失败属沙箱环境问题,与 PR 无关;可以合并。 |
Closes #444
Problem
When the pre-commit compression quality gate rejects a compression, the tool-error message returned to the model leaked internal implementation detail into context:
Full compression rules are already in your system prompt.→ reveals internal prompt architectureadd "acknowledgeRisk": true to bypass the quality gate→ frames a documented param as an internal bypass/backdoorGate layer:/rougeF1:/top20Recall:lines + threshold config insideReason→ algorithm internalsIn long sessions this error text becomes part of the model's context, so every rejection burns extra tokens on content that is already in the system prompt.
Fix
lib/compress/quality-gate/rejection.tscoreReason()strips algorithm threshold/config detail from the reason string (handles both L1 colon form and L2 parenthetical form).system prompt,bypass,Gate layer/rougeF1/top20Recall, redundantRatio, andre-evaluates automaticallylines.logger?: RejectionDiagnosticsLoggerparam: full diagnostics (reason with thresholds, layer, tokens, chars, ratio, retention, rougeF1, top20Recall) are written to the ACP debug log instead of the message.lib/compress/range.tsctx.loggerintobuildQualityRejectionErrorso diagnostics land in logs.Before (~780 chars) → After (~430 chars):
E2E markers
COMPRESSION REJECTED/QUALITY GATE FAILUREare preserved (the fake-LLM server greps for them).Tests
tests/quality-gate-enforcement.test.ts: +4 cases (no-leak assertions,coreReasonstripping table, diagnostics-to-log capture, no-logger guard). Target suite 19/19 pass. Mutation-checked per §5.7.3 (reverting the fix makes the 3 new leak tests fail).Verification
npm run typecheck✅ ·npm run build✅tests/soft-block.test.ts,tests/inactive-block-decompress.test.ts) are pre-existing & environmental: theymkdir '/tmp/...'which is read-only in this sandbox; confirmed identical on clean HEAD.