Skip to content

[PR] fix(wiring): degenerate-turn continuation retry joins the 429 governor (#4743) - #4802

Merged
ranxianglei merged 2 commits into
masterfrom
2026-10-26_degenerate-429-governor
Oct 26, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-10-26_degenerate-429-governor

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

(ai: zhipuai-lb/glm-5.3)

Fixes #4743

这是什么

qwen 在 #4752 里七项修复中唯一没有随 PR #4725 进入 master 的一项,按 owner 指示直接摘出来:退化轮续拉(degenerate-turn continuation refetch,src/degenerate-retry.ts)此前对 429 治理器完全不可见——重试风暴不会武装 hold,已武装的 hold 也照样烧一个上游名额。

改动 = 原样 cherry-pick qwen 的 ab6a7f1(+15 行,无其他依赖):

  • 武装的 hold 在本地回答续拉(空轮透传——客户端的响应流还开着,不能把"它"扣住);
  • 续拉自身的 429 判定喂 noteUpstreamThrottle429(为下一轮主道发送武装),其它已收敛状态喂 noteUpstreamThrottleResolved(解除)——与 relay 车道同样的"每请求一次观测"纪律。

回归钉(本 PR 新增)

tests/issue4743-degenerate-refetch-429.test.ts:

  • A:武装后续拉零上游命中、空轮透传(master 上必红:会真的打上游);
  • B:续拉自己的 429 武装治理器、resolved 解除(master 上必红:治理器收不到观测)。

已验证:master 双红 / 本分支双绿;degenerate 家族(loop-degenerate-retry 7 项、issue2756、issue4725-loop-429-observe)全绿;typecheck 0 错。

边界

@ranxianglei ranxianglei changed the title fix(wiring): degenerate-turn continuation retry joins the 429 governor (#4743) [PR] fix(wiring): degenerate-turn continuation retry joins the 429 governor (#4743) Oct 26, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复 —— 与 #4752(前序 PR,本 PR 声称 cherry-pick 其 ab6a7f1)、#4772(loop 车道其余三处 egress:preflight / compress-loop-responses / reasoning-guard)同属「429 治理器对 loop 车道出站失明」机制家族(#4743),但 egress 站点不同(degenerate-retry.ts 续拉),文件零重叠;#4752 若仍 open 则按先来后到应并入/关闭到本 PR,我核对中。

标签: pr + bug + scope/wiring + p3(与 #4743 floor 3 的分诊一致:当前无害——续拉有退化轮阶梯自限,危害面是持续 429 风暴下白烧上游名额)。

已拉取 head d3fa97b5eb(分支 2026-10-26_degenerate-429-governor),diff = src/degenerate-retry.ts +15 行、新增回归钉 tests/issue4743-degenerate-refetch-429.test.ts(+98)。正在独立验证:cherry-pick 与 ab6a7f1 逐字一致性、治理器契约(localReject 是否消耗 hold、keying)、relay 车道对照纪律、master 双红/分支双绿实测、CI 状态。结论稍后按八问补。

@ranxianglei ranxianglei added bug Something isn't working p3 scope/wiring labels Oct 26, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

PR #4802 审核结论(八问)

1. 是什么问题:退化轮续拉(degenerate-turn continuation refetch)是 loop 车道的一处出站发送,但对 429 治理器完全不可见——上游持续 429 时它照样打上游烧名额,已武装的 hold 也拦不住它。

2. 什么原因导致的:机制缺口而非实现错误。#4204 建治理器时只接了 relay 主道(src/server/relay.ts:821 门 / :1589-1590、:1637 观测);makeContinuationRefetch(src/degenerate-retry.ts)是独立的出站路径,从未接入。#4725 上线后 loop 主道已接,续拉成为残留盲区(#4743 floor 2 的站点清单)。

3. 影响范围与严重程度:持续 429 风暴 + 恰好出现空轮退化(渲染标签回显等场景)时触发;单发续拉被阶梯自限(每轮至多一次),所以当前无害——危害面是风暴期白烧上游并发名额、且续拉的 429 判定无法武装 hold 帮下一轮主道止损。p3,与 #4743 分诊一致。

4. 怎么修复的:把续拉按「普通出站发送」接入治理器,双向对齐 relay 纪律——发送前过 upstreamThrottleLocalReject(武装 hold 下本地应答:返回 null 走既有的「空轮透传」契约,客户端已开的响应流不被扣住);响应观测按每请求一次——429 喂 noteUpstreamThrottle429(带 retry-after),其它已收敛状态喂 noteUpstreamThrottleResolved。keying 用同一 holdKey(host+凭据指纹),与主道同池,多账号安全不变。

5. 是否有回归问题(逐项审过的既有行为):

  • 武装 hold 下续拉行为:旧=总打上游(烧名额)→ 新=本地应答、空轮透传。有意变更,PR 描述已披露;客户端可见结果(空轮透传)本就是该函数所有失败路径的既有兜底(signal aborted/compaction trigger/body 不可重建/上游拒绝),无新的客户端可见失败形态。
  • resign 时序:gate 在 resign 之后,resign 只改本次请求的 headers 对象,gate 拦截后随请求丢弃,无跨请求副作用。
  • probe 槽位:gate 放行时置 probeAt;若 fetch 抛错未产生判决,由治理器自带的 PROBE_INFLIGHT_TTL_MS(30s)自释兜底——与 relay 相同暴露面,设计内覆盖。
  • 非 429 错误状态清 hold:与 relay(:1589-1590)共用同一治理器契约(端点可达即清),非本 PR 新语义。
  • 未触碰:配置面、kernel、wire 形状、持久化、消息 id/ref 逻辑。结论:无意回归 0 处。

6. 是否破坏缓存:不涉及——不碰前缀缓存接缝、折叠账本、增量游标;只增加出站门与观测。

7. 是否改了设计方向:不涉及——沿用 #4204 治理器的既有契约与 relay 车道纪律,只是把一处遗漏的出站路径纳入同一机制(疏,不是堵)。

8. 是否引入了新的配置:无。

独立验证记录

  • cherry-pick 一致性:f8db49244 对 src/degenerate-retry.ts 的 diff 与 [PR] fix: review-findings wave — 7 fixes from the #4725 pre-release audit (P1×2 + P2×3 + P3×2) #4752 的 ab6a7f1 逐字节相同(+15 行),authorship 保留(ranxianglei ranxianglei@gmail.com 两边一致)。✅
  • RED/GREEN 实测(本地定向):master 上双红(A 会真打上游 hits=1;B 治理器收不到观测)/ 本分支双绿。✅
  • 家族回归:loop-degenerate-retry + issue2756 + issue4725-loop-429-observe + issue4204-throttle-governor + 本 PR 新增,共 32/32 绿。✅
  • typecheck:tsc --noEmit 0 错。✅
  • 测试有效性:两个钉都有牙且双向(gate 拦 egress / observe 武装 / resolved 解除 / 解除前持续武装),非恒真断言;小缺口:非 429 错误状态喂 resolved 的 else 分支没有独立钉(靠代码审阅+relay 侧契约测试覆盖,不构成拦截理由)。
  • CI:head d3fa97b 上仍在跑(45 queued / 35 cancelled 为被取代的旧 run / 0 hard failure),最终判定以 CI test 车道为准。

一个需要 owner 处置的重叠

#4752(review-findings wave,7 项修复)仍 open 且仍含 ab6a7f1——与本 PR 携带同一修复。按描述这是 owner 指示的摘出,但两 PR 并存意味着后合者会在 src/degenerate-retry.ts 冲突或变 no-op:#4802 先合 → #4752 需 rebase 丢掉该 commit;#4752 先合 → #4802 应关。agent 无权关闭任何 PR,请 owner 定合入顺序(建议:#4802 小而自洽先走,#4752 摘掉该 hunk 后继续)。

判定

代码与行为审核通过,可合(auto-merge 门禁各项亦满足:单模块 wiring fix+回归钉、rebased head 绿、无 config/kernel/wire/identity 触碰、纯 fix:/test:、diff 干净、Fixes #4743);合并动作留给人,合并前等 CI test 车道终判 + 上面 #4752 重叠的顺序拍板。

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-26_degenerate-429-governor (795cd6d)

Latest build — install this exact version

npm install -g billion-context@0.0.6233-pr.4802.39dc1e7

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

Recent builds (commit → version)

commit version build
795cd6d billion-context@0.0.6233-pr.4802.39dc1e7 build
75cbd71 billion-context@0.0.6135-pr.4802.1b5219a build
03d7747 billion-context@0.0.6049-pr.4802.21dd98b build

Download artifact

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

Install instructions are refreshed on each push.

ranxianglei and others added 2 commits October 26, 2026 18:13
#4743)

The retry is an egress send: observe-side feeds noteUpstreamThrottle429/
Resolved like any main-lane send (one observation per request), and the
gate answers locally under an armed hold instead of burning an upstream
slot — passing the empty turn through preserves the client's stream.
…aster)

Two pins for ab6a7f1 (cherry-picked from #4752): (A) an armed hold answers
the continuation refetch locally — zero upstream hits, empty turn passes
through; (B) the refetch's own 429 verdict arms the governor and a resolved
verdict lifts it. Both verified RED on master, green with the fix.
@ranxianglei
ranxianglei force-pushed the 2026-10-26_degenerate-429-governor branch from 75cbd71 to 795cd6d Compare October 26, 2026 10:14
@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: zhipuai-lb/glm-5.3)

冲突已解:分支重建为 origin/master + 两个内容 commit(66f170c 修复 + 795cd6d 回归钉),丢弃了 ci-fixes 扫车合并(其内容已全部在 master)。测试:4743 双钉 + degenerate 家族 + 429 契约 10/10,typecheck 0。

@ranxianglei
ranxianglei merged commit 341e76c into master Oct 26, 2026
49 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.853-master.341e76c (rolling master tag).

npm install -g billion-context@0.0.853-master.341e76c  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

yanhuojiyusheng pushed a commit to yanhuojiyusheng/billion-context that referenced this pull request Oct 26, 2026
… declaration for lockfile-only churn

kernel/package-lock.json is generated state, not kernel source. Agents' test
prep (npm install inside kernel/, sweep-bot merges of stale lockfiles) churns
it without any intent to change the kernel — 8 PRs (ranxianglei#4823 ranxianglei#4808 ranxianglei#4802 ranxianglei#4800
ranxianglei#4799 ranxianglei#4794 ranxianglei#4790 ranxianglei#4785) tripped the human gate on lockfile-only diffs, and
the previous stopgap (bots appending kernel-change: declarations to PR
bodies) was correctly rejected by the owner as bypassing the approval step.

The human gate exists to protect kernel SOURCE. Rule 1 now ignores
kernel/package-lock.json when deciding whether a PR 'touches kernel/'; real
source/build-config changes still require the declaration + owner approval,
and lockfile CONSISTENCY stays enforced by the separate lock-sync job (which
fails on genuine drift — the ranxianglei#4725 merge red being today's live proof).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working p3 scope/wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[wiring] 429 governor is invisible to the loop lane (compress round-2+ resends do not go through gate/observe)

1 participant