v4.2.0 — eight features, default-off opt-ins + request_id flip
v4.2.0 batches eight new features and one behavior flip into a single minor release. All new features are default-off opt-ins; one previously-default-off field flips on with a meter-version upgrade requirement.
Install or upgrade:
npm install -g claude-code-cache-fix@4.2.0What's new
Default-off opt-in features
-
Proxy-owned OAuth refresh (#234, #236 directive, #237 implementation). The proxy can now be the single, proactive, lock-cooperative refresher of the OAuth credential shared by all concurrent Claude Code clients running as the same OS user. Closes the refresh-token rotation race that revokes the whole token family and 401s the entire fleet at once — a failure no client-side restart can recover (only an interactive
/login). Acquires the same~/.claude/.oauth_refresh.lockthe client uses viaproper-lockfile. Hard 8-second POST deadline (below the client's 10s stale-break) covering both headers AND response body read. Default OFF viaCACHE_FIX_OAUTH_REFRESH=on. Threat-model discipline: token material never reaches any log/event writer. -
cc-version-normalizeextension (#238, #239). Rewrites thecc_versionvalue inside thex-anthropic-billing-headerto prevent per-build cache invalidation. The VS Code extension and other auto-updating distribution channels emit values like2.1.185.<buildhash>where the hash mutates on auto-update, busting the cache for the rest of the session. Three modes viaCACHE_FIX_NORMALIZE_CC_VERSION:off(default),strip(collapses suffix toX.Y.Z),pin:<value>(operator literal). Runs at order 90, beforefingerprint-stripat 100; the two cooperate cleanly. Surfaced by @X-15. -
upstream-error-logextension (#235, #240). Emits a structured JSONL record for every non-200 upstream response to~/.claude/usage-log/upstream-errors.jsonl. Two distinct 429 classes look identical to a user — account/usage-limit (withanthropic-ratelimit-unified-*headers) vs infrastructure/capacity (Cloudflare-fronted,x-should-retryonly, no ratelimit headers). Thehas_ratelimit_headersboolean is the discriminator. Default OFF viaCACHE_FIX_UPSTREAM_ERROR_LOG=on. -
workflow-agent-id-synthesisextension (#215, refs upstream anthropics/claude-code#66761). Closes the per-Workflow-leg cost-attribution gap CC#66761 left open. Stashes a derivedagent_idonctx.metacovering Task/Agent (canonical-present), Workflow (derived via stable hash), and top-level traffic. Cross-repo contract: claude-code-meter ≥ 0.8.0 accepts the optionalagent_id+agent_id_sourcefields whenCACHE_FIX_USAGE_LOG_AGENT_ID=on. Default OFF for first ship. -
Statusline served-model divergence indicator (#223, refs upstream anthropics/claude-code#66728). First real-time operator surface for the classifier-driven swap pattern.
proxy/extensions/cache-telemetry.mjscaptures served vs requested model;tools/quota-statusline.shrenders red for recent divergence, black-on-yellow for sticky. Family-aware sticky heuristic (cross-family latches immediately; same-family requires 3 consecutive divergent turns). -
image-retry-circuit-breakerextension (#217, refs upstream anthropics/claude-code#66815). Short-circuits the CC harness retry storm on permanentimage could not be processedfailures. Bounds the loss from CC#66815's reported 19-retries × 34 MB pattern to one upstream call. Three modes viaCACHE_FIX_IMAGE_RETRY_BREAKER:off(default),on,dry-run. Default OFF pending sim-validation. -
tools/gh-auth-status-shim/(refs upstream anthropics/claude-code#67055). PATH-resolvedghwrapper that suppresses CC Desktop's false "GitHub CLI authentication expired" toast caused by spawn timeouts being mapped to the auth toast category. Install viatools/gh-auth-status-shim/install.sh. -
jsonl-session-mirrorextension (refs upstream anthropics/claude-code#66734 and anthropics/claude-code#66486). Belt-and-suspenders backup against CC's in-place transcript stub-rewrite and missing-transcript regressions. Mirrors every assistant message + tool result / user input into a per-session JSONL file, independent of CC's transcript writer. Envelope shape matches CC 2.1.148's verified transcript so existing readers parse mirror files unchanged. Default OFF viaCACHE_FIX_SESSION_MIRROR=on.
Behavior change
CACHE_FIX_USAGE_LOG_REQIDflipped default-on. Per the v4.1.0 release-ordering contract. Therequest_idfield is now emitted on every~/.claude/usage.jsonlrow by default (when the upstreamrequest-idheader is present and ≤ 64 chars). The env-var becomes a kill-switch:=offomits the field. Upgrade requirement: operators running cache-fix v4.2.0 + claude-code-meter < v0.7.0 will see every meter row rejected by the strict-object validator until they either upgrade meter or setCACHE_FIX_USAGE_LOG_REQID=off. Meter v0.7.0, v0.7.1, and v0.8.0 are all published on npm.
Contributors
- @X-15 — surfaced the
cc_versionper-build cache-bust pattern from VS Code extension auto-update (#238)
Plus the cross-LLM review chain that gated each PR through Codex review before merge.
Upgrade
npm install -g claude-code-cache-fix@4.2.0Then restart your proxy (supervisor-level, per v4.0.0's hot-reload-off default):
systemctl --user restart cache-fix-proxy # Linux / systemd
launchctl unload ~/Library/LaunchAgents/com.cnighswonger.cache-fix-proxy.plist && launchctl load ~/Library/LaunchAgents/com.cnighswonger.cache-fix-proxy.plist # macOS / launchdAll new features are default-off, so the upgrade is behavior-neutral except for the request_id flip. If you run claude-code-meter and haven't upgraded to ≥ 0.7.0, set CACHE_FIX_USAGE_LOG_REQID=off before restarting, or upgrade meter first.