Repository navigation
[PR] chore(branch): land 20 single-purpose fixes as one history-preserving batch (wave 10) - #6765
Conversation
…t eat the prompt Claude Code's --mcp-config is variadic, so 'bili claude "do X"' failed with 'MCP config file not found: <cwd>/do X'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The kernel stamps a nudge as shown when it decides to inject it, before the request goes upstream. When the upstream rejects that request (a Claude Code session on v0.1.213, 2026-11-11: the nudge drew "role 'system' must precede an 'assistant' message"), the model never saw the nudge, yet the stamp holds the cadence as if it had: the next request was smaller than the rejected one, the decision read "growth=-21002 ... blocked: T1 (cadence)", and the next nudge waits until the context grows a full growth floor past the rejected request. On a 4xx for a request that carried a nudge, roll the shown stamps back to their pre-turn values and hold nudges until a request succeeds, so the next request goes out without the nudge that may have drawn the 400, and the turn after a success re-decides from the old reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#5849 added hadTextOtherThanTextFields to the chat lane after a text-less frame drained a held render-tag head, letting the rest of the tag reach the host as prose. The google lane kept the unconditional drain, on the assumption that it never sees such frames -- an absence of observation, not a property of the lane. A Gemini progress frame whose only part is {text:""} reproduces the same split here, so gate that exit on googleFrameHasNonText, the predicate the rebuilt branch three lines above already uses.
The streaming tag filter reports its drops through a one-shot notice: the first drop of a response claims it and every later one is silent. A tag head still held when the stream ends is dropped inside flush(), so when a completed tag came first (the common case) the drain drop produced a counter bump and no line at all — the only trace was the strip snippet, which is why a 5-char "<acp " in bili.log was indistinguishable from a successful strip. Give drain drops their own budget and an explicit second argument on the onDrop callback so every caller can name the event: the filter now reports a drop made during flush() as "held head dropped during drain", while the one-shot notice for ordinary strips keeps its current semantics (still one line per response). Refs #5192.
…-lane boundary relay.ts (the wire tail) must not import the side-lane engine directly (#1440 P2 cut 4; tests/side-lane-invariants.test.ts test H). The overflow recovery (#6528) added an import of outputBudgetField/readOutputBudget/ writeOutputBudget from ./side-request.js, coupling relay to the side-lane engine and breaking test H on 3 CI shards (master is green on the same shards). The three helpers are generic wire-shape helpers already imported by src/server/budget.ts; re-export them from budget.ts and point relay.ts at ./budget.js. No behavior change, no circular dependency.
…status continuation A mock upstream replays the #5950 turn shape: round 1 carries reasoning plus the acp_status call, round 2 answers in text or emits the Read for the nonexistent path. Both directions asserted, per the gate discipline (#3617): a text-only round 2 reaches the client with no tool_call frame (the proxy fabricates nothing), and a model-emitted Read reaches the client byte-exact, once, with its id and arguments verbatim (the proxy suppresses and rewrites nothing). The round-2 request body is asserted too: the acp_status call/result pair replays with matching ids and the round-1 reasoning intact. Related to #5950. This test documents and locks in the correct behavior; it does not fix the model-side hallucination behind the report.
The original PR flagged only the TRUNC_OPEN/TRUNC_CLOSE settle-branch sites (a truncated tag head held at EOF). The swallow-span EOF drops (stream dies mid-tag AFTER a complete opening tag — the more common died-mid-tag shape) still went through dropSwallowSpan with duringDrain=false and produced no drain line. Extend the duringDrain flag to dropSwallowSpan and pass true at all 7 swallow-span EOF call sites (lines 1537, 1546, 1551, 1554, 1579, 1585, 1594). Add 2 regression tests for the swallow-span drain case. Per 连贯修复不拆片: one mechanism (drain-drop auditability) = one PR.
…6548) A single-shot Responses call with string input and only server-executed search tools (pi-web-access xAI web search) is not a conversation turn: it carries no history to fingerprint and creates no session state, so the #286 refusal's rationale does not apply to it, and the client cannot carry an identity here. Forward it verbatim instead of hard-400ing.
…6557) TOOL_TYPED_OPEN's tail [^<>]*> read a self-closing imitation (<acp type="tool:…"/>) as an OPENING, so the whole-text path made it own the rest of the field (or pair it with a later orphan close) while the streaming path killed it in place via SELF_CLOSE — a whole-text/streaming divergence on the same input, the #4178/#4210 split-invariance class this channel exists to prevent, and a loss of the prose that follows the imitation. Exclude the self-closing form from the opening match (the character before the final > must not be /); it then falls through to the SELF_CLOSE pass, killed in place — the same verdict streaming already reaches, so both paths agree again. A refs-only body with a non-acplike degenerate close still owns the rest of the field in both paths: the corrupted close is not the span's terminator, consistent with the wrapped-turn EOF rule. +4 regression tests: self-close dies in place with following prose surviving (whole-text, both shapes), streaming split-invariance for the self-close shape, and a guard that a type="text" self-close keeps its following prose (SELF_CLOSE semantics unchanged). Reviewer fix-up on the PR branch: found by whole-text vs streaming differential repro during review; one-line regex change, no state-machine change.
Resolve conflicts with master: the side-request.js import in src/server/handle.ts and the allowlist in tests/side-lane-invariants.test.ts both gained identifiers on both sides — take the union (upstream's hasSingleShotBudget / isStructuredOutputCall plus the PR's isResponsesServerToolSingleShot). All other files merged from disjoint upstream/PR changes.
The merge of master dropped the spaces inside the braces of the side-request.js import. Restore repo style; no semantic change.
…ssthrough A TTS call on /chat/completions carries a top-level audio object and no tools. It ran through the full pipeline, which injected the ACP system prompt as messages[0] plus an <acp> prefix on every message, and TTS models 400 on the leading system message. isAudioOutputCall now recognizes the shape and routes it through the #388 verbatim side passthrough, with a WC-025 ledger entry and tripwire in the fakes.
…eto (#6636 review) The tripwire flagged ANY audio-shaped body with a leading system message, but isAudioOutputCall vetoes tool-carrying requests (a main turn whose model has an action surface and accepts a leading system). A legitimate tool-carrying voice-chat main turn, decorated by bili, would have tripped the fake upstream. Add the same no-tools veto so the validator matches the predicate, and pin the boundary with a legal test row.
`hermes plugins install <repo>/hermes-plugin` never writes bili.json, so the plugin stood inert on any machine without `bili plugin install hermes`. load_sidecar now falls back to a host-managed copy (node_modules/billion-context) and then to the reference lane (#1196): the global dist via `bili` on PATH. Nothing is written, so the one-writer contract is untouched. plugin.yaml declares every tool/hook/middleware register() installs, so the host validates the real surface instead of a stale subset (hermes_cli/plugin_validate.py fails on undeclared, warns on declared-but-unregistered — the imageRescale=off surface is therefore a warning, never a failure). tests/hermes-native.test.ts covers the ladder end to end: sidecar -> node_modules -> PATH -> inert, plus the realpath/.js guard (a shell wrapper named `bili` is not a dist) and a read-only assertion. The no-sidecar scenario is pinned to a node-only PATH so a machine-wide `bili` can no longer decide its outcome. Proven red on the base: bundled/path resolve to null there. Fixes #6699
The OS-driven dark block supplied the dark CSS vars but left `color-scheme` at the base `light dark`, which resolves to light when the OS asks for neither scheme. Native control chrome is painted from `color-scheme`, not from the vars, so the compress prompt-pack <select> on #/config popped a white option list over the dark page while every other surface was dark. Both dark palettes now declare `color-scheme: dark`. The regression test reads each dark block on its own so the base `light dark` declaration cannot satisfy it. Fixes #6587
When every requested ref is above the session frontier, the failure receipt scrubbed the endpoints to a bare [stale-ref], so the caller could not tell which refs it used. Emit a number-preserving marker ([stale-ref:00010]) instead: the range diagnostic stays readable while the bare mNNNNN token never reaches the client-persisted receipt, so the #2146 echo channel stays dead. Fixes #6712
Minor style nit from review: the @deepseek-ai/cordis import was placed mid-file (line 162, after a test). ESM hoisting means no behavior change; moving it to the top follows the repo convention of imports-first.
Policy-gate REFUSED receipts (compress.requireNudge / compress.requireRecommendation) returned before any ledger call, so a model re-submitting a range bili will never fold got byte-identical receipts forever and the circuit breaker never armed. Charge both gate branches like every other reject path (recordCompressFailure + noteCompressLoopFailure), collapse repeat gate refusals to a one-liner from the 2nd identical call, and use terminal wording when no compressible ranges remain at all instead of pointing at acp_status. Fixes #6728
Use safePrefix at the registry's 120-code-unit bound so valid Unicode observations remain encodable in diagnostics reports. Extend the public report matrix with split-pair, whole-pair and ASCII user-agent cases. The split-pair regression fails on 7ab1d63 with URIError; both controls pass. With this change, all 45 related tests, typecheck and build pass. The UA cases exercise programmatic registry input and report generation. Addresses the follow-up in #6750.
[bot] 🏷 Dedupe: not a duplicate. The 20 source PRs (#6716 #6747 #6750 #6753 #6714 #6693 #6681 #6672 #6638 #6633 #6589 #6574 #6561 #6544 #6537 #6535 #6531 #6529 #6524 #6706) are open as expected; they get superseded-by comments after this batch lands. No parallel batch PR. Structure (verified): Per-PR added-line audit (each merge's added lines vs its source PR's diff): 19/20 exact match. Two defects found and fixed (pushed to the branch, now
Regression review (read all 26 non-test source files):
Behavior changes (flagged per policy): Verdict: mergeable — structure intact, all 20 PRs verified, no kernel-boundary concern, typecheck clean, targeted tests green, no unintended regressions. The two defects I found are fixed and pushed. Pending the 9 queued CI checks to complete. 8问(中文审核结论)
合并判定:可合——结构完整、20 个 PR 全部核对、无 kernel 边界问题、typecheck 干净、定向测试绿、无无意回归;我发现的两个缺陷已修复并推送。待 9 个排队中的 CI check 跑完。 |
…nes too (#6531) The reject re-arm from #6531 only captured the cadence stamps in the anthropic lane, but the nudge rides every protocol lane (all four prepare-* files can set nudgeOutcome = "injected") — a 4xx reject on any other lane kept the stale shown-stamp and starved the cadence exactly as the issue describes. Mirror the anthropic-lane pattern into prepare-google/openai/responses: snapshot before processTurn, restore while the hold flag is set, veto injection while held, expose nudgeStampsBefore only when actually injected. The relay 4xx hook (rejectNudge) is lane-agnostic, so no relay change is needed. Tests: consecutive-4xx idempotency (a second 4xx must neither re-restore the stamps nor clear the hold; the nudge re-arms exactly once after the usage-settled success) and a full google-lane re-arm e2e (reject -> hold -> re-arm), alongside the existing anthropic pair.
#6531) Review finding on the #6531 extension: the hold flag was only cleared by settleUsageReport for s.total > 0 samples, so on upstreams that never report usage (#1595 route class) a single 4xx on a nudge request latched the hold for the rest of the process lifetime — the exact failure #6531 fixes, relocated. Clear it at every no-usage success site (proxy-json, acp-loop, the three plugin lanes) via releaseNudgeHold, matching the documented 'hold until the next success' contract. New e2e test: a stream with no usage fields at all, one rejected nudge, hold released by the first no-usage 200, nudge re-armed on the following turn. Verified the test fails without the fix (3 pass / 1 fail) and passes with it (4/4); tsc clean; sibling suites green (overflow-refold 9/0, google progress 5/0, phantom-read 2/0, drain-audit 9/0).
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1207-master.912aa67 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Lands 20 small single-purpose fixes as one history-preserving batch: 3 follow-up commits from Afloat16 (delivered on top of his already-merged wave-7/8 work) and 17 first-PR fixes from 11 other contributors. Each branch is merged in with a real merge commit (
Merge <author>/<branch> (PR #<n>) into batch10-wave10), so every original commit and author stays in first-parent history. After this lands I'll close the 20 source PRs with a superseded-by comment (same pattern as the previous four batches).covered.some()per timestamp scangeneratedAtnormalization flake-guard with a mocked clock (the two mechanisms coexist harmlessly)safePrefix— the oldraw.trim().slice(0, UA_MAX_CHARS)could cut between a surrogate pair[stale-ref:00010]— the number survives, and no baremNNNNNtoken is ever emitted (keeps the #2146 echo channel dead).gitattributes:docs/**/*.md text eol=lf— a GFW-autocrlf checkout had turned a +18-line docs fix into a +1509/-1489 rewriteincrementalTurnBodyShape— a lane-only envelope above the cap fell through to an ordinary upstream relay (the receive budget inreadBodyalready bounds the body)load_sidecarresolution ladder (bili.json sidecar → bundled dist →bilion PATH via realpath +.jsguard) is read-only; a shell wrapper namedbilino longer resolves as the distaudio-object request (TTS, e.g. MiMo mimo-v2.5-tts) is a pure sidecar shape — it now rides the #388 verbatim side lane instead of receiving ACP tool injection, and stays out of the restoreOutputBudget high-water path; WC-025 wire-contract tripwire pins the shapetype="tool:*") now dies whole (with its body) in both the whole-text and streaming paths, instead of keeping the fabricated bodycolor-scheme: darkon both OS-driven dark palettes — native form/control chrome is painted fromcolor-scheme, not from CSS variables, so dark pages showed light controlsrmrf— fixes the Windows EBUSY red seen since the batch-4 CI runsdrainNoticedbudget makes sure it is always reported even after the strip one-shot was spent--mcp-config FILEis variadic and swallowed the positional prompt — now passed as--mcp-config=FILEToolsOwnerper activation (definitions + effect disposer +tools/changerestore path with fiber-state guard + adoption of foreign same-name registrations) instead of a process-globaltoolsReadylatch — a same-context restart no longer inherits a stale ready stamp and silently loses every bili tool until a full dsh restart. Adds@deepseek-ai/cordis4.1.0 as a dev dependency (test-only; used by the real-fiber lifetime test)Merge notes (three non-trivial resolutions, all union-of-both):
side-requestimport line insrc/server/handle.tsand the side-lane-invariants allowlist — kept both symbols.src/server/relay.tsgained both the terminal-cause suffix and therejectNudgehook.generatedAtnormalization (1d71c20); both coexist and the mocked-clock test passes.Verification (clean checkout of this branch, node 22.23.4, CI preload chain):
tsc --noEmit: clean — this caught a real bug in [PR] fix(hermes-plugin): load the bili dist without a bili.json sidecar #6672: two backticks inside a Python comment live inside the test file's TS template literal and closed it early (tsc TS1005 ×3); fixed intest(hermes): escape backticks in the generated Python driver (#6672)dsh-settings-ui,dsh-tool-registration-lifetime) fail identically on bare master in this sandbox (local environment limitation) but are green on GitHub CI for the same code state (PR [PR] fix(dsh): restore tools after registration owner teardown #6706 head: 39 success / 0 failure checks)Closes #6715 #6744 #6749 #6728 #6712 #6692 #6699 #6636 #6557 #6588 #6548 #6547 #6530 #6528 #6523 #6702