Repository navigation
fix: report unrouted-endpoint direct sends for POST requests only (#1657) - #1661
Conversation
) The #1290 onUnroutedModelUrl hook fired for every non-model, non-control URL the fetch patch saw, so host tooling traffic (npm registries, catalog JSONs, git refs) flooded dsh web startup with ~18 'request sent DIRECT (uncompressed)' lines per boot and buried real failure lines. Only POST can carry a prompt, so gate the hook on POST; routing decisions are unchanged and the /__bili/stats unrecognizedPaths channel keeps counting everything. Fixes #1657
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1607-pr.1661.8ea342bThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1661.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 PR review complete — mergeable. Pulled branch ① Original issue direction (#1657) — verified, not taken on faith. Independently confirmed the mechanism claim: ② Regression inventory (existing behaviors on the touched path, item-by-item):
③ Code review — ④ Test validity — harness is hermetic ( ⑤ Diff & merge state — 4 files, +67/−14, single commit, every line on-purpose, zh/en docs mirrored, no lockfile churn. Master advanced after the branch point (#1570/#1653/#1663 merged) with zero file overlap; No minor nits found worth committing. No behavior beyond the flagged hook-scope narrowing changed. 中文摘要:修复了 dsh web 启动时 npm 注册表/git/静态资源等 GET 请求刷屏 "request sent DIRECT" 告警的问题——把 #1290 的 |
What & why
dsh webstartup printed ~18 lines ofrequest sent DIRECT (uncompressed) — …is not a recognized model endpoint…per boot, all from plugin-manager registry traffic (npm<pkg>/latest,.tgz,catalog.jsonon jsdelivr/raw.githubusercontent,registry.npmjs.org,api.github.com/releases/latest, gitinfo/refs). None of these can be model endpoints; the noise buried the real failure lines (takeover gate refused …,proxy bootstrap failed …) and re-flooded on every restart because dedup is per-process.The #1290 hook (
onUnroutedModelUrl) fired for every non-model, non-control URL the fetch patch saw. Only POST can carry a prompt, so the gate now requiresPOST. This implements suggestion 1 from the issue (owner-ranked first: 改动最小、语义最准).Behavior change (flagged)
onUnroutedModelUrlonce per process per endpoint, regardless of HTTP method → dsh console.error + persistClientEvent + bili.log entry for npm/CDN/git GETs./__bili/statsunrecognizedPathscounting (server-side, all methods),acp_statusUNRECOGNIZED PATHS section, takeoverGate refusal warnings, proxy-bootstrap warnings.Changes
src/agent/native-intercept.ts: newfetchMethodOf(input, init)helper (init.method > Request.method > "GET", uppercased); hook call gated on=== "POST"; interface doc updated to state the POST-only contract ([dsh] 非模型端点(npm registry / git / 静态资源)也触发 "request sent DIRECT (uncompressed)" 告警 → 每次 dsh web 启动刷屏 #1657).tests/native-intercept.test.ts: existing dsh使用插件dsh-commandcode-provider反代go套餐的话,不进billion-context压缩 #1290 test now uses POST for its custom-wire fetches (matches dsh使用插件dsh-commandcode-provider反代go套餐的话,不进billion-context压缩 #1290's actual example); new regression test reproduces the [dsh] 非模型端点(npm registry / git / 静态资源)也触发 "request sent DIRECT (uncompressed)" 告警 → 每次 dsh web 启动刷屏 #1657 boot traffic (npm/CDN/git/github GETs + HEAD) asserting zero hook fires, while lowercase-initpostand Request-objectPOSTboth still fire.CLIENTS.md/CLIENTS.zh-CN.md: hook bullet updated to POST-only, zh/en mirrored.No config surface change, no wire/routing change, no version bump.
Pre-flight
npm run typecheck— cleannpm test— 3191 tests, 0 fail (16 skipped: e2e-gated suites)npm run build— successe8a15c4d), no drift.Fixes #1657