Skip to content

Commit 5cc739e

Browse files
docs(proxy): round-2 — address Codex round-1 on #202
Codex round-1 flagged two blockers: 1. cache-telemetry comment was factually wrong. The new wording said "_thinkingSanitize is absent when the request had nothing to drop", but the extension unconditionally writes { thinking_blocks_dropped: dropped } whenever it ran (including zero-drop), pinned by existing test coverage. Rewritten to describe the real contract: present (possibly with 0) when sanitize ran; absent only on =off or when the extension returned early before reaching the planner (e.g., body.messages not an array). 2. Sweep was incomplete. Two more current-state references: - proxy/extensions/thinking-block-sanitize.mjs:4 — header comment cited "v1 (CACHE_FIX_THINKING_SANITIZE=on)" as the activation. Updated to "v1 (default since v4.0.0; CACHE_FIX_THINKING_SANITIZE unset or =on)". - test/proxy-thinking-block-sanitize.test.mjs:194 — test title started with "onRequest: opt-in on with nothing to drop". Renamed to "onRequest: =on with nothing to drop". Codex also flagged 4 lines in README.zh.md. Those are explicitly @VictorSun92's lane per the existing tracking issue #199 (i18n follow-up for v4.0.0 behavior changes; tagged @VictorSun92 for zh, @ArkNill for ko). Not in scope for this PR. 1004/1004 tests pass. Refs #199, #201, #202. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8fedd57 commit 5cc739e

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

proxy/extensions/cache-telemetry.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,10 @@ export default {
239239
// that extension is disabled or produced nothing this request.
240240
...(ctx.meta._sessionHealth || {}),
241241
// Additive thinking-block-sanitize drop count (order 550). On by
242-
// default since v4.0.0; absent when CACHE_FIX_THINKING_SANITIZE=off
243-
// (explicit disable) or when the request had nothing to drop.
242+
// default since v4.0.0; present (possibly with thinking_blocks_dropped:0)
243+
// whenever sanitize ran. Absent when CACHE_FIX_THINKING_SANITIZE=off
244+
// or when the extension returned early before reaching the planner
245+
// (e.g., body.messages not an array).
244246
...(ctx.meta._thinkingSanitize || {}),
245247
// Additive thinking-block-sanitize v2 fields (order 550, opt-in via
246248
// CACHE_FIX_THINKING_SANITIZE=v2). Optional — absent unless v2 is

proxy/extensions/thinking-block-sanitize.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// thinking-block-sanitize — request-path mitigation for the CC thinking-desync
22
// wedge (anthropics/claude-code#63147).
33
//
4-
// v1 (CACHE_FIX_THINKING_SANITIZE=on): On replay paths (resume / --continue /
4+
// v1 (default since v4.0.0; CACHE_FIX_THINKING_SANITIZE unset or =on): On replay paths (resume / --continue /
55
// auto-compaction / parallel-tool-cancel), CC re-sends prior assistant turns'
66
// thinking in the OMITTED shape `{ type:"thinking", thinking:"", signature }`.
77
// The API rejects modified thinking in the *latest* assistant message with a

test/proxy-thinking-block-sanitize.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ test("onRequest: explicit =on matches the default (back-compat)", async () => {
191191
});
192192
});
193193

194-
test("onRequest: opt-in on with nothing to drop emits a zero count and leaves the body intact", async () => {
194+
test("onRequest: =on with nothing to drop emits a zero count and leaves the body intact", async () => {
195195
await withSanitize("on", async () => {
196196
const ctx = {
197197
body: { messages: [{ role: "assistant", content: [realThinking(), text("a")] }] },

0 commit comments

Comments
 (0)