Skip to content

[PR] fix: gate-refusal log no longer claims "sent DIRECT" — egress is decided after the gate (#3499) - #3512

Closed
ranxianglei wants to merge 1 commit into
masterfrom
2026-10-17_gate-refusal-log-egress
Closed

ranxianglei wants to merge 1 commit into
masterfrom
2026-10-17_gate-refusal-log-egress

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

来源: 分析 #3499 #3499 时发现。Part of #3499(不关闭该 issue——手动 /compact 的设计决策仍在那里开放)。

问题

dsh native 车道接管门拒绝时的日志行写着:

bili-native-dsh: model request sent DIRECT (uncompressed) — takeover gate refused …

但「sent DIRECT」只对拒绝后三种去向之一成立。出口其实是门返回之后由拦截层决定的(src/agent/native-intercept.ts):

#3499 事故里字节死在 bili 本地(60ms 本地 422,从未到上游),而这行日志声称「sent DIRECT」——读起来像已直发上游,在 issue 上花了一整轮诊断才被 DSH journal 推翻。

修法

拒绝日志不再断言目的地:

  • 旧: model request sent DIRECT (uncompressed) — takeover gate refused …
  • 新: model request NOT taken over by bili (uncompressed) — takeover gate refused … — egress: direct upstream or proxy passthrough lane (decided after the gate)

takeover gate refused 锚点、uncompressed 说明、累计计数全部保留;tests/dsh-native.test.ts:1771 的全行断言同步更新,其余断言只匹配尾部 refusals so far: 未变。

行为变更披露(日志输出格式)

仅上述日志行措辞变化:grep 这行旧措辞的工具应改用不变的 takeover gate refused 或新措辞。无行为/协议/配置变更;无 kernel 变更。非模型端点的另一条 request sent DIRECT(dsh-native.ts unrouted-model-url 行)不动——那里断言是准确的。

验证: typecheck clean;定向 node --import tsx --test tests/dsh-native.test.ts 55/55 绿(全量以本 head 的 CI 为准)。

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-17_gate-refusal-log-egress (2eba41f)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.4150-pr.3512.973784c

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr3512.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei
ranxianglei force-pushed the 2026-10-17_gate-refusal-log-egress branch from e0cf9d5 to 2eba41f Compare October 17, 2026 07:19
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重:不重复。 本条是 PR #3512 的镜像(该 PR 已存在、open、基于 master)。检索 open+closed issue/PR 无同症状同机制条目;与 #3499(母 issue,手动 /compact 设计决策仍开放,本 PR 明确不关闭它)、PR #3502(dsh compaction 拒绝消息加恢复指引——不同消息、不同机制)相关但不同。

这是已完成工作的 PR,我没有重做,按 review 纪律核对了代码与行为:

① 方向:独立重读了 src/agent/native-intercept.ts 的门后路径,确认 issue 描述的三种去向全部属实——overlay 已路由 URL 打 passthrough 标记发给 bili(从不直连);raw URL 上 marker-sniffed 压缩信封 POST(有活代理时)改道进 bili 无归因 passthrough 车道由 #2709 守卫裁决(422 或放行);其余才是真直连上游。日志在门返回时点就断言「sent DIRECT」= 在错误的层做提前断言,修法(去掉目的地断言、注明出口由门后决定)打在源头,不是遮症状。方向成立。

② 回归审查(审过的既有行为及结论):#1158 L2 日志节奏(每端点首拒记一次、同态静默累计、状态转换重打带累计计数、256 键上限)——保持;persistClientEvent 持久通道且不到终端面(#2831)——保持;门返回值语义(仍返回 false,路由逻辑零改动)——保持;dsh-native.ts:1438 非模型端点的另一条 request sent DIRECT——有意不动(该路径确实直连,断言准确);dsh-native.ts:1407 的 LOCALLY (422) 行——不动(措辞本就准确)。tests/dsh-native.test.ts:1740/1754/1763 三条锚定行尾 refusals so far: N$ 的断言不受影响——计数段保持在行尾。无高危模式:无语义漂移、无 fail-fast 变吞错、无阈值/时序变化;唯一输出格式变化即披露的那行措辞(旧 sent DIRECT → 新 NOT taken over by bili … egress: …,grep 旧措辞的工具应改用不变的 takeover gate refused 锚点或新措辞)。

③ 代码:diff 两文件 11+/4-,每行都服务于目的。注释重写准确描述了门后裁决链(含 #2709 守卫位置)并引用 #3499 事故动机;模板改动与既有 em-dash 风格一致。

④ 测试有效性:tests/dsh-native.test.ts:1771 全行断言逐字钉住新措辞(有牙——措辞回退会红);锚点+计数断言钉住稳定部分。对措辞级变更足够,无需额外 e2e。

⑤ diff 整洁度:干净,无跑题/空行/生成物。

验证与基线新鲜度:PR 原基线落后 master 4 个提交(那 4 个提交不触碰本 PR 的两个文件,GitHub 报 mergeable)。我已把分支 rebase 到当前 master(494571f)并推送(新 head 2eba41f34,force-with-lease,单 commit 无冲突);在该 rebase 后 head 上本地 typecheck clean + 定向 node --import tsx --test tests/dsh-native.test.ts 55/55 绿。CI 正在新 head 上重跑(原 head 上除 3 个 test shard 外已全绿,预期一致)。

八问:

  1. 是什么问题:门拒绝日志声称「sent DIRECT」,但请求去向是门返回之后才定的,三种去向里只有一种是直连上游——dsh /compact on a bili lane is refused by design but offers no recovery path | bili lane 上的 /compact 被拒属设计行为,但拒绝提示没给恢复路径 #3499 事故里字节死在 bili 本地 422,日志却像直发了上游,浪费一整轮诊断。
  2. 什么原因导致的:日志模板在门拒绝时点提前断言了下游拦截层(native-intercept.ts)才做的出口决策——断言放在了错误的层。
  3. 影响范围与严重程度:仅日志措辞;影响读日志排障的人和 grep 旧措辞的工具(已有过一次误诊实例),无功能/协议/配置影响——体验级缺陷。
  4. 怎么修复的:拒绝日志不再断言目的地,改为「NOT taken over by bili (uncompressed) … egress: direct upstream or proxy passthrough lane (decided after the gate)」,保留 takeover gate refused 锚点、uncompressed 说明与累计计数(计数留行尾,其余断言零改动)。
  5. 是否有回归问题:无——上述②逐项过完,全保持;唯一变化是已披露的措辞。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

判定:可合(等 rebase 后 head 的 CI 全绿;合并由人来)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

补充:rebase 后 head 2eba41f34 的 CI 已全绿——44 个 check run 全部完成(30 success / 14 skipped / 0 failure),含 ubuntu/windows × node 22/24 的 test shards。

维持上条结论:可合,等人工合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: zhipuai-lb/glm-5.3)

孤儿票清理:标题指向的 issue 已关闭,修复已由其他路径落地。关单;误判请 reopen。

@ranxianglei ranxianglei changed the title fix: gate-refusal log no longer claims "sent DIRECT" — egress is decided after the gate (#3499) [PR] fix: gate-refusal log no longer claims "sent DIRECT" — egress is decided after the gate (#3499) Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant