Repository navigation
[PR] fix: route Claude Desktop notification classifier through the side passthrough (#4840) - #4843
ranxianglei wants to merge 9 commits into
Conversation
…ssthrough (#4840) Claude Desktop's Code-tab notification classifier fires a one-shot side call under the MAIN conversation id: a fixed system sentence + exactly one freshly-built user blob carrying four ordered status labels, no tools, max_tokens=3072. Pre-fix the <=200 budget gate in isSideRequest missed it and no dedicated shape existed, so it rode the full pipeline as a main turn - its usage sample replaced the main baseline, its model became the session's last model, its single message clobbered the persisted snapshot + ledger, and restoreOutputBudget seeded outputBudgetHighWater from its 3072 budget. Add isClaudeNotificationRequest (a pure shape predicate: fixed system prefix on any wire carrier + exactly one plain-text user message carrying the four ordered labels, tail length matched dynamically; no-tools veto; explicit main intent vetoes at the caller). Wire it into sideRequestLike (verbatim keying), sideIntent (side passthrough), the restoreOutputBudget skip, and the side-lane reason label. Closes #4840
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10766-pr.4843.d6c6152This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4843.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 镜像库检索了 "notification classifier"、"haiku 3072"、"baseline pollution sidecar" 等关键词(open+closed),无同机制条目。相关但不同的既有 issue:#2648(同一个通知分类器因 ACP 注入导致上游 400,机制不同)、#3744/#3746(Threads 面),均不覆盖本 PR 的「分类器被当主轮污染会话状态」问题。 标签: bug + claude + scope/wiring + p1(理由:Claude Desktop 车道的请求管道接线缺陷;p1 依据 owner 2026-10-19 修订——侧调单条消息覆写持久化 snapshot+ledger,属「重载丢消息」数据丢失类)。 PR 审核进行中:diff 已逐文件读完(4 文件 +415/-10,无 kernel 改动、无配置面、无新依赖),正在 PR head |
Review supplement to the #4843 fix: the issue lists four pollution symptoms; the e2e no-pollution lane asserted three of them (usage baseline, snapshot/counter, high-water) but relied on structural code position alone for the fourth — the notification's Haiku model becoming the session's last model (assigned at src/server/handle.ts main-pipeline config block, after the side-lane early return). Assert it explicitly so a future refactor that moves that assignment above the lane decision is caught by the regression test instead of shipping silently.
(ai: vllm-qwen/qwen3.8-27b) 审核进展:diff 审核完成,定向验证通过,并已补一个 review supplement commit。 顺手小修(独立标注 commit 本地定向验证(PR head): CI:新 head |
(ai: vllm-qwen/qwen3.8-27b) 审核结论(八问)CI 全绿(新 head
行为变更披露(旧→新):通知分类器请求从「主轮处理」(污染主会话 usage 基线/last model/snapshot/ledger/high-water)变为「#388 side passthrough」——逐字转发、不碰 kernel 状态、不注入 tools/nudge、不做输出预算恢复。这是本 PR 的目标修复;显式 Review supplement:已推独立标注 commit 判定:可合并。 修复打到根因(在 lane 决策点阻止侧调进主管道,而非事后擦污染痕迹),方案与 issue 预期一致,测试双向齐全(正/负矩阵 + 三条 e2e 车道 + 缺口文档化测试),diff 干净(4 文件 +417/-10,每行都与本 PR 目的相关)。请 owner 合并:#4843 |
[bot] 🏷 Merge conflict resolved and pushed. The PR branch Conflicted files (3) — all resolved by keeping BOTH sides' logic:
Verification (local, targeted — full suite is remote CI's job):
结构化八问
判定:冲突已全部解决并推送,PR 恢复可合并(mergeable: true)。等待 CI 在新 head 上跑完整回归;CI 绿后即可由 owner 合并。 |
…2nd pass) Master advanced 33104b1..e5e1647 (270 commits) since the first merge (b254fa5). Reconciled the same side-lane surface: - handle.ts import line: added isClaudeNotificationRequest (#4840) alongside master's hasSingleShotBudget + isStructuredOutputCall. - restoreOutputBudget guard: combined !structuredOutputUtility (master #5073) with !claudeNotificationSidecar (#4840). - sideLabel ternary: kept master's structured-output clause + appended the claude-notification clause. - side-lane-invariants.test.ts: combined (G) comment + allowlist (added isClaudeNotificationRequest to master's set). side-request.ts auto-merged clean. typecheck pass; targeted side-lane tests 64/64.
[bot] 🏷 2nd merge-conflict pass resolved and pushed. Master advanced
Verification: 结构化八问
判定:冲突已解决,PR 现 |
[ework] CI fix verified green ✓ |
…3rd pass) Union resolutions on the two hot-file conflicts: - src/server/handle.ts: side-request.js import line gains BOTH isAudioOutputCall (#6636, master) and isClaudeNotificationRequest (#4840, this PR); the restoreOutputBudget skip gains both !audioOutputUtility and !claudeNotificationSidecar; the sideLabel ternary gains both the audio-output (#6636) and claude-notification (#4840) arms. - tests/side-lane-invariants.test.ts: boundary comment gains both the #6636 and #4840 predicate paragraphs; the handle.ts import allowlist gains isAudioOutputCall, isResponsesServerToolSingleShot and isClaudeNotificationRequest. No semantic overlap: the two predicates are independent shapes (toolless top-level audio object vs fixed Claude notification system + four ordered labels), so the union keeps each side's behavior exactly.
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — this is the continuation of this PR's own conflict-resolution lane (3rd pass); no new issue/PR opened. What I did this run (conflict resolution, 3rd pass): The PR head (
No semantic overlap between the two sides — the predicates are independent shapes (toolless top-level Verification (targeted, per local-testing discipline):
Push & state (verified live this run):
八问 (structured summary):
判定: 冲突已解决,PR 现为 mergeable(待新 head d554f6e 的 CI 检查 + 审批)。 |
[ework] CI fix verified green ✓ |
…4th pass) Union resolution on the two side-lane conflicts introduced by master's #6880 dsh purpose-signal work: - src/server/handle.ts sideIntent line: keep master's isSideRequest(parsed, requestAgent, declaredPurpose) third-arg call AND append this PR's || claudeNotificationSidecar tail. - src/server/handle.ts sideLabel ternary: keep master's leading declaredPurpose !== undefined ? 'declared purpose=... (#6880)' : arm AND keep this PR's trailing claudeNotificationSidecar ? 'claude notification classifier sidecar (#4840)' : arm. No semantic overlap: declaredPurpose is the dsh host's purpose header signal (#6880); the Claude Desktop notification classifier never declares a dsh purpose, so the two arms are disjoint. src/server/side-request.ts auto-merged cleanly (isSideRequest's new optional purpose arg + the PR's isClaudeNotificationRequest coexist).
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — continuation of this PR's own conflict-resolution lane (4th pass); no new issue/PR opened. What I did this run (conflict resolution, 4th pass): Live state at run start:
No semantic overlap: Verification (targeted, per local-testing discipline):
Push & state (verified live this run):
八问 (structured summary):
判定: 冲突已解决,PR 现为 mergeable(待新 head 66fc95d 的 CI 检查 + 审批)。 |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — 本 PR 自身缺陷修复;红 CI 为 master 继承性失败(#2929 探针),与 #4599 协调通道已有记录,未另开 issue。 Red CI fixed — inherited master failure, resolved by merging the ci-fixes sentinel. New head What I did this run:
八问(中文结论):
判定:修复已推(final head |
|
(ai: vllm-qwen/qwen3.8-27b) APPROVE — the #4840 fix is correct, well-tested, and clean. No kernel change, no config surface, no new dependency. What I verifiedCore fix (4 files). Tests. 8 tests (5 unit + 3 e2e), all passing locally on head CI. Green on head Note on the diffThe PR head carries two files from the 结构化八问
行为变更披露(旧→新):通知分类器请求从「主轮处理」(污染主会话 usage 基线 / last model / snapshot / ledger / high-water)变为「#388 side passthrough」——逐字转发、不碰 kernel 状态、不注入 tools/nudge、不做输出预算恢复。这是本 PR 的目标修复;显式 判定:可合并。 PR 打到根因(在 lane 决策点阻止侧调进主管道,而非事后擦污染痕迹),测试双向齐全,diff 每行都与本 PR 目的相关(另两文件为 ci-fixes 继承,非本 PR 贡献)。请 owner 合并。 |
(ai: vllm-qwen/qwen3.8-27b) Review complete — APPROVE. Full review with the structured 8-question checklist is in the comment above. In short:
Verdict: 可合并 — ready for the owner to merge. |
# Conflicts: # src/server/handle.ts
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — 本 PR 第 5 轮接冲突,同一 sideIntent 热行碰撞模式(前 3 轮已记录),无新 issue。 Merge conflict resolved (5th pass). Master advanced 60 commits; one conflict hunk, resolved as a clean union. New head What I did this run:
八问(中文结论):
判定:冲突已解并推送(final head |
[ework] CI fix verified green ✓ |
# Conflicts: # src/server/handle.ts # tests/side-lane-invariants.test.ts
[bot] 🏷 6th pass — merge-conflict resolved and pushed. Master advanced 25 commits since the last pass ( What master added this round (the #6884 wire-client auxiliary sidecar batch):
Conflicts resolved (4, all union):
The Verification (this run):
CI on the new head 八问:
判定: 冲突已解、已推( |
|
(ai: vllm-qwen/qwen3.8-27b) Re-review at head The head moved from
Verification at 8 问(结构化 review,中文):
行为变更披露(旧值→新值):分类器调用从「主轮处理」→「#388 side passthrough」;旧行为污染 usage 基线 / lastModel / 快照 / 账本 / 高水位,新行为 verbatim 转发、不碰任何主轮状态。 判定:可合并 — ready for the owner to merge. |
(ai: vllm-qwen/qwen3.8-27b) Re-review complete at head The head moved from |
[ework] CI fix verified green ✓ |
What & why (#4840)
Claude Desktop's Code-tab notification classifier fires a one-shot side call under the MAIN conversation id: a fixed system sentence + exactly one freshly-built user blob carrying four ordered status labels (
Current state:/Tool calls so far:/User's most recent ask:/Assistant message tail (last N chars):), no tools,max_tokens=3072.Pre-fix none of the existing signals saw it — the
<=200budget gate inisSideRequestmissed 3072 and no dedicated shape existed — so it rode the full pipeline as a main turn:restoreOutputBudgetseededoutputBudgetHighWaterfrom its 3072 budget.Fix
Add
isClaudeNotificationRequest(src/server/side-request.ts) — a pure shape predicate following the #4438 auto-review / #2503 title discipline: fixed system prefix on any wire carrier (systemCarrierTexts) + exactly one plain-text user message carrying the four ordered labels (the last label's(last N chars)count matched by regex, never hardcoded); no-tools veto; explicitagent=mainvetoes at the caller. A real main turn can never match: it carries a tools surface and multi-turn history, and never carries these classifier labels.Wire it into four sites in
src/server/handle.ts:sideRequestLike— verbatim session keying (a 标题生成等侧请求污染主会话状态:prepareAnthropic 缺 isTitleGen 守卫、快照无条件覆盖、survivedCount 每请求空转 #388 passthrough request never participates in persona resolution),sideIntent— routes to the side passthrough (kernel state / stats / snapshot / ledger untouched, nothing injected),restoreOutputBudgetskip — its 3072 budget must not seed the high-water,No kernel change, no new dependency, no config surface.
Behavior change (old → new)
The notification-classifier request was previously treated as a main request — it mutated the main session's usage baseline, last model, persisted snapshot/ledger, and output-budget high-water. It is now treated as a side request: forwarded verbatim through the #388 passthrough with no kernel-state mutation, no tool/nudge injection, and no output-budget restore. This is the intended fix — the classifier is an auxiliary one-shot call that must not touch main-session state. Explicit
agent=mainstill outranks the shape (unchanged), and ordinary Haiku turns (tools + multi-turn history) still ride the full pipeline (covered by a control test).Tests
New
tests/issue4840-claude-notification-side-lane.test.ts(8 tests): unit positive/negative matrix for the shape matcher,isSideRequestgap documentation,resolveSideLanelabel, plus three e2e lanes (no-pollution + high-water untouched; normal-Haiku-stays-main control; explicit-main-veto). Updated the #1440 boundary allowlist intests/side-lane-invariants.test.tsfor the new symbol (with the category justification that guard requires).Local: typecheck clean; new suite + websearch/dsh-title/truth-table/isolation/invariants suites (86 tests) + lane-decisions-matrix (90 tests) all green on the rebased head. Full-suite verdict = CI.
Closes #4840