Repository navigation
fix: break the small-model same-parameter compress failure loop early (#156) - #370
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-370Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr370.tgz
npm install -g packageThis comment is automatically updated on each push. |
[bot] Reviewed PR #370 (branch Pre-flight (verified by me, not taken on faith)
Code review — correct
Minor (non-blocking)
Merge gate (not a code defect)
Verdict: LGTM on the code and tests — all pre-flight claims independently verified. Please run the E2E (or manual-dispatch CI e2e) before merging. I won't merge the PR (human-only per AGENTS.md). |
…#156) Rebased onto current master (v0.1.84); core.ts had evolved (+168/-44 since v0.1.65) but kept the same run-to-MAX_LOOP_ROUNDS behavior with no repeat-detection, so the issue still reproduces on the live version. A small model can get stuck re-submitting the EXACT same failing compress call (identical args) every round. Compress validation is deterministic, so an identical call fails identically — re-requesting only burns a real upstream call for an identical result. Previously the loop ran to MAX_LOOP_ROUNDS (10 real upstream calls) before completing gracefully. runCompressLoop (src/loop/core.ts) now tracks the canonical args of every compress/decompress that fails this loop. If a round is ONLY failed compress/decompress calls and one of them re-submits args that already failed, the loop breaks early (graceful completion) instead of running to the limit. - Match is on canonicalized args (parsed + keys sorted), so key-order/whitespace differences do not defeat it. - Fires only when the model is doing nothing but repeating failures: a successful compress or any other proxy call in the round suppresses the break. - The model still gets one full chance to see a failure and correct it (break fires on the SECOND identical submission, verified at round 2 in tests). Files: - src/loop/core.ts: canonicalArgs/sortKeys + failedSignatures + early break - tests/loop-core.test.ts: regression test (breaks early) + guard test - tests/fix-stream.test.ts: abort-signal control test varies summary per round
b5931d6 to
bae19fa
Compare
Review 结论:✅ 可合并(本环境补齐了缺的 E2E 验证)代码 review 通过,逻辑与声明一致:
验证(master e710eb0 = #545/#547/#548 合并后)ework 上次说 E2E 跑不了(无 codex / 无上游)。本环境两者都有,已补齐:
无阻塞项,建议合并。 |
[bot] 收到,谢谢把缺的 E2E 补齐——那正是我上一轮唯一挂起的合并门(本沙箱无 codex / 无上游,跑不了)。你在有真实 codex + Responses 上游的环境里跑了四阶段(warmup→load→ACP compress→purity)全过,这个门我采信(此环境无法复现)。 另外:我最初 review 时 master 还停在 对当前 master (e710eb0) 的独立复核
结论:代码逻辑、单测、以及你补上的 E2E 四阶段都通过,无阻塞项。同意可合并。 按 AGENTS.md,我不能合并 PR(合并是人类专属操作)。请你自行合并:#370 |
…tionable (#3302) - pruneRefsToLiveIds records pruned refs into state.deadRefs (deduped, sorted) so both producers (compaction archive, zombie reap) feed the kernel tombstone path - failure receipt falls back to the last nudge's compressible-range table when no live decision exists, instead of 'Call acp_status before retrying' - loop logs a one-shot warning when a fixed-endpoint/varying-endpoint compress probe family is detected (#370 breaker stays identical-args only) - stale-ref cause text and FOLD BASE GENERATION MISMATCH body no longer assert cross-session origin
…tionable (#3302) - pruneRefsToLiveIds records pruned refs into state.deadRefs (deduped, sorted) so both producers (compaction archive, zombie reap) feed the kernel tombstone path - failure receipt falls back to the last nudge's compressible-range table when no live decision exists, instead of 'Call acp_status before retrying' - loop logs a one-shot warning when a fixed-endpoint/varying-endpoint compress probe family is detected (#370 breaker stays identical-args only) - stale-ref cause text and FOLD BASE GENERATION MISMATCH body no longer assert cross-session origin
…tionable (#3302) - pruneRefsToLiveIds records pruned refs into state.deadRefs (deduped, sorted) so both producers (compaction archive, zombie reap) feed the kernel tombstone path - failure receipt falls back to the last nudge's compressible-range table when no live decision exists, instead of 'Call acp_status before retrying' - loop logs a one-shot warning when a fixed-endpoint/varying-endpoint compress probe family is detected (#370 breaker stays identical-args only) - stale-ref cause text and FOLD BASE GENERATION MISMATCH body no longer assert cross-session origin
What
Fixes the most serious part of #156: a small model (~2B) getting stuck re-submitting the exact same failing
compresscall (identical args) every round, burning allMAX_LOOP_ROUNDS(10) real upstream calls with zero success before completing gracefully.Compress validation is deterministic — byte-identical args fail identically. So a re-submission of an already-failed call can never succeed; re-requesting only burns a real upstream call for an identical result.
How
runCompressLoop(src/loop/core.ts) now tracks the canonical args of everycompress/decompressthat fails this loop (failedSignatures). If a round is only failed compress/decompress calls and one of them re-submits args that already failed in a prior round, the loop breaks early (graceful completion) instead of running to the limit.Safety properties:
acp_status) in the same round, suppresses the break — so a model that is making progress is never cut off.This directly stops the
round 4→10 连续 7 轮pattern from the issue, and also stops the loop from burning rounds on repeated identical hallucinated refs (#156 part 2) / repeated too-short-summary failures (part 3).Files
src/loop/core.ts—canonicalArgs/sortKeyshelpers,failedSignaturesset, early-break after theMAX_LOOP_ROUNDScheck.tests/loop-core.test.ts— regression test (identical failing compress → breaks early,fetchCalls < MAX_LOOP_ROUNDS-1) + guard test (failing compress alongside another proxy call → does NOT break early, runs to the limit).tests/fix-stream.test.ts— the abort-signal control test now varies the summary per round so it does not trip the new early-break (its intent is to prove the abort signal, not loop logic, stops re-requests).Pre-flight
npm run typecheck(src, tsconfig.build.json): passnpm test: 852/852 passnpm run build: pass (dist self-contained)E2E note
tests/e2e/e2e-codex.test.tscould not be run in this environment (nocodexbinary —spawn codex ENOENT— and no local upstream at127.0.0.1:8199). The change is insrc/loop/, so please run the E2E (or the manual-dispatch CI e2e) before merging. The unit tests exercise the modifiedrunCompressLoopdirectly viacreateResponsesAdapter()(the same Responses path the E2E drives), and all pass.Out of scope (model-quality, not proxy-fixable)
#156 parts 2–4 (hallucinated refs, numeric-constraint memory, tag echo) are small-model capability issues. The proxy already surfaces clear validation errors and a tag-echo warning; this PR adds the missing piece — not wasting upstream calls on futile identical retries.