Repository navigation
fix(dsh-native): three-state gate refusal logging with cumulative counts (#1158 L2) - #1193
Conversation
…nts (#1158 L2) The takeover gate's bare catch swallowed currentInitiator() exceptions (disposed/closing agent scope) as plain 'no attribution', so a throwing ALS boundary looked identical to a legitimate agentless lane — one flat log line per endpoint, no way to see a 'dozens refused, one passed' distribution. - attributionOf(): three states (ok / none / threw-with-message); sessionIdOf becomes a thin wrapper, behavior unchanged for statusOutcome/headersFor - gate refusal log: first refusal per endpoint prints once (unchanged format, plus cumulative 'refusals so far: N'); same-state refusals accumulate silently; re-print only on state transition with '(state none→threw)' marker — bounded noise, #1117 per-request silence preserved - durable copy of each printed line via persistClientEvent into bili.log ([dsh-client]-marked): GUI hosts swallow stderr, which is exactly how the reported zero-traffic case stayed invisible
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1193Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1193.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Reviewed PR #1193 (head Evidence (re-ran everything, didn't take the claims on faith):
Existing-behavior audit (what the diff touches and the verdict per item):
One minor nit (non-blocking, no commit needed): the PR body's parenthetical "(existing counts survive)" for the 256-cap is slightly overstated — when After merge, the reporter can retest on a release containing both #1187 (L1) and this L2 — or immediately against the already-published 中文摘要:核对了 dsh 接管门三态拒绝日志(累计计数+状态迁移重打印+持久化 bili.log)的代码与测试,本地复跑 typecheck/全量测试/构建全部通过,对当前 master 试合并干净且版本保持 0.1.140(GitHub diff 里的版本变化只是分支落后于 v0.1.140 发布的假象),可以合并。 |
What
The follow-up agreed in the #1158 thread (L2): make takeover-gate refusals diagnosable at a glance. The gate's old bare
catchswallowedcurrentInitiator()exceptions (disposed/closing agent scope) as plain "no attribution" — a throwing ALS boundary was indistinguishable from a legitimate agentless lane, and each endpoint produced exactly one flat line with no way to see a "dozens refused, one passed" distribution.Complements #1187 (L1, merged): that one made "evicted from the fetch chain by a third party" visible; this one makes "gate refused to claim the request" visible. No file overlap (
dsh-native.tsvsnative-intercept.ts).Changes
src/agent/dsh-native.tsattributionOf(ctx): three states —ok/none(initiator present-or-absent, no session id) /threw(+ exception message).sessionIdOfbecomes a thin wrapper;statusOutcome/headersForbehavior unchanged.— refusals so far: N; same-state refusals accumulate silently; re-print only on a state transition, marked(state none→threw)/(state threw→none). Bounded noise — 「BUG」native-intercept 进程级 globalThis.fetch 补丁按 URL 形状接管所有模型流量,无关调用者(如 MemOS)被卷入宿主压缩流程 #1117's per-request silence preserved. The 256-endpoint cap now clears only when a NEW endpoint would overflow (existing counts survive).bili.logviapersistClientEvent([warn] [dsh-client] …) — GUI hosts swallow stderr, which is exactly how the reported zero-traffic case stayed invisible.tests/dsh-native.test.ts: +1 three-state test (silent counting over 4 refusals, both transition directions with accumulated counts, attributed-silent claim, durable bili.log copy); the two pre-existing gate tests now redirectXDG_STATE_HOMEso their durable copies land in temp dirs, not the real state file.Behavior change disclosure (old → new)
— refusals so far: 1(previously: no count suffix).(state none→threw)/(state threw→none)) carrying the accumulated count — previously only one flat line per endpoint ever existed.~/.local/state/billion-context/bili.log([dsh-client]-marked) mirroring every printed refusal line — previously refusals were stderr-only and invisible in GUI hosts (the core complaint of 方式一安装的dsh 原生插件:llm-pi-ai 传输(OpenAI SDK + options.fetch 注入)绕过 globalThis.fetch 拦截,模型请求不进代理、压缩完全不生效 #1158).Verification (head b36c496, based on master incl. merged #1187)
npm run typecheck: cleannpm test: 2359 total, 2357 pass, 0 fail, 2 skipped (gated E2E); dsh-native 31/31npm run build: successReferences #1158 (L2). The issue stays open pending the reporter's retest on a released build containing both #1187 (L1) and this change.