Repository navigation
fix(protocol): fill missing TTL on rewritten official cli-hop - #851
Closed
LemonYangZW wants to merge 1 commit into
Closed
LemonYangZW wants to merge 1 commit into
LemonYangZW wants to merge 1 commit into
Conversation
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #850
根因
v1.4.031中,非透传的官方 Claude Code 流量被强制进入 persona 清洗后,模板生成的1hmarker 与调用方消息上的 marker 会同时存在。调用方 marker 如果没有ttl,shaped cli-hop 会把它视为已存在的消息断点并原样保留;Anthropic 因此把缺失ttl解释为隐式5m。cache_continuity.ttl=1h记录的是请求解析值,不能代表最终 wire 上所有断点都是1h。修复
在非透传官方 cli-hop 完成 persona/identity 重写后,仅补齐缺失的 marker TTL:
1h5m/1h保持不变1h在5m前及最多四个断点的约束official_cc_passthrough=true时不做改写,继续保留原请求applyCacheTtlToBody测试
通过:
node --test test/unit/persona-outbound-contract.test.mjs:116 pass / 0 fail / 74 skipnode --test test/unit/official-template-cache-ttl.test.mjs test/unit/cache-ttl.test.mjs test/unit/official-cache-breakpoints.test.mjs test/unit/crs-persona.test.mjs:145 pass / 0 failnpx biome check src/lib/protocol/handle-protocol.mjs test/unit/persona-outbound-contract.test.mjsgit diff --check新增回归覆盖:
1h5m→ 保持5m1h→ 保持1hnpm run test:unit也已在 Windows 工作区执行,但该测试集包含 Unix socket、getgid、Linux 二进制和 POSIX 文件清理等平台假设,出现与本次改动无关的 Windows 平台失败;因此不把 Windows 全量失败作为本修复的通过依据。验证边界
本次只做代码分析和离线 fixture/单测,没有发起真实推理、缓存、OAuth 或 smoke 请求。