Repository navigation
fix(#1309): route dsh auto-review traffic to the side-passthrough lane - #1861
Closed
ranxianglei wants to merge 2 commits into
Closed
ranxianglei wants to merge 2 commits into
ranxianglei wants to merge 2 commits into
Conversation
dsh-experimental-auto-review (the desktop Auto permission preset) fires one review LLM request before EVERY tool call: fixed REVIEW_POLICY system prompt + exactly one user message (reviewUserText snapshot JSON), no tools, no max_tokens, temperature 0 — under the MAIN session id. The #388 budget heuristic (max_tokens<=200) can never catch it, so it ran the full pipeline: consuming refs, rewriting snapshots, skewing the nudge baseline, and 3 consecutive review calls tripped the silent orphan-GC that deactivated every compressed block (#1307/#1308; 72.4% compress failure rate in the wild). #1309 left the routing open: every SHAPE-based disjunct (message count / budget / overlap) breaks #1075's genuine-short-view semantics. The stable signal #1309 asked for exists at the traffic level — the review request's system prompt is machine-authored, package-internal, and no human turn begins with it. - src/server/dsh-autoreview-side.ts: two-signal AND identification (claudeSubagentSplit #970 discipline; failure direction = "stop side-routing", degrading to today's behavior): 1. MARKER: messages[0] is a system message starting with the versioned REVIEW_POLICY opening — byte-identical across 0.1.7-rc.2 → 0.2.0-rc.2, tracked per dsh release like MAIN_SYSTEM_PREFIXES; 2. SHAPE: <=2 messages, no tools, user message opens with the stable "ENVIRONMENT" header of reviewUserText(). openai chat wire shape v1 (the desktop lane; qwen/deepseek alike). - src/server.ts: matching requests join the #388 side-passthrough lane — FORWARDED (legitimate host traffic, unlike the #1729 compaction refusal; cross-module regression tests pin that the two detectors can never collide: the compaction marker lives in the final user message, reviewUserText starts with "ENVIRONMENT"), with zero kernel contact: no ref consumption, no snapshot refresh, no nudge baseline, no usage, no orphan-GC visibility. Shape heuristics untouched — #1075's short-view semantics hold (suite green). One info log per session on first routing; passthrough log line now names the lane reason. - tests/dsh-autoreview-side.test.ts: 11 cases — real classifyRisk() wire shape, string/content-parts forms, marker-position negatives (later system / quoted mid-system), tools guard, ENVIRONMENT guard, count bar, protocol scope, both cross-module #1729 regressions, live-package string checks. Fixes #1309 for the auto-review class; the marker-over-shape discipline is the template for future aux personas (WebSearch, classifiers): version-track their fixed prompt, never their size.
Contributor
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1851-pr.1861.45968a8This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1861.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Owner
Author
|
[bot] 🏷 协调备注(来自 #1309 线程):另一个 open PR #1431(anchor affinity 判别器,同为 |
Owner
Author
|
ework 进行review |
Owner
Author
|
这个是让auto-review自动过,不是设计方向 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1309 for the DSH auto-review class.
The request shape (source-verified,
@deepseek-ai/dsh-experimental-auto-review)dsh's Auto permission preset fires one review LLM request before every tool call —
classifyRisk():system: REVIEW_POLICY, byte-identical across 0.1.7-rc.2 → 0.2.0-rc.2, opening "You are the final authorization reviewer for exactly one pending tool call…"reviewUserText(snapshot): five stable JSON sections (ENVIRONMENT/PROJECT_INSTRUCTIONS/FILTERED_HISTORY/PENDING_ACTION),join("\n\n")tools, nomax_tokens,temperature: 0, same session id →ctx.llm.streamThe #388 budget heuristic (
max_tokens<=200) can never catch it → full pipeline: refs consumed, snapshots rewritten, nudge baseline skewed, and 3 consecutive review calls trip the silent orphan-GC that deactivates every compressed block (#1307/#1308; 72.4% compress-failure rate in the wild).The stable signal #1309 asked for
Not shape (every shape disjunct breaks #1075's genuine-short-view semantics) — the machine-authored system prompt. No human turn begins with REVIEW_POLICY; it is package-internal and versioned like
MAIN_SYSTEM_PREFIXES(#970 discipline).Two-signal AND, failure direction = "stop side-routing" (degrades to today's behavior):
messages[0]is a system message starting with the versioned REVIEW_POLICY prefix;ENVIRONMENTheader.Routing
Into the existing #388 side-passthrough lane — FORWARDED (legitimate host traffic; the opposite verdict from #1729's compaction refusal), zero kernel contact: no ref consumption, no snapshot refresh, no nudge baseline, no usage, no orphan-GC visibility. Shape heuristics untouched —
fix-1075-side-requestsuite stays green. One info log per session; the passthrough log line now names the lane reason.Cross-module regressions pin that #1729 and this detector can never collide: the compaction marker lives in the final user message,
reviewUserTextstarts withENVIRONMENT.Future aux personas (WebSearch, classifiers): same template — version-track their fixed prompt, never their size.
Tests:
tests/dsh-autoreview-side.test.ts(11), plus compaction-guard 10/10, #1075 6/6, side-request-isolation 18/18, orphan-GC 4/4, #1307 2/2 — all green; typecheck clean. (Localdsh-native.test.tsattach-mode failures reproduce on clean master — environmental, not from this change.)