Repository navigation
[PR] fix: hold the pressure-band nudge on a failed tool result + re-inject after a partial fold (nudge-cadence root cause) - #6771
ranxianglei wants to merge 9 commits into
Conversation
…chet (#6720) A partial tier-1 fold (harvest < STALL_HARVEST_RATIO of the offered pending) arms a one-shot re-inject: the next processTurn re-offers T1 without waiting for the full growth floor, so the unharvested remainder drains instead of riding along and ratcheting the post-fold floor up monotonically (#6720). - kernel: NudgeState.partialFoldReinjectArmed (one-shot, armed on a partial fold, cleared on display or a compliant full fold); applyCompression reports the unharvested remainder (remainingPending) on a partial tier-1 fold; decideNudge gains the re-inject branch (not gated on usage — a low-usage 1M-window session never crosses minContextLimitPct, which is exactly the ratchet shape); the nudge-stamp node disarms on a displayed tier-1 nudge. - host: the compress receipt names the remainder instead of reading as a clean "done"; the nudge inject log line lists the offered ranges (capped at 4). kernel-change: #6720 partial-fold ratchet — the cadence gate (growthFloor) let each partial fold's remainder ride along for a full growth interval; the re-inject branch bypasses that wait for ONE re-offer after a partial fold, then the normal growth gate re-asserts (no loop on an unresponsive session). (cherry picked from commit 3c8ad9d)
(cherry picked from commit 09f6fe5)
…ed (#6762) Holds the pressure-band nudge injection for one round when the latest tool result failed (toolIsError), so the model handles the failure before a nudge makes it compress and lose the error context. Self-recovering: the nudge re-arms on the next turn. Pressure-band only; the growth band is untouched. - kernel/src/compress.ts: decideNudge computes toolFailureHold from the tail message and gates the pressure-band injection; new reason branch + breakdown bit. - kernel/src/types.ts: toolIsError sidecar on CoreMessage (wire adapters set it); toolFailureHold documented in NudgeBreakdown. - src/server/budget.ts: emergencyNudge mirrors the hold bit (the host early-advertising arm must not re-arm what the kernel held). - kernel/package.json: version 0.0.198 -> 0.0.199. - Tests: kernel/tests/issue6762-* (6 cases) + tests/issue6762-* (3 host mirror cases).
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.11163-pr.6771.e80bbcaThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6771.tgz
npm install -g packageInstall instructions are refreshed on each push. |
The prior lock-sync commit (3007e2e) synced the root package-lock.json to kernel 0.0.199 but left kernel/package-lock.json at 0.0.198. The lock-sync CI job (ci.yml, 'Fail on kernel lockfile version drift') regenerates the kernel lock and fails on any residual diff, so this left the PR red. Regenerated via 'cd kernel && npm install --package-lock-only' — only the two version fields move (0.0.198 -> 0.0.199), no dependency churn.
(ai: vllm-qwen/qwen3.8-27b) 查重 (dedup): overlaps #6760 on the SAME mechanism — #6771 is a strict superset of #6760 (identical #6720 partial-fold re-inject fix, same files + same test names, PLUS the #6762 tool-failure-hold fix). Once #6771 merges, #6760 is redundant → owner should close it. (I don't close PRs.) Review of PR #6771 — root-cause aggregation for the nudge-cadence family (#6720 + #6762). I read the full 13-file diff, verified the logic against the PR branch, ran the targeted suites locally, and checked CI. What I verified
Fix I pushed (additive commit to the PR branch): Behavior changes (disclosed in PR body, confirmed intended): partial T1 fold now re-offers T1 next request (one-shot) instead of waiting a full growth floor; pressure-band nudge held one round when the latest tool result FAILED (self-recovering, growth band untouched); new breakdown bit Open item for the owner: #6760 is now superseded — close it once #6771 merges. 结构化八问
判定:可合并(mergeable)。 唯一 CI 红灯( |
Resolve kernel version conflict: master bumped 0.0.197->0.0.198 (#6709), PR bumped 0.0.197->0.0.198->0.0.199 (#6720/#6762). Resolved to 0.0.199 (the PR's version) — higher than master's 0.0.198, already validated in CI lock-sync, and the combined kernel (master #6709 + PR #6720/#6762) is a superset warranting the higher label. Conflicts were version/lockfile-only (kernel/package.json, kernel/package-lock.json, package-lock.json); all PR source files applied cleanly (master did not touch them).
(ai: vllm-qwen/qwen3.8-27b) Conflict resolved and pushed. PR #6771 no longer conflicts with master. What I did this run
Status-freshness note: the mirror cache was stale in this run ( No new issue, no label, no PR-body edit — this was a mechanical version-conflict resolution, not a design decision, and the 结构化八问
判定: 冲突已解决并 push(快进,无 force-push),分支头 |
[ework] auto-fix stalled: kernel-guard — stopping for human review |
…-cadence # Conflicts: # src/stream.ts
(ai: qwen/qwen3.8-27b) Conflict resolved and pushed. Merged current master into the PR branch, resolved the one conflict, and pushed. New head: What happened this run
Live status (this run): the mirror check cache is stale (fetched 2026-11-15T06:38:47, still showing the old head Verdict: mergeable — conflict fully resolved (union of both sides' intents), all local verification passes, master is an ancestor of the head. 结构化八问:
判定: 可合并(mergeable)——冲突已按双方意图并集完全解决,本地验证全过,master 已是 head 的祖先。 |
[ework] auto-fix stalled: kernel-guard — stopping for human review |
…lict) Conflict src/stream.ts: union of PR #6720 remainingNote + master #6855 effectiveDetail + master 2026-11-18 'folded at <acp time>' stamp (kept all three). Kernel version collision resolved: both parents labeled kernel 0.0.199 with DIFFERENT content (PR's 0.0.199 = #6720/#6762; master's 0.0.199 = #6928/anchor). Merged kernel = union of both, bumped 0.0.199 -> 0.0.200 (kernel/package.json + kernel/package-lock.json + root package-lock kernel entry). Root version 0.1.216 and pi-subagents 0.2.4 unchanged (= master).
(ai: vllm-qwen/qwen3.8-27b) Re-conflict resolved (3rd round) — new head master moved Conflict resolution —
The merged kernel is the union of both (verified: #6720 Local verification on the merged head: typecheck ✓ · build ✓ · kernel targeted tests 72 pass (incl. #6720/#6762 + master's #6928/anchor tests) · host targeted tests 11 pass (receipt/nudge/dedup) · version-guard ✓ (root unchanged) · kernel-guard ✓ (SRC_CHANGED=1, BUMPED=1 0.0.199→0.0.200, CI-hold discipline: the pushed final head Status caveat: the mirror check-cache is stale (still at 结构化八问
判定:可合并(待 CI 在新 head |
🔶 需要决策 PR #6771 touches Verified this run (2026-11-19 03:00, live git + mirror cache):
Exact gated diff (the kernel-authorization object):
Options:
No code changes this run — nothing to fix (no conflict, no red CI I can verify). The kernel authorization checkpoint belongs to the owner. Applying 结构化八问
判定:无冲突、kernel-guard 逻辑通过、PR 可合并但卡在 owner 授权(kernel human-only review)。已打 |
[ework] auto-fix stalled: kernel-guard — stopping for human review |
1 similar comment
[ework] auto-fix stalled: kernel-guard — stopping for human review |
…lict, round 4) master moved a446a3c -> ba2e819 (kernel 0.0.199 -> 0.0.201, +issue4292/5432/7270 tests, compress.ts + wire/anthropic.ts changes). PR head was 62a42d3 (kernel 0.0.200 = #6720/#6762 + #6928/anchor). Conflicts (version-only): kernel/package.json, kernel/package-lock.json, root package-lock.json. Resolved to kernel 0.0.202 (merged kernel is a superset of master's 0.0.201 — adds PR #6720/#6762; must be > master's 0.0.201 for version discipline since kernel/src changed vs master). Auto-merged clean: kernel/src/compress.ts (PR #6720/#6762 + master changes), src/stream.ts (union: remainingNote + effectiveDetail + 'folded at' stamp), kernel/src/wire/anthropic.ts, master's new test files.
Re-conflict resolved (4th round) — new head master moved What I did this run
On the earlier Status caveat: the mirror check-cache was stale this run (last fetch 2026-11-18T23:01, still showing the old head). I could NOT live-read the new head's CI result from the cache. Mergeability is verified via git: No new issue, no PR-body edit — this was a mechanical version-conflict resolution. The 结构化八问
判定:可合并(待 CI 在新 head |
🔶 需要决策 kernel-guard is red on the new head Root cause (a formatting mismatch in the PR body, not a code issue): The kernel-guard greps the PR body for the literal string ! printf '%s' "$PR_BODY" | grep -q 'kernel-change:'But the PR body declares it as a Markdown heading — The exact gated diff (the kernel changes the declaration covers):
Why I did not fix it myself: the system rules for this lane are explicit — "NEVER edit the PR body to add a declaration UNLESS the gated diff is a mechanical kernel bug YOU fixed yourself." This PR's kernel diff is the original #6720/#6762 work (not a mechanical bug I fixed this run), so the body-edit exemption does not apply to me. Editing the author's PR body is an owner/author action. Options:
Status (verified live this run): mirror cache refreshed to head I have NOT touched the PR body or the branch this run. Awaiting your call on A vs B. 结构化八问
判定:分支代码正确、可合并;唯一阻塞是 PR 正文缺 |
[ework] auto-fix stalled: kernel-guard — stopping for human review |
Summary
Root-cause fix for the nudge-cadence family (aggregation #6769). Two defects in the kernel nudge decision, one unified fix:
Every compression only trims a little: the post-fold floor ratchets up and a 1M-window session ends at 212K without recovering | 每次压缩只降一点:压缩后的地板越压越高,1M 窗口会话涨到 212K 不回落 #6720 — the compression ratchet. A weak model answers a T1 nudge with a PARTIAL fold (harvests < STALL_HARVEST_RATIO of the offered pending), leaving the remainder on the table. The remainder rides along, the tail grows by the next nudge, and the post-fold floor rises monotonically — because the next T1 re-offer waits for a FULL growth floor of new tokens, and a low-usage long session (1M window, usage <= 24%) never crosses minContextLimitPct, so the first-sight/backlog bypasses never fire either. A 1M-window session ends with ~212K unrecovered.
feat: hold the compression nudge when the latest tool call failed (model over-compresses and loses sight of the error) #6762 — the nudge is blind to tool failure. The nudge decision (NudgeInput) has no tool-failure signal, so the pressure band (usage >= maxContextLimitPct) re-fires on EVERY turn — including a turn whose LAST message is a FAILED tool result. On such a turn the model is about to act on a fresh failure, and a pressure-band nudge pushes it to compress; the failure context (the error message, the failed command) is the first thing a fold drops, so the model "forgets" the error and retries blindly.
Fix
#6720 — partial-fold re-inject (one-shot).
applyCompressionreportsremainingPending(the unharvested remainder) on a partial T1 fold and arms a one-shotpartialFoldReinjectArmedflag. The next request re-offers T1 via a dedicated branch (NOT usage-gated — a low-usage session never crosses minContextLimitPct) when the remainder is >= 50% of the T1 threshold. The flag is cleared on display or a compliant full fold, so an ignored re-offer never loops. The compress receipt names the remainder so the model sees it instead of a "done" receipt.#6762 — tool-failure nudge hold (pressure-band only, self-recovering).
decideNudgereads thetoolIsErrorsidecar (now onCoreMessage, set by the wire adapters) from the tail message. When the pressure band is active AND the latest tool result FAILED, the pressure-band injection is held for that one round (newtoolFailureHoldbreakdown bit + reason). The nudge re-arms on the next turn (self-recovering), so a session that keeps failing still gets its nudge on the first non-failure turn. The growth band is untouched — it has a cadence and does not re-fire every turn, so the "re-fires on a failed turn" pathology is pressure-specific. The host early-advertising arm (emergencyNudge) mirrors the hold bit so it does not re-arm what the kernel held.kernel-change
#6762 — the kernel nudge decision (NudgeInput) has no tool-failure signal, so the pressure band re-fires on a failed-tool-result turn and the model compresses and forgets the error. The fix adds the signal (toolIsError sidecar on CoreMessage) and holds the pressure-band injection for one round. The host side cannot solve this: the nudge decision is kernel-owned, and the tail-message classification must run in the same projection the kernel executes on.
Tests
kernel/tests/issue6720-partial-fold-reinject.test.ts(4 cases: arm + re-inject, not usage-gated, one-shot, full-fold negative)kernel/tests/issue6762-tool-failure-nudge-hold.test.ts(6 cases: EMERGENCY held, success-tail injects, text-tail injects, OVER-LIMIT held, self-recovery, growth-band unaffected)tests/issue6720-partial-fold-receipt.test.ts(host receipt names the remainder)tests/issue6762-tool-failure-nudge-hold.test.ts(3 host mirror cases)Targeted suites green locally (kernel nudge 113, host nudge 20, both new files); full regression on CI.
Behavior changes
toolFailureHold(1/0) on the nudge decision; the hostemergencyNudgearm respects it.kernel 0.0.198 -> 0.0.199.
Fixes #6720
Fixes #6762