Skip to content

Deferred MINOR findings from the v0.1.190 release review (#2581) #2602

Closed

Description

@ranxianglei

Deferred MINOR findings from the v0.1.190 release review

Follow-up tracker for the non-blocking MINOR findings from the release review of #2581 (v0.1.190). The six actionable fixes landed in the release branch; the three below were deliberately deferred (either test-pinned behavior or informational) so they can be handled with their own regression coverage.

1. Ledger floor never decays + cap<1024 surrender (src/prompt-cache/budget.ts:243)

The prompt-cache budget ledger holds a permanent floor: once a floor is learned it never decays, so a client that stops using prompt caching still pays the reserved floor forever. Additionally, when the effective context cap drops below 1024 tokens the ledger surrenders (return — no budget enforcement at all). Both behaviors look deliberate (the surrender is pinned by tests) but undocumented. Suggested: document the intent at the site, and if the floor is meant to be sticky, add a session-scoped decay probe.

2. addStaticHosts empty-host guard (src/launcher.ts:424)

addStaticHosts filters ""-hosts via a truthiness guard that is unreachable with today's config shapes (every caller resolves hosts before it reaches here). Latent only: a future caller passing an unresolved host list would silently drop entries instead of failing loudly. Suggested: tighten to an explicit validation with a warn log, or drop the guard if the invariant is structural.

3. Transport trio (informational, no action required today)

  • Truncation re-fetch reuses the original roundBody bytes (src/loop/core.ts:726-729) — correct today because the retry re-issues the same logical request, but worth a comment pinning the invariant.
  • Retry targets can carry leading-* prompt-cache markers (lost leading-edge breaks cache reuse) — cosmetic inefficiency only.
  • opencode-v2 stale manifest: the conditional-tool manifest is cached without cache-busting, so a stale CDN edge can hold back tool registration until retry. Informational.

Review context: #2581 (release v0.1.190) — full review comment #2581 (comment)

Activity

  1. added a commit that references this issue on Oct 10, 2026
  2. ranxianglei commented on Oct 10, 2026

    @ranxianglei
    OwnerAuthor

    🤖 Powered by ework · qwen3.8-27b

    [bot] 🏷 三条 deferred MINOR 已处理完毕 → PR #2603(纯注释/文档变更,零行为改动)。

    路径勘误(第 1 条):issue 写的 src/prompt-cache/budget.ts:243 在本仓库历史中不存在(git log --all -- 'src/prompt-cache/*' 为空)。实际位置是 src/server/budget.ts(review 评论自己的引用也是它)——这是 #2490 的 dsh compaction-refused ledger floor,与 prompt cache 无关。issue 正文把机制描述串了("client stops using prompt caching"),实际机制是:dsh 原生压缩被 #1729/#1835 guard 拒绝时,guard 把 replay 包体大小以高水位记到 session metadata,output clamp 用它做 planning 下限。

    1. Ledger floor 不衰减 + cap<1024 surrender —— 审核结论:两个行为都是有意设计,且「加衰减」是错误方向:

    • floor 粘滞是正确的:只要 guard 在拒 dsh compaction,host 的 raw ledger 只增不减(refused checkpoint 永不落地),所以高水位天然上界所有未来重发。加 session-scoped decay probe 会把 floor 降到真实 ledger 之下,重新打开 dsh压缩与bili压缩冲突 #2490 的 kill chain(384K-token/7.5MB turn-37 事故)。因此本 PR 落地的是 issue 建议的前半句——在 clampOutputBudget()、dshLedgerFloorTokens()、handle.ts 写入点三处文档化意图与生命周期(metadata eviction 为止)。
    • cap<1024 surrender 是终局态语义:planning basis 来自 raw ledger 时,cap<1024 意味着 host 自己的计数已到 window 墙,bili 的 fold 缩不动它,任何 output budget 都救不回该 session;压到 sub-floor 只会饿死一个注定要死的 turn。已在 docstring 写明(测试早已 pin:tests/issue2490-ledger-floor-doomed-probe.test.ts)。
    • 顺带把一个已知保守残留写进文档:session 中途开 allowDshCompaction 后 checkpoint 可落地、ledger 会缩小,但 floor 保持旧高水位直到 evict(fail-closed 方向的过紧,接受)。

    2. addStaticHosts 空 host guard —— 选择保留 guard + 文档化不变量,不走 issue 给的两个选项:八个调用方全部先解析 host(常量表或 nonEmpty() 门控),该分支结构性不可达;删掉 guard 会让未来的未解析列表把 "" 推进 SNI 白名单(比跳过更糟);warn log 不适合这个纯 discovery helper(无日志通道、分支按构造不可达)。docstring 现在写明了这两个事实。

    3. Transport trio —— 按要求在 truncation re-fetch 处(src/loop/core.ts)加了注释,pin 住 roundBody 字节不变量(retry 重发同一逻辑请求,重建 body 会移动 prompt-cache leading-edge marker、破坏前缀缓存复用)。另两项(retry 目标携带 leading-* marker、opencode-v2 stale manifest)按 issue 标注 informational,未动。


    结构化八问:

    1. 是什么问题:release review 遗留的三条 MINOR——两处「看起来像缺口实为有意设计」的行为未文档化 + 一处值得 pin 的 transport 不变量。
    2. 什么原因导致的:不是缺陷,是意图没写在代码现场;后续读者可能把 sticky floor 当泄漏去「修」掉(会复现 dsh压缩与bili压缩冲突 #2490),或把 guard 当死代码删掉(会污染白名单)。
    3. 影响范围与严重程度:当前零用户影响(不改任何行为);风险在未来回归面——本次已用文档+既有测试钉住。
    4. 怎么修复的:策略层面选「文档化意图」而非改行为——decay probe 被证据否决(会重新打开 kill chain),guard 保留并写明结构性不可达的依据。
    5. 是否有回归问题:无。diff 每一行都是注释;typecheck 干净;定向套件 issue2490-ledger-floor-doomed-probe(恰好 pin 本次文档化的两个行为)+ discover(launcher 差分 harness)36/36 通过;全量交 CI。
    6. 是否破坏缓存:不涉及(唯一沾边的动作是给既有的 prompt-cache 不变量补注释,无逻辑触碰)。
    7. 是否改了设计方向:不涉及。
    8. 是否引入了新的配置:不涉及。

    判定:可合并(docs-only,CI 绿即收工)。PR:#2603

  3. added a commit that references this issue on Oct 10, 2026
  4. ranxianglei commented on Oct 10, 2026

    @ranxianglei
    OwnerAuthor

    🤖 Powered by ework · qwen3.8-27b

    [bot] 🏷 补充:PR #2603 CI 已全绿(27/27 check runs success)。

    过程中 codex accepts CODEX_HOME overlay + registers bili MCP 一度红过,排查结论是 Windows runner 瞬时超时而非本 PR 引入:not ok 32 - #2196 real win32 ... wrapper --help exited null (Error: spawnSync node.exe ETIMEDOUT)——该测试在 CI runner 上 spawn 真实 codex wrapper 跑 --help,runner 负载下超时;本 PR diff 全部为注释行,不触碰任何 codex/win32/spawn 路径。佐证:同一 job 在 master 最近 6 个提交上全绿;仅重跑失败 job 后即通过。未另行立项(单次瞬时 runner 抖动,无复现证据链)。

    状态:等合并(human-only merge):#2603

  5. added a commit that references this issue on Oct 10, 2026
  6. added 3 commits that reference this issue on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions