Repository navigation
[PR] fix: classify proxy tool results by structured outcome, not just the FAILED keyword - #7124
ranxianglei wants to merge 3 commits into
Conversation
…FAILED keyword The first-line "FAILED" classifier misclassifies both directions: a successful compression summary that quotes an earlier FAILED result is read as a failure (false positive), and a genuine tool failure whose first line lacks the keyword — e.g. decompress not-found returning "[Block X not found]" with outcome:"failure" — is read as success (false negative). The latter makes a failed-only round re-request until the loop limit (10 upstream calls). The dispatcher already computes a structured outcome (applied/partial/refused for compress, success/failure for every other tool) but dropped it when pushing to proxyResults. Carry the outcome through and make it authoritative at the five control-flow sites: a compress is failed iff refused, every other tool iff failure. The first-line FAILED check remains only as the legacy fallback when no outcome is present. Behavior change: tool failures without "FAILED" on the first line (e.g. decompress not-found) now classify as failed. A failed-only round ends the turn when visibility markers are off (instead of re-requesting) and splices a recovery receipt when they are on — consistent with how a failed compress is already handled. compress applied/partial + decompress/absorb success/failure map identically to the first-line behavior; no other change. Fixes #5383
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10832-pr.7124.95ad1afThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr7124.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Verdict: the fix is correct and well-scoped — I approve the code. CI is red on 3 shards, but I traced it and the failures are not in this PR's change. Code review (verified against source + local runs on the PR head):
CI (the one open item): 3 test shards red — ubuntu-22 s2, ubuntu-24 s2, windows-22 s5. Two findings:
The PR is based on 8问:
收工判定:代码正确、回归测试真实(修复前红、修复后绿)、typecheck 干净、行为变更单向安全——代码层面 approve。CI 三片红经本地排查与本 diff 无关(疑似 stale-base 继承红/flake),建议 rebase 到当前 master 重触发后再看;我未合并。 |
… shrinks (#7124) The test compresses m00004-m00005 (~6 tokens) with a 24-char summary (~6 tokens); the no-net-shrink gate (src/stream.ts) refuses a compress whose summary is not strictly smaller than the range (net delta <= 0), so the compress was refused (outcome:refused). Pre-#7124 the first-line FAILED classifier missed it (the refused receipt's first line says 'refused', not 'FAILED'), so the test passed; #7124 makes the structured outcome authoritative, so the refused compress is now correctly failed and refreshFolded no longer runs. Shorten the summary to 'ok' (1 token) so the compress succeeds and the test exercises the post-compress re-request view it was written for.
(ai: vllm-qwen/qwen3.8-27b) All 3 red test shards fixed on the PR branch; final head pushed (6f125b6, no [ework:ci-held] marker → full CI will run). What was red:
Root cause — the #564 failure is a real regression from this PR's diff (not inherited red / flake): Fixes (2 commits + 1 merge):
Verified on merged head 6f125b6:
八问:
判定: 3 个红分片全部修复,最终 head(6f125b6)已推送、无 ci-held 标记,触发完整 CI;等 CI 绿即可合入。 |
What
The first-line "FAILED" classifier (from #5384) misclassifies proxy tool results in both directions:
FAILEDtool result, the scan reads the success as a failure.decompressnot-found returning[Block X not found]withoutcome:"failure"— is read as success. This makes a failed-only round re-request until the loop limit (10 upstream calls).The dispatcher already computes a structured outcome (
applied/partial/refusedfor compress,success/failurefor every other tool) but dropped it when pushing toproxyResults, so the five control-flow predicates only ever saw the text.Fix
Carry
outcomethroughproxyResultsand make it authoritative at the five control-flow sites (src/loop/core.ts):compressis failed iffrefused(applied/partialboth folded something);decompress/absorb/…) is failed ifffailure;FAILEDcheck remains only as the legacy fallback when no outcome is present.Tool failures whose first line lacks
FAILED(e.g.decompressnot-found) now classify as failed instead of success. Consequences:visibilityMarkersis off (instead of re-requesting until the loop limit), and splices a recovery receipt + re-requests when markers are on — exactly how a failed compress is already handled;compressapplied/partialanddecompress/absorbsuccess/failuremap identically to the first-line behavior, so no other path changes.Regression test
tests/plugin-protocol.test.ts: adecompressnot-found call (noFAILEDon the first line) withvisibilityMarkers:false. Pre-fix it re-requests to the loop limit (10 upstream calls); post-fix the turn ends after 1. The existing #5384 test (summary containing FAILED continues) still passes — no regression.Scope
Single module (
src/loop/core.ts+ test). No config schema, persistence, wire-shape, or kernel change. Supersedes the first-line approach originally shipped for #5383 (#5384) by using the structured outcome the dispatcher already computes.Fixes #5383