Repository navigation
[PR] chore(batch): land 29 open fragmented fixes in one history-preserving batch - #6482
Conversation
…probe path can arm (#4262) DashScope compatible-mode rejects an over-long input as "Range of input length should be [1, 1000000]" — no token/length subject phrase — so inspectContextOverflow did not treat it as an overflow: the #2313 probe forward took the 400, armOverflowShrink never armed, and every attempt re-forwarded the identical 16.9MiB payload. A session past the real 1M input cap could only livelock (timer, no reply). Add the marker to CONTEXT_OVERFLOW_PATTERNS and read the upper bound as the window in parseOverflowWindow; the stated range then arms the emergency shrink and the #1195 in-request refold recovers the turn. Tests: unit cases for the real body (window 1000000) and for a parameter-range 400 that must NOT match, plus e2e #2313 e on the probe path (fails before this change with the 400 passed through, passes after). (cherry picked from commit 931a100)
(cherry picked from commit dac285f)
…#4682) Clients mint child conversation ids for work that runs on the parent's own route+model — omp opens idle-recap ephemeral turns as `<sessionId>:side:<snowflake>` (plus a `:side:conversation:<key>` variant) and subagents as `<sessionId>:sub:<id>` — and register runtime-info only under the parent uuid. The window ladder looked the id up literally, so a child missed the report and fell through to the registry peek, where a tier-gated family is capped at the built-in standard 200K without tier evidence (#1321). A session that reported 1M therefore had its own recap turns sized at 200K: preflight compressed ~174K of context toward a 150K headroom target, committed early SSE headers, and the client gave up while the summarizer was still running. pluginRuntimeInfoForConversation now strips one client-minted child suffix at a time and resolves the nearest reporting ancestor (bounded to 4 strips), keeping the model-equality gate at whichever level answers: a child on a different model inherits nothing, and a direct hit is never overridden by a parent. tests/side-window-inherit.test.ts drives the real ladder — a `:side:` child of a 1M-reporting parent budgets 1_000_000 (200_000 before the fix) — and tests/runtime-info.test.ts carries the unit-level cases. Docs: TECHNICAL-NOTES(+zh) records the child-id resolution and the CHANGELOG carries the incident shape. (cherry picked from commit 1fafccf)
(cherry picked from commit 9c8c72c)
The handoff snapshot was gated on the client socket still being writable (relay passed canSave=() => !res.destroyed, and both pipes required !res.destroyed before reply.save()). Clients that close the connection the instant they hold the terminal frame — pi does exactly this — therefore lost every assistant reply: the pipe threw 'This operation was aborted' after sawTerminal=true, took the client-abort branch and returned without saving. Persistence now answers 'did the upstream turn finish?', not 'is the socket still open?': the pipes save on sawTerminal/replyCompleted even from the client-abort path, and the relay no longer couples canSave to res.destroyed. Partial turns (no terminal) are still never captured. Refs #4247 (cherry picked from commit 63e13be)
(cherry picked from commit c9a81dd)
(cherry picked from commit cd3510b)
Restore formatting-only mass re-anchoring by requiring the unwrapped candidate to match the stored normalized identity. Keep user messages out of approximate matching and preserve changed punctuation and instruction order. Pin the non-user order-bracket path and quiet folded resends. Implementation drafted by Grok 4.6; design, review and verification by Codex. (cherry picked from commit c5279e6)
(cherry picked from commit c43dd22)
Align-refactor (review of #4935): this PR is scoped to the bare-announcement terminal-turn retry (#3905 symptom), but it also carried the LoopCtx streamMarkers field and the emitMarker consumption gate that belong to the streamMarkers setting feature. That feature has its own PR (#4934, which wires the config surface but lacks these two hunks) — keeping them here makes between two independent features. The hunks move to #4934 so each PR is a closed loop. (cherry picked from commit fa60f8f)
…he PR body describes Align-refactor (review of #4935): the PR body promises detection is 'accompanied by common action announcement verbs' and requires 'no markdown code fence open', but the shipped detector was tail-char + length only — any turn under 400 chars ending in ':' or ellipsis qualified, including legitimate short answers ('The answer is 42:') that would now cost an extra billed completion call each. Implement both promised gates: an ANNOUNCE_CUE word list (progressing forms + intent phrases only, mirroring the body's examples) and a reject on odd backtick-fence count (an unclosed fence is the #1755/#2190 truncation class, not a stall). English-first by design: non-English announcements keep the pre-#3905 no-retry behavior until traffic evidence justifies extending the cue list. (cherry picked from commit aec1e1b)
…ling; pin the 400-char cap Align-refactor (review of #4935): the suite only covered unit + compress-loop lanes while the change also rewires pipePluginChatWithStrip and pipePluginResponsesWithStrip terminal classification — the #2303 sibling suite covers all three lanes, so match that bar: plugin chat positive (#3905 log line, one [DONE], single finish_reason stop), colon-answer and ellipsis-answer negatives, tool-call exclusion, retry-degenerates in-band error (#870); responses-pipe mirror set. Also fix at-l3, whose 'long answer' fixture did not actually end on the tail char and passed for the wrong reason — the rewritten fixture (441 chars, cue-bearing, colon tail) pins the length cap itself at loop level. Drop dead imports. (cherry picked from commit 206ddc9)
…roseAcc (#3905) proseAcc accumulates every streamed text field including the thinking/ reasoning channel. endsWithAnnouncement(proseAcc) therefore saw the tail of the model's internal monologue: a thought ending mid-sentence on ':' or an ellipsis followed by a whitespace-only answer was reclassified as a bare announcement (the new #3905 branch) instead of the #2756 degenerate shape — the retry still fired but under the wrong log line, and a whitespace-only turn on an unclean finish lost its 'not retried ... not a clean stop' refusal log entirely (stalledTail suppressed it). Two subtests in tests/issue2756-degenerate-gate.test.ts went red on every shard-3 CI leg. Operand swap to answerProse in both plugin pipes (chat + responses). The compress-loop twin already tests text-only assistantText and is unaffected. (cherry picked from commit 76c98b8)
…not egress an oversized history (#5025) Without a live proxy, directSendOrRefuse measured the raw body against a window it read from the stamped x-bili-plugin-context-window header or from state.declaredWindowForDirect. On the pi lane BOTH were empty on exactly that path: before_provider_headers returns at `proxyBase === undefined` before it stamps the header, and the lane never armed the slot (#4894 armed dsh only). The check then failed open by construction, so a long session's unfurled history (multi-million tokens) went straight to the provider, whose "input exceeds the context window" 400 repeated on every retry and made the session unrecoverable for as long as the proxy stayed down. Record the per-request ctx.model.contextWindow at the TOP of the headers hook (before the readiness return) and arm it as declaredWindowForDirect in pi-native.ts. An unknown window records undefined — the guard keeps failing open instead of guessing — and a healthy proxy is unchanged, since the stamped header still outranks the reader. Verification: tests/issue5025-pi-direct-window.test.ts (5 cases: recording before the early return, unknown-window reset, the armed reader, local oversize refusal with no upstream egress, and no false refusal when the body fits); typecheck; issue4894/pi-native/issue3433/issue2072/fix-1897 suites; unused-export and test-import-graph gates. (cherry picked from commit cfcb3f9)
A request with no tools that asks for a JSON reply (response_format json_schema/json_object, or text.format on the Responses wire) is a utility call, not an agent turn. Child processes of a host inherit the proxy through HTTP(S)_PROXY, and adding the ACP tools to their extraction calls makes backends that refuse tools plus response_format answer 400. Tool-carrying requests and an explicit main persona are still main turns. Fixes #5073 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit ef508e9)
The helper is only called by isSideRequest() inside the same module; no other file imports it, so the unused-exports gate rejects the leading export. Behavior is unchanged. (cherry picked from commit 7a29d54)
Review supplement on 7a29d54 (#5074): every classification rule in this file carries its issue number as a comment anchor (#2500/#2503/#3149/#4438); the two comments added by ef508e9 did not, so the rule's provenance was not greppable. Comments only - no behavior change. (cherry picked from commit 17e82b7)
Ship the classification as the exported isStructuredOutputCall predicate with the #546 no-tools veto built in, so handle() can consult it independently of isSideRequest and skip restoreOutputBudget for the call — its 64000 budget sizes a utility response, not a main turn, and must not seed outputBudgetHighWater (#1897/#2500 class). Give the #388 side passthrough an honest log label, and extend the e2e to assert kernel state, stats, snapshot, request counter and high-water are all untouched, mirroring the #2500 suite. The new high-water assertion fails without the restore skip and passes with it. (cherry picked from commit a828e59)
…5116) The native plugin set only HTTPS_PROXY, so a plain-http base_url (a LAN llama.cpp, vLLM or ollama server) bypassed the proxy and its sessions were never compressed. apply_env now sets the HTTP pair too and defaults NO_PROXY to loopback, matching the launcher's own plain-http routes. All of them sit in _ENV_ROUTED_KEYS, so the #4644 watchdog unroutes and restores them along with the HTTPS pair. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MMUmTHLFoNYr4iAsprTFfk (cherry picked from commit 461504c)
A compressed block's summary may only be injected while it still describes content on the wire. The current predicate asks whether ANY covered message is still present, so a host rewind that truncates part of a span keeps the whole summary alive and the model reads a description of history that no longer exists. Reap (#2695) does not catch it either: it needs a strict majority of covered ids absent for three consecutive passes, and a partially truncated span keeps its majority. The gap's shape, in the block's own coverage order, is the discriminator: - survivors a prefix, missing the newest end -> the rewind shape; deactivate - survivors a suffix, missing the oldest end -> the host dropped old history; the summary is the only record of it, so keep it active - interior/ragged holes -> the id-churn shape (ids are content hashes); keep it and let fold-reconcile re-key the churned ids - nothing covered visible -> defer to the positional witness (#4316, unchanged): a surviving ledger position is the churn / merged-pair shape, not a deletion Everything except the tail gap keeps today's keep-alive behaviour, so the only behaviour that changes is the shape this change names. The positional witness is not touched: narrowing it to exact coverage would false-kill merged content (a pair collapse covers fewer ids than positions). Tests: sync-config gains the four shapes plus the positional-witness composition and the no-witness deletion case. (cherry picked from commit 7c4d4b9)
…e expiry (cherry picked from commit e3a3cbd)
(cherry picked from commit c5ea1e1)
(cherry picked from commit 3896863)
… rejection cause Review follow-up on #5482. bound() collapsed only C0 + DEL before clamping, so C1 control characters survived into the appended log suffix — in particular U+0085 (NEXT LINE) and U+009C (file separator), which render as line/field breaks. A relay that echoed such a byte into attempts[].details.error.message could forge a second log field, contradicting the module's own "no newline may forge a second log field" invariant (pinned by the \r\n test). Widen the strip to C1 (U+007f-U+009f) and extend the control-shape regression test to pin NEL and file-separator. No behavior change beyond the log-line sanitization. (cherry picked from commit c749eb8)
…ile existence (#4599) The receiver fixture creates its .port file before the write lands; on a loaded runner the existsSync poll can win that race and read back an empty file, so Number("") === 0 tripped the assertion (CI: ubuntu-24 shard 2, run 42202673910 — second occurrence of this signature after PR #5327's one-off, recorded in #4599 as record-only). Poll until the content parses as a positive integer instead; the 15s deadline and the diagnostic message are unchanged. (cherry picked from commit 8d283b9)
Correlate exact egress fingerprints, socket generations and send attempts with terminal usage-field presence. Preserve reported numeric zero versus absent cache usage without logging raw payloads or headers. This adds diagnostics, not a provider cache-miss fix. (cherry picked from commit 1d59e82)
request_sha256 serialized and hashed the whole effective request a second time on every send, including delta sends. A synthetic benchmark on Node 24 put that at about 2.4 ms per MB of body, run synchronously. The field added little. On full sends it hashed the same text as frame_sha256. On delta sends, ResponsesWsHistory.continuation() has already matched the settings and every prior input item, so mode=delta attests the same thing. The hash also changes every turn, so it cannot show prefix stability. The remaining send fields are unchanged. The test now pins the exact key set of the send record. (cherry picked from commit 30ee96b)
The generic single-shot gate added in #5687 matches "no tools + one user message + any system text", and both of its call sites opened on `agent !== "main"`. dsh's native client never stamps `x-bili-plugin-agent`, so that header reads `undefined`, and `undefined !== "main"` is always true: the FIRST unstyled main turn of a conversation matched the sidecar shape and rode the #388 verbatim side lane. The kernel never saw it, so the durable-state carriers (skills, workspace instructions, MCP catalog, runtime context) never received their BLOCKED refs (#2419/#2446/#2447/#2481), and the wire-byte contracts of #2817/#5418 reset. A genuine utility sidecar is distinguishable from that turn in two ways, and this patch requires both: - it pins a TINY fixed output budget (prompt-enhance sends 4096), whereas a main main turn either omits the field (openai wire) or sizes it from the conversation (#5656's own residual turn sends 64000) -- hasSingleShotBudget; - it never carries a dsh durable-state marker -- carriesDurableState, the same marker table fold-reconcile.ts already screens with. The #5656 e2e residual that pinned "tool-less turn 1 rides the side lane" is revoked and re-pinned to the corrected contract; the side-lane boundary test allowlists the new predicate like every other pure shape predicate. Tests: issue2419/2446/2447/2481 (4/0 each), issue2817 (1/0), issue5418 watermark (1/0), issue5656 (5/0), side-lane-invariants (15/0), issue5658 (2/0). Negative control: reverting only the two source files re-reds 2446 (3/1), 2817 (0/1), 5418 (0/1). (cherry picked from commit 427778b)
…idual (cherry picked from commit 78c9db9)
…native import cannot leak INLINE_ORIGIN egress The #5025 test statically imports pi-native.ts, which arms at module load. Since the #5428 inline default flip, plan.mode is 'inline' with no explicit env/file choice, so armNativePi registers the origin waiter with INLINE_ORIGIN. The waiter persists into the shared factory's awaitNativeProxyOrigin(), which makes the before_provider_headers handler resolve proxyBase=INLINE_ORIGIN and call registerTools -> fetchManifest, egressing to the inline origin inside the hermetic suite. Add a _resetNativeOriginWaiterForTest hook (native-bootstrap) and call it in the suite's beforeEach so the waiter is cleared per test. Fixes the 6 red test lanes (issue5025-pi-direct-window.test.ts 1630/1631) on head e484c03.
[bot] 🏷 Fixed the 6 red Root cause: All 6 lanes fail the same 2 tests in Fix: Added a Still owed from the earlier wake: the CI status: runs on 八问
判定:修复已推送,待 CI 跑完确认全绿。kernel-guard 仍需 owner 显式授权(PR body 声明与版本 bump 已就位,CI 侧应过)。 |
(ai: vllm-qwen/qwen3.8-27b) Re-verified the live state before touching anything: the watermark regression this event reported has already been fixed and merged — PR #6640 (commit What I did this run:
Bottom line: the one real batch regression (watermark fastpath) is fixed and merged (PR #6640). The three Windows lanes are documented environmental flakes, not batch regressions — they clear on re-run. No further code action from this lane. 结构化八问
判定:无需进一步代码动作。唯一真实的批次回归(watermark 快路径)已修复并合入(PR #6640);3 条 Windows 车道是环境性 flake,重跑即清。本 lane 收工。 |
…merge commit These files (issue-number lists recording the superseded closings of the previous four batches #6439/#6455/#6464/#6482) are present in neither parent of the #6574 merge commit yet appear in its result, and survive to the branch tip. They are not part of any source PR, are referenced nowhere, are not mentioned in the PR description, and the previous four batch merges never committed such files to master. Process scratch data does not belong at the repo root; the closing record already lives in GitHub history.
chore(batch): land 29 open fragmented fixes in one history-preserving batch
29 small, mostly single-file fix PRs from 21 external authors, line-by-line
reviewed together, cherry-picked with
-x(original authorship and messagespreserved), verified as one unit. No features; every change is a bug fix, a
diagnostic improvement, or a regression pin.
Contents
Excluded: #5028 (same-PID container-generation gate for served-markers) —
master 7a923f8 (2026-11-07) already landed the identical #3923 fix
(
SAME_PID_GENERATION_MARGIN_MS), so the PR's net delta is zero; it will beclosed as superseded.
Excluded (reverted in this branch): #6345 (guowenjie1992, kernel: span-safe
gap bridging at the mega-turn merge gate) — it breaks two pinned invariants
under the CI matrix (node 22/24): #1592 fold round-2 renders a double
fold-summary ("mid-history rewrite") instead of the consolidated shape, and the
#2265 e2e loses its folded block across the model-switch re-stamp. Isolated by
kernel bisection (reverting just this commit turns both green on node 22 with
dist-verified builds). Reverted here as 7d7631f so the batch can land; #6345
stays open for follow-up (a comment was left on the PR).
Merge notes (deviations from the raw PR diffs)
All 29 PRs cherry-picked
-xoldest-first. Substantive unions/adaptations:auto_vacuum-before-WAL (via [PR] chore(batch): land 7 open BBleae fixes in one history-preserving batch #6455) — the batch keeps master's scan, adds the
PR's match-count warning (both backends), drops the duplicate sweep-append,
and adds only the PR's [storage] The newly created index.db actually ends up with auto_vacuum=0: this pragma is placed after journal_mode=WAL, | [storage] 新建的 index.db 实际是 auto_vacuum=0:这条 pragma 排在 journal_mode=WAL 之后,
--vacuum incremental什么都回收不了 #6323 regression test + goldens.omp-native.ts/server.ts/handle.ts; both sides kept.covering all three sidecar predicates.
bump skipped — master is already at those versions.
release-hook test matches
forward()'s master tail signature(throttleModelHint + onWireBody added upstream); the bili forwards all x-bili-plugin* host headers (and its own chain markers) to upstream model endpoints — egress strip gap | bili 把全部 x-bili-plugin* 宿主头(及自身链标记)转发给上游模型端点——出站剥离缺口 #3905 double-degenerate
pin now expects the
streamErrorShape"protocol" frame (master [dsh] Retry-exhausted degenerate turn is serialized as successful completion (0.1.213) #5958);[PR] fix: release input-only request data before streaming #4756's wire-metadata pin accepts comparable thinking blocks (master Zero-Inheritance Session Cloning: Unified Fix for Eight Independent Defects in the Fork Adoption Chain (Next Release Tar | 会话克隆零继承:fork 收养链上八类独立缺陷统一修复(下版目标) #4266);
the [PR] fix(loop): retry stalled bare-announcement terminal turns (#4944) #4935
streamedMarkers.pushrestored after the Plugin lanes: host declares exposed bili tools per request via x-bili-plugin-exposed-tools (structural fix for #3884/#3600 name-guessing) | 插件车道:宿主按请求声明暴露的 bili 工具(根治 #3884/#3600 认名字脆弱性) #3906-hunk strip mangledit (fix commit in this PR).
forward()/forwardCapturedsplit — seated asforwardCaptured's lastparameter with the pre-stream release before the upstream await.
Follow-up commit (CI fix, 2026-11-13)
test(notices): the pure-sqlite-default notice assertions added by master's [PR] storage: pure-SQLite default — JSON envelopes stop being written unless dual-write is requested (#6479) #6480 (5a80e2b)are red on the CI corpus because the corpus baseline (tests/preload-storage-baseline.mjs, Inbound markers: one declarative strip engine for all four wires (#2789, #2798, #2811 plan B) #2815)
forces BILI_STORAGE_UNIFIED=legacy for every test file — under that override the new notice is
correctly "not in effect" and drops out of the expected list. This adopts master's version of
tests/notice-registry.test.ts and deletes the baseline override for this suite (the pin the
preload's own documented rule requires, [PR] fix: make full-mode storage tests deterministic (#4004) #4011 lesson). Verified 5/5 under the exact CI preload
set on node 22.23.4.
identically on master alone — [PR] storage: pure-SQLite default — JSON envelopes stop being written unless dual-write is requested (#6479) #6480's pure-sqlite default drops the fastpath's replicas gate
(src/server/fastpath.ts readSaved/writeSaved require store.replicasAvailable(), which is false
without the JSON sidecar) so phase B never stamps. Needs a master-side decision (pin the
harness to dual-write, or back the fastpath watermark state on the sqlite ext table).
Verification
npm run typecheck: clean.1206 pass; the 3 reds are host-detection tests that fail on master in this
environment too); kernel suite 39/39; pi-subagents 19/19;
golden-storage-render 64/65 (the 1 red fails on master too).
this branch (documented exceptions: superseded hunks listed above, three
reworded comment lines, and the skipped version-bump lines).
Closes #4262, #4682, #4753, #4860, #4874, #4944, #5025, #5073, #5116, #5176, #5252, #5386, #5687, #5711, #5741, #5953, #6079, #6088, #6104, #6309, #6325, #6329
(#5531, #5951, #6317 are already closed by earlier batches; #5592 is deliberately
not auto-closed — #6461 only addresses its proxy-prompt gap.)
kernel-change: land two reviewed kernel fixes from external PRs — #6428 (heal unpaired server_tool_use/*_tool_result in coreToAnthropic, #4954), #5166 (sync-mode block liveness by coverage shape); line-by-line reviewed, kernel suite green locally and in CI. (#6345's kernel change was excluded — see Excluded.)