Skip to content

[PR] fix(web): conflict reports cover non-dsh clients — codex log signatures + observed client UAs - #4651

Closed
ranxianglei wants to merge 0 commit into
masterfrom
2026-10-25_conflict-report-codex-coverage
Closed

ranxianglei wants to merge 0 commit into
masterfrom
2026-10-25_conflict-report-codex-coverage

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #4649

What was broken

The web-panel diagnostics blob (#3040/#3611) recognized ONLY dsh clients:

  1. CONFLICT_LOG_PATTERNS (src/web/diagnostics.ts) was all dsh signatures — a conflict report from a codex session (ledger clients: codex, Compression conflict banner (bili v0.1.202, node v22.22.1, linux-x64) #4648) printed (no matching lines in the current log pair): not one of codex's compaction-evidence log lines matched.
  2. The --- host client versions --- section read only dsh profile bundles (DSH_REPORT_PACKAGES) and early-returned on machines without dsh profiles — so a codex report carried no client version at all, forcing manual codex --version + log round-trips for every such report.

Fix (host-side only — no kernel, no config surface)

① Codex evidence chain in CONFLICT_LOG_PATTERNS — one entry per distinct log site, byte shapes taken from the actual emitters:

② Bounded observed-UA registry (src/client-ua-registry.ts, new) — the proxy sees the requesting UA on every model request but never recorded it. Now:

Behavior changes (explicit, per policy)

  • Report content grows: every diagnostics blob gains an observed client user-agents: block under host client versions (≤12 lines + overflow note). Purely additive to the blob; no existing line moves or changes.
  • Conflict log tail can now match codex lines on machines running codex traffic — previously those lines were invisible there by design gap, not by choice.
  • New per-request cost: two Map lookups + bounded inserts — negligible vs the turn pipeline.

Tests

New tests/issue4649-conflict-report-client-coverage.test.ts (7 tests, hermetic):

Local: targeted suites green (new 7/7, web-diagnostics-enrichment 6/6, web-conflict-banner + conflict-lifecycle + conflict-remediation 44/44); typecheck clean; build + dist gates + unused-export gate clean. Full-suite verdict: remote CI on this head.

@ranxianglei ranxianglei changed the title fix(web): conflict reports cover non-dsh clients — codex log signatures + observed client UAs [PR] fix(web): conflict reports cover non-dsh clients — codex log signatures + observed client UAs Oct 25, 2026
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-25_conflict-report-codex-coverage (b6a9c57)

Latest build — install this exact version

npm install -g billion-context@0.0.6160-pr.4651.189a3f0

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
b6a9c57 billion-context@0.0.6160-pr.4651.189a3f0 build
9d33fd2 billion-context@0.0.6073-pr.4651.81a67e1 build
11d8b4d billion-context@0.0.5974-pr.4651.2de39c1 build
09f2fe3 billion-context@0.0.5886-pr.4651.ad278ba build
61a9270 billion-context@0.0.5819-pr.4651.9a66dc7 build
1f6bc5b billion-context@0.0.5691-pr.4651.5f771f6 build
110c128 billion-context@0.0.5690-pr.4651.8f4e1dc build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重结论:不重复——但存在一个同 issue 的并行 PR。 检索 open+closed issues/PRs(按失败签名与机制,不只标题):与本 PR 同机制的只有 #4650(同日、提交仅差 4 分钟、同 base master@bd29924d4、两者都写 Closes #4649)——同一 issue #4649 的两个并行修复。按「一个 issue 至多一个 PR」的 loop guard,只能合入一个。我已给 #4650 打 duplicate 标签并留说明评论,关不关由你拍板(agent 不自行关闭)。

两个 diff 我逐行读完了,推荐:保留本 PR(#4651)、关掉 #4650,理由:

  1. 模式覆盖:本 PR 用 4 条签名盖住全部 5 个 codex 日志站点(含 codex local auto-compaction detected,bili 对 Codex 原生压缩的拦截分支在本会话没进入(貌似自己截断自己了) #3008/[bug] Codex local auto-compaction can destroy existing bili fold substrate instead of rebasing #2372 —— orphan-reap 场景判定「哪种压缩形态未被识别」的关键证据行);[PR] feat: conflict report covers non-dsh clients — codex compaction log signatures + observed client hints #4650 只有 3 条,缺这条。
  2. 版本证据:本 PR 用进程级有界 UA 注册表(每请求记录,24 家族 × 8 UA 封顶,会话死亡后仍存活);[PR] feat: conflict report covers non-dsh clients — codex compaction log signatures + observed client hints #4650 复用每会话 clientHint——只在首请求记录且只列 live 会话,Compression conflict banner (bili v0.1.202, node v22.22.1, linux-x64) #4648 针对的场景恰恰是会话已被 reap(orphan-reap),那时报告里可能什么都剩不下。
  3. 测试:本 PR 7 个定向测试(双向 gate / 上限 / 驱逐 / 截断 / 家族阶梯 / publish 纪律);[PR] feat: conflict report covers non-dsh clients — codex compaction log signatures + observed client hints #4650 2 个。

一点坦率说明:严格按「先来后到」#4650 更早 4 分钟应保留,但它是被严格包含的较弱实现(issue #4649 自己的建议修法写的就是「有界最近观测 UA map」,即本 PR 的设计),保留它只会留下已知缺口。若你坚持先来后到,替代路径是把第 4 条模式+注册表移植进 #4650 分支再关本 PR——但那等于换个分支名重做一遍,我不推荐。

CI 现状:master 本身当前是红的(bd29924 全部 test shard 失败;#4599 总控里有 known born-red 记录,如 generation-boundary 调用参数数、unused-exports)。本 PR 失败的 shard 是 master 失败集合的子集 → 判为继承性红,不是本 PR 代码引入;master 转绿后重跑即可,无需在本分支排查红因。

代码审查已完成:方向正确(修的是 dsh-only 覆盖这个根因,不是症状层打补丁)、5 个 emitter 逐一与实际日志站点对上、未发现回归。完整八问结论随后一条评论给出。

标签:bug / codex / scope/ui / p3(缺陷修复;受益客户端为 codex 车道;web 诊断展示面;严重度=triage 摩擦,不影响代理功能本身)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

PR #4651 审查完成 —— 判定:代码可合入;待你拍板两件事(与并行 PR #4650 的收敛、CI 转绿后重跑)。

八问:

  1. 是什么问题:web 面板的冲突报告只会自证 dsh 客户端——日志签名全是 dsh 的、版本段只读 dsh profile 包;codex 等客户端的报告零证据行、无客户端版本,每次都得人工要日志和版本号(Compression conflict banner (bili v0.1.202, node v22.22.1, linux-x64) #4648 就是卡在这里)。
  2. 什么原因导致的:Compression conflict banner (bili v0.1.198, node v22.23.2, linux-x64) #3611 诊断增强是按 dsh 车道设计的(CONFLICT_LOG_PATTERNS 只有 dsh 签名、host client versions 只有 DSH_REPORT_PACKAGES);非 dsh 车道在磁盘上没有版本来源可读,而 bili 每个请求都看得到、且带版本的客户端 UA 从未被记录到任何地方。根因 = 非 dsh 车道的版本证据通路缺失,不是某个函数写错。
  3. 影响范围与严重程度:仅冲突报告 blob 的内容质量(triage 工具面),不影响代理功能/wire/压缩行为。严重度 = triage 摩擦(每次非 dsh 冲突多一轮人工往返),p3。
  4. 怎么修复的:两条腿——①CONFLICT_LOG_PATTERNS 加 4 条 codex 压缩签名(按日志站点一条,盖住全部 5 个站点,含两种 forge 形态共用的前缀);②新增进程级有界观测 UA 注册表(src/client-ua-registry.ts,24 家族 × 8 UA、LRU 驱逐、120 字符摄入上限),每个模型请求记一次,家族判定镜像冲突阶梯(declared plugin agent > header sniff > codex UA shape > other),versions 段在 dsh 部分之后输出 ≤12 行,且位于 no-dsh-profiles 早退路径之外(无 dsh profile 的机器也能出 UA)。
  5. 是否有回归问题(逐项审过的既有行为):
    • CONFLICT_LOG_PATTERNS 既有 5 条 dsh 签名:字节未动,测试钉住旧行仍命中 → 保持;
    • host client versions 段 dsh 部分:输出格式不变,早退改 if/else 语义等价(no-profile 提示保留)→ 保持;
    • 报告 blob 格式:纯增量(新增 observed client user-agents: 行),PR 已披露旧→新;blob 是给人粘贴的文本,无机器解析方受影响 → 有意变更,已披露;
    • redactForPublish 发布纪律([security][web] Storage diagnostics publish raw log lines and absolute paths | 存储诊断公开报告泄露本地路径和未脱敏日志 #4427):UA 是原始 header 字节,唯一出口是 sink 级整 blob 脱敏网,测试 7 钉住 credential 形字节不出现在 blob → 未破坏;
    • handleRequest 主路径:新增一次 recordClientUa(纯内存 Map 操作,无 IO、无抛错路径),调用点经核实在 session 解析之后、覆盖全部模型请求 → 无语义变化;
    • 性能:每请求成本 = 两次 Map 查找 + 有界插入(家族驱逐最坏 ~192 次时间戳扫描,仅在 24 家族占满时触发)→ 可忽略。
  6. 是否破坏缓存:不涉及——未触碰任何缓存/重试/游标/去重键。
  7. 是否改了设计方向:否。宿主侧 src/web/ + 一个新的小模块,kernel/wire/配置面未动(issue Conflict report blob only recognizes dsh clients — codex reports ship without client version or log evidence #4649 划定的范围,PR 严格落在范围内)。
  8. 是否引入新配置:无。没有新 env/config/CLI flag。

代码质量(⑤b 清单):命名达意、无常量外的魔法数字、无死代码、注释讲为什么(逐条带 issue 号)、风格与仓库一致(下划线测试导出沿用 _resetCandidateLogReadsForTest 既有惯例)、无新依赖。一处小 nit 不拦:recordClientUa 内 clientFamilyOf(headers) 最多重算 3 次(纯函数同输入同结果,无正确性问题,略冗余)。

测试有效性(④):7 个测试全有牙——双向 gate(正例站点全命中 / 负例行不进来)、上限钉死(10→8 驱逐、300→120 截断、24→12 显示上限+溢出注记)、家族阶梯(含 #645 token 级、#1641 mid-token 负例、#760b mcp 排除)、publish 纪律。此 bug 回归时这些测试抓得住。我本地独立复跑:新增 7/7 + enrichment 6/6 + redaction 5/5 全绿,typecheck clean。

diff 整洁度(⑤):4 文件 +342/-6,单 commit,每一行都与本修复相关,无跑题/空白噪音/lockfile churn。

CI:红是继承的——master@bd29924 本身全 shard 失败(#4599 总控有 born-red 记录),本 PR 失败 shard ⊆ master 失败集合,master 转绿后重跑即可。

结论:八问无拦项,代码审查通过,可合入。剩两个前置动作归 owner:①拍板与 #4650 的收敛(我的建议:保留本 PR、关 #4650,理由见上一条评论);②master CI 转绿后对本分支重跑一次拿全量绿。

ranxianglei added a commit that referenced this pull request Nov 7, 2026
…es + observed client UAs (#4649, picked up from PR #4651)

Rebased onto current master: hostClientVersionLines now carries master's
#5146 no-bare-?s profile wording inside the if/else restructure this fix
introduced (observed-UA lines stay outside the early-return path). Conflicts
in handle.ts import block resolved as union (billing + ua registry imports).
ranxianglei added a commit that referenced this pull request Nov 7, 2026
…es + observed client UAs (#4649, picked up from PR #4651)

Rebased onto current master: hostClientVersionLines now carries master's
#5146 no-bare-?s profile wording inside the if/else restructure this fix
introduced (observed-UA lines stay outside the early-return path). Conflicts
in handle.ts import block resolved as union (billing + ua registry imports).
ranxianglei added a commit that referenced this pull request Nov 7, 2026
…es + observed client UAs (#4649, picked up from PR #4651)

Rebased onto current master: hostClientVersionLines now carries master's
#5146 no-bare-?s profile wording inside the if/else restructure this fix
introduced (observed-UA lines stay outside the early-return path). Conflicts
in handle.ts import block resolved as union (billing + ua registry imports).
@github-actions github-actions Bot mentioned this pull request Nov 7, 2026
ranxianglei pushed a commit that referenced this pull request Nov 12, 2026
PR #4650 and the already-merged #4651 both modified the same #4649 lines
(non-dsh client conflict-report coverage). Resolution:
- #4649 content resolved to master's UA-registry implementation
  (observedUaLines / recentClientUas / OBSERVED_UA_LINES) — the PR's
  clientHint-based variant is superseded by #4651.
- Preserved this PR's unique contribution: the client-agnostic
  'zombie fold reap' (#2695) signature in CONFLICT_LOG_PATTERNS (#4688)
  and its regression test (converted to the now-async buildDiagnostics API).
- Dropped the two clientHint #4649 tests (redundant with master's
  dedicated tests/issue4649-conflict-report-client-coverage.test.ts) and
  the now-unused session import.

Net diff vs master: the #4649 doc comment + zombie-reap pattern + #4688 test.
@ranxianglei
ranxianglei force-pushed the 2026-10-25_conflict-report-codex-coverage branch from b6a9c57 to dd0ef22 Compare November 13, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working codex p3 scope/ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conflict report blob only recognizes dsh clients — codex reports ship without client version or log evidence

1 participant