Skip to content

[PR] feat(kernel,config): add opt-in compress.preserveFirstUser knob with single-pass prune scan - #7845

Open
feriaref wants to merge 1 commit into
ranxianglei:masterfrom
feriaref:pr/config-preserve-first-user
Open

feriaref wants to merge 1 commit into
ranxianglei:masterfrom
feriaref:pr/config-preserve-first-user

Conversation

@feriaref

@feriaref feriaref commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

no-close-object: opt-in stopgap related to #2031 and #2511 — intentionally does not auto-close #2511 pending owner design decision between opt-in drop vs user->user carrier

kernel-change: add opt-in preserveFirstUser config field (default true) in kernel/src/types.ts, kernel/src/prune.ts, and kernel/src/compress.ts; bump acp-kernel to 0.0.218 with synced lockfiles.

Summary

  • Keeps the 192版本缓存命中率低codex #2733 unconditional first-user pinning as the default (preserveFirstUser: true) so existing upstream prefix-cache invariants and tests remain byte-identical when unset.
  • Adds opt-in compress.preserveFirstUser: false (cascading global -> provider -> model) to allow dropping a covered opening user message once a later uncovered user turn survives (handling both id and ledgerSeq claims), preventing permanently bloated initial prompts from anchoring context floor growth.
  • Consolidates prune input indexing into a single pass over messages in kernel/src/prune.ts.
  • Threads preserveFirstUser through processTurn / fork / persist callers and documents compress.preserveFirstUser in website/config-reference/compress.yaml (+ regenerated docs).

Config surface

  • Added field: compress.preserveFirstUser (boolean, default true) inside the existing three-level compress hierarchy (global -> providers[<key>].compress -> providers[<key>].models[<model>].compress), mirroring kernel Config.preserveFirstUser.
  • Why existing surface cannot express it: kernel/src/prune.ts unconditionally pins the opening user message (192版本缓存命中率低codex #2733) inside the kernel prune pass with no existing opt-out knob. A host-side rewrite cannot drop a covered opening user message cleanly because the kernel owns coverage claims (id + ledgerSeq), block-summary anchoring, and fork/persist replay invariants.
  • Existing mechanisms considered: Placed directly under the existing three-level compress cascade (parseCompressSettings / mergeCompress / applyCompressSettings) rather than introducing a new top-level section, env var, or CLI flag.
  • Compat / migration: Default is true, keeping default behavior byte-identical to master. Setting false is opt-in and reversible with no storage-schema migration.

Relationship to #2031 / #2511 (HOLD — awaiting owner design decision)

Verification

  • Rebased cleanly onto master (c18f6b7de, including commit 0682f5bea which fixes the 3 eg_debug table-count tests); single linear commit (60002b95b), acp-kernel bumped 0.0.217 -> 0.0.218 with synced lockfiles.
  • npm --prefix kernel test: all tests pass (including kernel/tests/dynamic-first-user-prune.test.ts).
  • tests/preserve-first-user-config.test.ts and tests/compress-settings.test.ts (43/43) pass.
  • npm run typecheck, gen-config-docs generate (zero drift), gen-config-docs check-coverage, config-surface-guard, check-unused-exports, check-test-import-graph, check-architecture-docs, and lifecycle-ledger-guard all pass.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

🔶 需要决策
(ai: vllm-qwen/qwen3.8-27b)

查重: 不重复,但同机制族——与 open #2031(目标追踪)/ #2511(kernel feat)同属「首条 user 消息处理」。机制不同:#2511 = user→user 载体(把首条 user 压缩成保留执行目标的短 user 消息,槽位保留);本 PR = drop(首条 user 被覆盖且有后续未覆盖 user 存活时整条丢弃,内容只进 block summary)。#2031/#2511 明确写了「设计未拍板前不要实现」,本 PR 未引用它们、未走 owner 设计拍板。

背景一句话: 本 PR 加 opt-in compress.preserveFirstUser: false(首条 user 被覆盖且有后续未覆盖 user 存活时整条丢弃),与 owner 自己 open 的 #2031/#2511(首条 user 独立压缩 = user→user 载体、保留槽位)同机制族但机制冲突,且 #2031/#2511 明确「设计未拍板前不要实现」。

待决问题: 首条 user 的处理走哪条路?

我的推荐: B 或 C。owner 在 #2031/#2511 提议的是「保留槽位、缩而非丢」;本 PR 的 drop 更激进(丢),与 owner 方向不一致。若 owner 认可 drop 作为独立 opt-in,补下面流程缺口后可合;否则把本 PR 并入 #2511。

不决定的默认行为: PR 保持 open(HOLD),不合。


代码与行为(本地定向验证,非全量):

  • 默认路径字节级不变:preserveFirstUser !== false → pinnedUserIndex = fallbackFirstUserIndex(= 原 firstUserIndex),rebuildMessages 的 pin / anchor clamp / multimodal run 保护全走原路径。
  • 单遍扫描重构行为等价:baseIndexById(最早位置)、summaryIndexById(最后位置)、visibleCompressCallIds(inject 门控)、lastUserIndex 逐条核对与原多遍扫描等价。
  • opt-in 隔离良好:preserveFirstUser === false → pinnedUserIndex = hasUncoveredUser ? -1 : fallbackFirstUserIndex;hasUncoveredUser 用与 rebuildMessages 相同的覆盖判定(id base + seq interval),「≥1 user 存活」不变量成立(被计为 uncovered 的 user 必然过 covered 检查;user 消息不会是 rendered summary,不会被 knownSummaryIds 误删)。
  • 定向测试全绿:新 kernel 4/4、新 root 1/1、既有 compress-settings 43/43、既有 prune 族 55/55。默认路径无回归。

八问:

  1. 是什么问题: 功能(非 bug)——opt-in compress.preserveFirstUser: false,首条 user 被覆盖且有后续未覆盖 user 存活时整条丢弃;全 user 被覆盖时回退 pin(保证严格 provider 仍见 ≥1 user)。默认 true = 现状不变。
  2. 什么原因: 192版本缓存命中率低codex #2733 的首条 pin 无条件保留首条 user,大的首条 user 永远缩不小(Tracking: First user message independently compressed (user→user carrier) — goal tracking + bili-side work items | Tracking: 首条用户消息独立压缩(user→user 载体)—— 目标追踪 + bili 侧工作项 #2031/[Kernel] feat: Independent compression of the first user message — user→user carrier (preserving the leading user slot and long-term execution goal) | [内核] feat: 首条用户消息独立压缩 —— user→user 载体(保留头部 user 槽位与长期执行目标) #2511 的「degenerate 形状永久膨胀」缺口)。本 PR 给一个 opt-out 把被覆盖的首条 user 丢掉。
  3. 影响范围与严重程度: 仅 opt-in(默认零行为变更)。只有显式设 preserveFirstUser: false 的用户受影响;对他们:首条 user 被丢时前缀缓存失效、内容只进 summary。严重度:低(opt-in、默认不变)。
  4. 怎么修: prune() 单遍扫描算出 pinnedUserIndex 传给 rebuildMessages 替代原 firstUserIndex;processTurn / persist / plugin 三个调用点把 effectiveConfig.preserveFirstUser 透传进去。
  5. 回归风险: 默认路径字节级不变(已核对 + 既有 prune 族 55 测试全绿);opt-in 路径是新行为,无既有行为被破坏。
  6. 是否破坏缓存: 是,对 opt-in 用户——首条 user 被丢时前缀缓存失效(与 192版本缓存命中率低codex #2733「提命中率」目标相反);且首条 user 随覆盖状态动态出现/消失,前缀不稳定。这是 opt-in 的明确代价,但应在文档里说清。
  7. 是否改了设计方向: 在 Tracking: First user message independently compressed (user→user carrier) — goal tracking + bili-side work items | Tracking: 首条用户消息独立压缩(user→user 载体)—— 目标追踪 + bili 侧工作项 #2031/[Kernel] feat: Independent compression of the first user message — user→user carrier (preserving the leading user slot and long-term execution goal) | [内核] feat: 首条用户消息独立压缩 —— user→user 载体(保留头部 user 槽位与长期执行目标) #2511 同机制族内,但机制不同(本 PR drop vs [Kernel] feat: Independent compression of the first user message — user→user carrier (preserving the leading user slot and long-term execution goal) | [内核] feat: 首条用户消息独立压缩 —— user→user 载体(保留头部 user 槽位与长期执行目标) #2511 user→user 载体保留槽位)。Tracking: First user message independently compressed (user→user carrier) — goal tracking + bili-side work items | Tracking: 首条用户消息独立压缩(user→user 载体)—— 目标追踪 + bili 侧工作项 #2031/[Kernel] feat: Independent compression of the first user message — user→user carrier (preserving the leading user slot and long-term execution goal) | [内核] feat: 首条用户消息独立压缩 —— user→user 载体(保留头部 user 槽位与长期执行目标) #2511 是 owner 提议、open、明确「设计未拍板前不要实现」;本 PR 未引用、未拍板就实现了更激进(丢而非缩)的机制。
  8. 是否引入了新的配置: 是,compress.preserveFirstUser(boolean,默认 true),加在既有 compress 三级体系里。机械面完整(yaml + en/zh/ja docs + parse + merge + apply),但 PR 正文缺 config-surface 纪律要求的「config surface」段(为什么现有面表达不了 / 考虑过哪些既有机制 / 兼容与迁移)。

流程缺口(合并前必须补):

  1. PR 正文缺「config surface」段(config-surface 纪律:加配置字段的 PR 没这段 = 定义上 incomplete)。
  2. 未引用 Tracking: First user message independently compressed (user→user carrier) — goal tracking + bili-side work items | Tracking: 首条用户消息独立压缩(user→user 载体)—— 目标追踪 + bili 侧工作项 #2031/[Kernel] feat: Independent compression of the first user message — user→user carrier (preserving the leading user slot and long-term execution goal) | [内核] feat: 首条用户消息独立压缩 —— user→user 载体(保留头部 user 槽位与长期执行目标) #2511(本机制族的追踪单),也未说明本 PR 的 drop 机制与 [Kernel] feat: Independent compression of the first user message — user→user carrier (preserving the leading user slot and long-term execution goal) | [内核] feat: 首条用户消息独立压缩 —— user→user 载体(保留头部 user 槽位与长期执行目标) #2511 的 user→user 载体是什么关系(独立子集?还是应并入 [Kernel] feat: Independent compression of the first user message — user→user carrier (preserving the leading user slot and long-term execution goal) | [内核] feat: 首条用户消息独立压缩 —— user→user 载体(保留头部 user 槽位与长期执行目标) #2511?)。
  3. Tracking: First user message independently compressed (user→user carrier) — goal tracking + bili-side work items | Tracking: 首条用户消息独立压缩(user→user 载体)—— 目标追踪 + bili 侧工作项 #2031/[Kernel] feat: Independent compression of the first user message — user→user carrier (preserving the leading user slot and long-term execution goal) | [内核] feat: 首条用户消息独立压缩 —— user→user 载体(保留头部 user 槽位与长期执行目标) #2511 明确「设计未拍板前不要实现」,本 PR 未走 owner 设计拍板。
  4. kernel 改动:已声明 kernel-change,但 Kernel Boundary 要求 kernel 改动需 owner 经专门 issue 预先批准(说明 host 侧为何解不了);本 PR 未引用这样的 issue(最接近的是 [Kernel] feat: Independent compression of the first user message — user→user carrier (preserving the leading user slot and long-term execution goal) | [内核] feat: 首条用户消息独立压缩 —— user→user 载体(保留头部 user 槽位与长期执行目标) #2511,但那是不同设计)。

判定: HOLD,等 owner 拍设计方向(见上 A/B/C)。代码本身干净(默认字节级不变、opt-in 隔离好、测试真实且全绿),但 feat + kernel 改动 + config schema 变更三者都在「must stay human」档;且与 owner 自己 open 的 #2031/#2511(user→user 载体)机制冲突——owner 需先决定走哪条路,拍板前不合。

(注: needs-decision 标签未能打上——本环境 label 工具不可用。)

@ranxianglei
ranxianglei force-pushed the pr/config-preserve-first-user branch from fc4841c to ee06360 Compare November 27, 2026 04:54
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

Conflict resolved — PR head rebased onto current master, merge state is clean.

What I did this run:

  1. Diagnosis: the PR (external head feriaref:pr/config-preserve-first-user @ fc4841c, single commit) conflicted with master — master had advanced 60 commits past the PR base (0a133d9). All three conflicts were the same mechanical line: the acp-kernel version. The PR bumped it 0.0.211 → 0.0.212, but master had already carried it to 0.0.214 (the verif translator: key presence check for conditional double spread is under-approximated; proofs using in may falsely | verif 翻译器:条件双 spread 的 key 在场判定欠近似,用到 in 的证明可能误报 UNSAT(假绿) #7823/responses wire: silently drops images when sidecar image count mismatches the declared count (violates never-drop-conten | responses wire:sidecar 图数与计数对不上时静默丢图(违反 never-drop-content,kernel/src/wire/responses.ts:921) #7824/cross-wire byte-stable golden only covers openai/google — extend to anthropic/responses, two lanes | cross-wire 字节稳定 golden 只覆盖 openai/google——扩展 anthropic/responses 两条 lane #7825 bump chain).
  2. Rebase of the PR commit onto master (4cad860). The three version conflicts were resolved to 0.0.215 (master's 0.0.214 + 1 — required by Kernel Boundary rule 2 since the commit touches kernel/src/**), with kernel/package-lock.json and the root package-lock.json synced to match. Everything else auto-merged; I verified hunk-by-hunk that master had NOT touched kernel/src/prune.ts|types.ts|compress.ts, src/config.ts, src/compress-settings.ts, or the yaml seed since the PR base, and that master's own changes to src/persist.ts/src/plugin.ts/docs survived the merge intact.
  3. Push: force-pushed the rebased head ee063607a57 (authorship preserved: feriaref) to the PR head branch on the fork, with an explicit lease (branch tip verified unchanged before the push). PR is now mergeable: true; state blocked = checks running + the pending owner decision, not a conflict. (I initially mirrored to a pr-7845 branch in the main repo, but the GitHub API cannot retarget an existing PR's head — so that mirror branch was deleted and the rebased head went to the fork branch instead.)
  4. Verified on the rebased head locally: npm run typecheck clean; all static guards green (lock-sync idempotent on both lockfiles, docs-sync regenerate-no-drift, docs-coverage, config-surface-guard, unused-exports, test-import-graph, architecture-docs, lifecycle-ledger-guard); targeted tests green — new kernel test dynamic-first-user-prune 4/4, new root test + compress-settings 44/44, kernel prune family (8 files) 93/93, fork-adoption 2/2. The full-suite verdict is the CI test lanes on the pushed head (25 check runs now running).

Note for the record: the PR body says "bump acp-kernel to 0.0.212" — the rebased head carries 0.0.215 instead (master already carried 0.0.214). Recorded in the commit message; no PR-body edit (out of my lane).

The PR remains in the HOLD state from the earlier review (🔶 需要决策, floor 2): the design question (this PR's drop mechanism vs #2031/#2511's user→user carrier) is still the owner's call — conflict resolution does not change that, and I did not touch it.

八问:

  1. 是什么问题: PR 与 master 冲突(dirty)——master 已前进 60 个提交,三处冲突全是 kernel 版本号行(PR 从 0.0.211 提到 0.0.212,master 已到 0.0.214)。
  2. 什么原因导致的: PR 基于 0a133d9 开发,期间 master 合入了 verif translator: key presence check for conditional double spread is under-approximated; proofs using in may falsely | verif 翻译器:条件双 spread 的 key 在场判定欠近似,用到 in 的证明可能误报 UNSAT(假绿) #7823/responses wire: silently drops images when sidecar image count mismatches the declared count (violates never-drop-conten | responses wire:sidecar 图数与计数对不上时静默丢图(违反 never-drop-content,kernel/src/wire/responses.ts:921) #7824/cross-wire byte-stable golden only covers openai/google — extend to anthropic/responses, two lanes | cross-wire 字节稳定 golden 只覆盖 openai/google——扩展 anthropic/responses 两条 lane #7825(kernel 0.0.212→0.0.214 的 bump 链),版本号行文本冲突;其余文件无冲突。
  3. 影响范围与严重程度: 仅冲突解决本身——不改变 PR 的任何行为;PR 代码语义与提交前完全一致(默认路径字节级不变,既有测试钉住)。
  4. 怎么修复的: 把 PR 单提交 rebase 到 master(4cad860),三处版本冲突统一解为 0.0.215(master 0.0.214+1,Kernel Boundary 规则 2 要求 kernel/src 变更必须 bump),两个 lockfile 同步;force-push(显式 lease)到 PR head 分支(fork)。
  5. 是否有回归问题: 无——逐 hunk 核对了 auto-merge 结果:PR 触碰的 kernel/src 三文件、config 管线、yaml 种子在 PR base 之后 master 均未改动;master 对 persist/plugin/docs 的改动完整保留;本地 typecheck + 8 个静态 guard + 定向测试(4+44+93+2)全绿。
  6. 是否破坏缓存: 不涉及——冲突解决不触碰任何缓存/重试/游标逻辑。
  7. 是否改了设计方向: 不涉及——仅机械性 rebase + 版本对齐;PR 本身的设计问题(drop vs Tracking: First user message independently compressed (user→user carrier) — goal tracking + bili-side work items | Tracking: 首条用户消息独立压缩(user→user 载体)—— 目标追踪 + bili 侧工作项 #2031/[Kernel] feat: Independent compression of the first user message — user→user carrier (preserving the leading user slot and long-term execution goal) | [内核] feat: 首条用户消息独立压缩 —— user→user 载体(保留头部 user 槽位与长期执行目标) #2511 载体)仍在等 owner 拍板(floor 2 的 🔶 需要决策 不变)。
  8. 是否引入了新的配置: 不涉及(冲突解决未新增配置;PR 原有的 compress.preserveFirstUser 字段随 rebase 原样保留,默认 true)。

判定: 冲突已解决,merge state 从 dirty 转为可合(当前 blocked = CI 在跑 + 等 owner 设计拍板);CI 全绿 + owner 拍板后由 owner 合并。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

No action needed this run — the conflict was already resolved by the previous run; this wake fired on a stale mirror snapshot.

Verified live in this run (not from memory):

  • Mirror cache is stale: its snapshot is frozen at 04:46:01Z on the OLD head fc4841c with state dirty — that predates the fix push (~04:54Z). The live upstream state is different.
  • Live PR state (single API read): head = ee063607a57 (the rebased head pushed by the previous run), base = master 4cad86035b3 (unchanged since the rebase — master has not moved), mergeable: true. No conflict exists anymore.
  • CI on the rebased head: 30 check runs — kernel-guard already success (the kernel-change: body declaration is accepted), gate 5 success / 6 queued, remaining guards + test lanes queued, e2e lanes waiting on the gate. No red items. All static guards and targeted tests were already verified green locally on this exact head in the previous run (typecheck, lock-sync, docs-sync, docs-coverage, config-surface, unused-exports, test-import-graph, architecture-docs, lifecycle-ledger; tests 4+44+93+2).

Nothing was pushed, nothing was changed. The PR stays in its HOLD state from the earlier review (🔶 需要决策, floor 2): merge is gated on the owner's design decision (this PR's drop mechanism vs #2031/#2511's user→user carrier) plus the CI test lanes finishing — both outside this lane.

八问:

  1. 是什么问题: 本次唤醒是重复触发——镜像缓存停在旧快照(旧 head fc4841c、dirty),而上游实际状态已无冲突。
  2. 什么原因导致的: 镜像轮询器的快照冻结在 04:46:01Z(早于上一轮 04:54Z 的修复推送),未刷到新 head。
  3. 影响范围与严重程度: 无实际影响——仅触发了一次空跑;PR 状态本身健康。
  4. 怎么修复的: 无需修复——本轮只做活体核验(镜像缓存 + 单次 GitHub API 读 PR 状态 + 单次读 check-runs),确认冲突已解、无红项,未做任何推送或改动。
  5. 是否有回归问题: 无——未触碰任何代码。
  6. 是否破坏缓存: 不涉及。
  7. 是否改了设计方向: 不涉及。
  8. 是否引入了新的配置: 不涉及。

判定: 冲突已解决且保持干净(mergeable: true);CI 在跑、无红项;等 CI 全绿 + owner 对 floor 2 设计问题拍板后由 owner 合并。本 lane 当前无事可做。

@ranxianglei
ranxianglei force-pushed the pr/config-preserve-first-user branch from ee06360 to fb89163 Compare November 29, 2026 18:34
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

Conflict resolved again — master moved ~3.5 days (76 files) past the PR's base, and the branch was rebased onto the new master.

What happened this run (verified live, not from memory):

Unchanged: the PR remains in HOLD from the earlier review (🔶 需要决策, floor 2 — this PR's drop mechanism vs #2031/#2511's user→user carrier). That is the owner's design call; merge stays with the owner after the decision + CI green.

八问:

  1. 是什么问题: master 在 PR 基线上前进了约 3.5 天(76 个文件),PR 分支与新 master 再次冲突(自首次提交以来的第二次 dirty)。
  2. 什么原因导致的: master 新提交(egress 平面、kernel crush 整体移除 + [Bug][kernel] Kernel diagnostics writing directly to host TUI + funnel-zero treating normal state as fault (pi inline la | [Bug][kernel] kernel 诊断直写宿主 TUI + funnel-zero 把常态当故障(pi inline 车道每回合刷 3–6 行) #7791 warn sink、watermark GA 收回 [Bug][pi] Host's one-shot context injection is pinned to the wire slot → the immediately following tool result becomes o | [Bug][pi] 宿主的一次性上下文注入被钉在 wire 槽位上 → 紧随的 tool 结果成为孤儿 → 上游 400 "Messages with role 'tool' must be a response to a preceding message w… #7960 等)触碰了与 PR 相同的文件(kernel 版本行、kernel/src/compress.ts、types.ts、src/config.ts、三份 docs),PR 仍基于旧 master。
  3. 影响范围与严重程度: 仅影响本 PR 的可合并性(dirty 挡合并),无用户影响;修复后 mergeable: true。
  4. 怎么修复的: rebase 到 master 5bb3eb2;3 处冲突全是 kernel 版本行(master 0.0.217 vs PR 0.0.215)→ 解为 0.0.218(master + 1,PR 改了 kernel/src 必须 bump),两个 lockfile 同步;内容文件全部自动合并,逐 hunk 确认双方改动都在。
  5. 是否有回归问题: 本次 rebase 未引入新回归——typecheck 干净、8 项静态守卫 + lock-sync 全绿、定向测试全绿(4+44+51)。注意:tests/fork-adoption-wires.test.ts 有 2 个失败,经干净 master 复跑验证为既有失败(同签名),非本 PR 回归;若 CI 因此红,按 CI 协调政策走 CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599/ci-fixes,不在本 PR 分支内修 master 级问题。
  6. 是否破坏缓存: 不涉及。
  7. 是否改了设计方向: 不涉及——纯冲突解决,PR 的 16 文件 diff 内容不变(226+/54−)。
  8. 是否引入了新的配置: 不涉及(版本行 0.0.215→0.0.218 是 Kernel Boundary 强制 bump,非配置项)。

判定: 冲突已解决(mergeable: true),CI 在新 head 上运行;PR 保持 HOLD,等 owner 对 floor 2 设计问题拍板后由 owner 合并。

@feriaref
feriaref force-pushed the pr/config-preserve-first-user branch from fb89163 to 60002b9 Compare November 30, 2026 05:29
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

close-object-guard fixed — PR head 60002b95ba is now fully CI-green. No code changes, no push, no PR-body edit: the fix was a single ci:force label add.

What was red and why (verified live this run, not from memory):

  1. The red was a body-text race, not a missing fix. The guard job (run 46359966035, 05:29:58Z) evaluated the PR body as captured at push-event time — the job log shows PR_BODY still carrying the ORIGINAL body (0.0.212, no flag line). The body was rewritten seconds after the push (now starts with no-close-object: opt-in stopgap related to #2031 and #2511 — …, plus the Config-surface and Tracking: First user message independently compressed (user→user carrier) — goal tracking + bili-side work items | Tracking: 首条用户消息独立压缩(user→user 载体)—— 目标追踪 + bili 侧工作项 #2031/[Kernel] feat: Independent compression of the first user message — user→user carrier (preserving the leading user slot and long-term execution goal) | [内核] feat: 首条用户消息独立压缩 —— user→user 载体(保留头部 user 槽位与长期执行目标) #2511-relationship sections). The current body already satisfies the guard's carve-out regex (^[[:space:]]*no-close-object:[[:space:]]*\S, .github/workflows/ci.yml:503) — the job just never saw it, because a body edit alone fires no new pull_request event and a job re-run would replay the same stale payload.
  2. Secondary finding — the test lanes of that run were all skipped by the stale-PR gate ([CI] every label fires a no-op CI run, and PRs older than 72h still pay a full matrix per push — | 任意 label 都触发一轮空转 CI,且超过 72 小时的老 PR 每次推送仍跑完整矩阵 #7785). The PR is 73.5h old (created 2026-11-27 04:00Z, run 05:30Z) > STALE_HOURS=72, and it carried no ci:force label, so the plan job scoped the run to skip: even had the guard passed, the branch would have had no real test pass on this head.

The fix: added the ci:force label (the documented re-arm for exactly this case — tests/ci-stale-pr-gate.test.ts:110 pins "labeled event with ci:force on a 73h PR -> core"). The labeled event fired a fresh run (46361026262) that read the CURRENT body:

  • close-object-guard: success (flag line now visible to the guard);
  • plan: scope=core (stale gate re-armed); all 13 guards + mysql-contract + static-gates + all 11 test shards: success; run concluded success at 05:52:49Z (28/29, the one skip is red-signal, which only runs when something is red);
  • all e2e lane workflows on the head (codex/dsh/pi/opencode/registry/image/persona/ws lanes): completed success.

State at finish: head 60002b95ba sits on current master c18f6b7dece (base unchanged since — no new conflict), mergeable: true. The ci:force label stays on the PR (it is the re-arm; removing it would re-stale the next ordinary push). The PR remains in the HOLD state from the earlier review (🔶 需要决策, floor 2 — drop mechanism vs #2031/#2511 user→user carrier): merge stays the owner's call after that decision; CI is no longer part of the blocker.

Note for the record: the mirror check-cache went stale twice this run (frozen at 05:34:00Z, then 05:43:31Z, ~10-15 min behind) — final green was verified via single live API reads of the run and its jobs, not by gh-polling.

八问:

  1. 是什么问题: 红项 close-object-guard 是误报——守卫读到的是推送瞬间的旧 PR 正文(无 no-close-object: 行),而正文在推送后几秒内已被改写补上了该行;同一次运行里全部测试 lane 又被 stale-PR 门(>72h)跳过,分支拿不到真实测试通过。
  2. 什么原因导致的: 两个独立机制叠加:①pull_request 事件的 payload 在推送瞬间冻结,正文后补的 flag 行对已触发的运行不可见(重跑 job 也是回放同一 payload);②PR 创建满 73.5 小时 > STALE_HOURS=72 且无 ci:force 标签,plan job 把矩阵 scope 判为 skip([CI] every label fires a no-op CI run, and PRs older than 72h still pay a full matrix per push — | 任意 label 都触发一轮空转 CI,且超过 72 小时的老 PR 每次推送仍跑完整矩阵 #7785 防 CI 洪水门)。
  3. 影响范围与严重程度: 仅本 PR 的 CI 状态——代码零改动、行为零变化;严重度低(一个机械性红项 + 一次被跳过的测试矩阵,均无用户影响)。
  4. 怎么修复的: 不加代码、不改正文、不推提交——打上 ci:force 标签(仓库文档化的 stale-PR 重新武装机制,有测试钉住):labeled 事件触发新运行,读到当前正文(flag 行命中 carve-out 正则)且矩阵恢复 core scope,一次运行同时清掉红项和跳过。
  5. 是否有回归问题: 无——未触碰任何代码/配置/正文;新运行 28/29 全绿(唯一 skip 是 red-signal,设计上只在有红时运行),9 条 e2e lane 全 success;head 仍在当前 master c18f6b7dece 上,无冲突。
  6. 是否破坏缓存: 不涉及。
  7. 是否改了设计方向: 不涉及——只用了既有的 ci:force 重新武装机制,未改任何 workflow 逻辑。
  8. 是否引入了新的配置: 不涉及(PR 原有的 compress.preserveFirstUser 字段随分支原样保留,默认 true;ci:force 是既有 CI 标签,非配置项)。

判定: 红项已清、head 全绿(镜像缓存滞后,已用单次活体 API 读确认);PR 保持 HOLD,等 owner 对 floor 2 设计问题(drop vs #2511 载体)拍板后由 owner 合并。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei
ranxianglei force-pushed the pr/config-preserve-first-user branch from 60002b9 to 95674c5 Compare December 3, 2026 09:35
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

Merge conflict resolved — PR rebased onto current master, conflict cleared.

The PR head (60002b95ba3) was based on c18f6b7dece, but master had advanced 101 commits since then (kernel version moved 0.0.217 → 0.0.220, plus storage/egress/test changes across 152 files), so the PR went dirty/non-mergeable.

What I did this run:

  1. Verified live state first — confirmed the conflict was real (master 101 commits ahead, mergeable_state: blocked), not a stale report.
  2. Rebased the PR head onto current master f09a4879aeb.
  3. Resolved the 3 conflicts — all on the acp-kernel version line (kernel/package.json, kernel/package-lock.json, package-lock.json). The PR had bumped the kernel to 0.0.218; master already carried 0.0.220, so I realigned to 0.0.221 (master + 1, required by Kernel Boundary rule 2 since the PR touches kernel/src/**). All other 13 files auto-merged byte-identical to the original PR (16 files, 226+/54− unchanged).
  4. Verified locally: typecheck clean; lock-sync idempotent on both lockfiles at 0.0.221; docs-sync + docs-coverage OK; targeted tests green — kernel dynamic-first-user-prune 4/4, root preserve-first-user-config + compress-settings 44/44, kernel prune-family 47/47.
  5. Pushed the final head 95674c5fa3f to feriaref:pr/config-preserve-first-user (force-with-lease, authorship preserved as feriaref, rebase note appended to the commit body). This is the branch's one full CI pass (no [ework:ci-held] marker).

Live result: PR is now mergeable: true. The new CI run has all fast gates green — close-object-guard, kernel-guard, lane-guard, lock-sync, docs-sync, docs-coverage, version-guard, pi-subagents-guard, unused-exports, architecture-docs, build-artifact — with only the long test shards still in progress and zero failures so far. The ci:force label is still on the PR, so the test lanes run at full scope (not stale-skipped).

The PR remains in HOLD pending the owner's design decision (floor 2 🔶 需要决策: this PR's drop mechanism vs #2031/#2511 user→user carrier) — merge is the owner's call, untouched by this CI fix.


八问(中文结构化结论)

  1. 是什么问题:PR 分支落后 master 101 个提交,与目标分支产生合并冲突(merge state: dirty),无法合并。
  2. 什么原因导致的:master 在此期间推进了 101 个提交(内核版本 0.0.217→0.0.220,外加 storage/egress/测试等 152 个文件变更),而 PR head 仍基于旧 base c18f6b7dece。冲突集中在 acp-kernel 版本行(PR 升到 0.0.218,master 已到 0.0.220)。
  3. 影响范围与严重程度:仅影响本 PR 的可合并性——rebase 前无法合并。无用户影响(PR 本就处于 HOLD,等 owner 设计决策)。
  4. 怎么修复的:把 PR head rebase 到当前 master f09a4879aeb,3 处版本行冲突统一对齐到 0.0.221(master 0.0.220 + 1,因 PR 触及 kernel/src/**,按 Kernel Boundary 规则 2 必须 bump);其余 13 个文件全部字节级自动合并,PR 内容零改动。
  5. 是否有回归问题:无。rebase 只动了版本行,16 个文件的逻辑 hunk 与原 PR 逐字节一致(226+/54− 不变)。本地验证:typecheck 干净、双 lockfile 幂等、docs-sync/coverage 通过、定向测试全绿(kernel 4/4、root 44/44、prune 家族 47/47)。
  6. 是否破坏缓存:不涉及。未触碰任何缓存/重试/游标/去重逻辑,版本 bump 是机械对齐。
  7. 是否改了设计方向:不涉及。纯 rebase,无设计变更;PR 自身的 preserveFirstUser 设计原样保留,仍处 HOLD 待 owner 拍板。
  8. 是否引入了新的配置:本次 rebase 未引入任何新配置。PR 本身新增的 compress.preserveFirstUser(默认 true)是 PR 原有内容,非本次操作引入。

判定:冲突已解决、rebase 已验证、CI 快门禁全绿、仅剩长测 shard 在跑(零失败)。本 CI 车道工作完成。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

…single-pass prune scan

Keep ranxianglei#2733 unconditional first-user pinning as the default
(preserveFirstUser: true) so upstream prefix-cache invariants hold
without rewriting tests, while allowing preserveFirstUser: false to
dynamically drop covered opening user messages when later uncovered user
turns survive (covering both id and ledgerSeq claims).

Consolidate prune input indexing into one pass over messages, thread
preserveFirstUser through processTurn/fork/persist callers, and
document compress.preserveFirstUser in website/config-reference/compress.yaml.

Rebased onto master 4cad860 (conflict resolution): kernel version
realigned 0.0.212 -> 0.0.215 (master already carried 0.0.214); kernel
and root lockfiles synced to match.

Rebased onto master 5bb3eb2 (conflict resolution): kernel version realigned 0.0.215 -> 0.0.218 (master already carried 0.0.217); kernel and root lockfiles synced to match.
Rebased onto master f09a487 (conflict resolution): kernel version realigned 0.0.218 -> 0.0.221 (master already carried 0.0.220); kernel and root lockfiles synced to match.
Rebased onto master 2e2b30a (conflict resolution): kernel version realigned 0.0.221 -> 0.0.224 (master already carried 0.0.223); kernel and root lockfiles synced to match.
@ranxianglei
ranxianglei force-pushed the pr/config-preserve-first-user branch from 95674c5 to 14906ea Compare December 5, 2026 20:11
@ranxianglei

ranxianglei commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen4-35b-a3b

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

Merge conflict resolved again — PR rebased onto current master, conflict cleared.

Master advanced 223 more commits since the last rebase (f09a4879aeb → 2e2b30a84, 285 files, +40602/−1394), so the PR went dirty again. This is the 4th rebase for this PR (previous: 4cad86035b3, 5bb3eb2cd9a, f09a4879aeb).

What I did this run:

  1. Verified live state first — confirmed the conflict was real (head 95674c5fa3f based on f09a4879aeb, master now at 2e2b30a84, mergeable_state: dirty).
  2. Rebased the PR head onto current master 2e2b30a84.
  3. Resolved the 3 conflicts — all on the acp-kernel version line (kernel/package.json, kernel/package-lock.json, package-lock.json). The PR carried 0.0.221; master already moved to 0.0.223, so I realigned to 0.0.224 (master + 1, Kernel Boundary rule 2 — the PR touches kernel/src/**). This time master also touched src/config.ts and website/config-reference/compress.yaml (the PR's own files) — both auto-merged cleanly, no semantic conflict. All 16 files end up byte-identical in content to the original PR (226+/54− unchanged).
  4. Verified locally: typecheck clean; lock-sync idempotent on both lockfiles at 0.0.224; docs-sync + docs-coverage OK (214 env names + 63 keys); targeted tests green — kernel prune-family incl. the new dynamic-first-user-prune 51/51, root preserve-first-user-config + compress-settings 44/44.
  5. Pushed the final head 14906ead9 to feriaref:pr/config-preserve-first-user (force-with-lease, authorship preserved as feriaref, 4th rebase note appended to the commit body). This is the branch's one full CI pass (no [ework:ci-held] marker).

Live result: PR is now mergeable: true. The new CI run has all key guards green — close-object-guard, kernel-guard, lane-guard, lock-sync, docs-sync, docs-coverage, version-guard, pi-subagents-guard, unused-exports, architecture-docs, build-artifact — with only the long test shards + static-gates + gate-stub-cells still in progress and zero failures so far. The ci:force label is still on, so test lanes run at full scope.

Observation for the owner: this PR has now been rebased 4 times because master keeps advancing while it sits in HOLD (floor 2 🔶 需要决策: this PR's drop mechanism vs #2031/#2511 user→user carrier). Each rebase is mechanical and low-risk, but the conflict churn will continue until the design decision lands and the PR merges. Merge is the owner's call — untouched by this CI fix.


八问(中文结构化结论)

  1. 是什么问题:PR 分支再次落后 master 223 个提交,产生合并冲突(merge state: dirty),无法合并。
  2. 什么原因导致的:master 自上次 rebase 后又推进了 223 个提交(285 文件,+40602/−1394),内核版本 0.0.221→0.0.223;PR head 仍基于旧 base f09a4879aeb。冲突集中在 acp-kernel 版本行。
  3. 影响范围与严重程度:仅影响本 PR 的可合并性。无用户影响(PR 本就处于 HOLD,等 owner 设计决策)。
  4. 怎么修复的:把 PR head rebase 到当前 master 2e2b30a84,3 处版本行冲突统一对齐到 0.0.224(master 0.0.223 + 1,Kernel Boundary 规则 2);master 本次还动了 PR 的 src/config.ts 与 compress.yaml,均干净自动合并、无语义冲突;其余文件字节级一致。
  5. 是否有回归问题:无。rebase 只动版本行,16 个文件逻辑 hunk 与原 PR 逐字节一致(226+/54− 不变)。本地验证:typecheck 干净、双 lockfile 幂等、docs-sync/coverage 通过、定向测试全绿(kernel 51/51、root 44/44)。
  6. 是否破坏缓存:不涉及。未触碰任何缓存/重试/游标/去重逻辑。
  7. 是否改了设计方向:不涉及。纯 rebase,无设计变更;PR 自身 preserveFirstUser 设计原样保留,仍处 HOLD 待 owner 拍板。
  8. 是否引入了新的配置:本次 rebase 未引入新配置。PR 本身的 compress.preserveFirstUser(默认 true)是原有内容。

判定:冲突已解决、rebase 已验证、CI 关键门禁全绿、仅剩长测 shard 在跑(零失败)。本 CI 车道工作完成。另提请注意:该 PR 已第 4 次 rebase,HOLD 期间 master 持续推进会持续产生冲突 churn,建议设计决策尽快落地后合并。

@ranxianglei

ranxianglei commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen4-35b-a3b

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

No new work needed this run — the reported conflict was already resolved by the previous wake; verified live and confirmed.

This wake reported merge state: dirty, but I re-verified against the LIVE sources first (per status-freshness policy) and the conflict is not present:

  • Master has not moved: origin/master is still 2e2b30a84 — 0 commits since the base my last rebase targeted. There is nothing new to rebase onto.
  • PR head is my last push: 14906ead9 (the 4th-rebase head, kernel realigned to 0.0.224), base 2e2b30a84.
  • mergeable: True on the live GitHub API — the conflict is cleared. (mergeable_state: blocked only reflects the in-progress CI run + the PR's HOLD status, not a conflict.)
  • CI is healthy on the current head: 33 success, 14 skipped, 13 in progress (long test shards), zero failures. All key guards (close-object-guard, kernel-guard, lane-guard, lock-sync, docs-sync, version-guard, pi-subagents-guard, unused-exports, architecture-docs, build-artifact) are green.

Why the event fired anyway: the mirror cache is lagging — its last fetch is pinned at the OLD head 95674c5fa3f (pre-4th-rebase), so the poller emitted a stale "dirty" blocker before catching up to 14906ead9. The live GitHub API is the source of truth here and it shows the PR clean.

What I did / didn't do: no rebase, no push, no code change this run — there was nothing to fix. I did not fight the branch or re-run a loop.

What remains / risk: none from the CI lane. The PR stays in HOLD pending the owner's design decision (floor 2 🔶 需要决策: this PR's drop mechanism vs #2031/#2511 user→user carrier). Reminder from last run: this PR has been rebased 4× because master keeps advancing while it sits in HOLD — the conflict churn will recur until the design decision lands and it merges. Merge is the owner's call.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants