chore(cache): localize /status cache-detail line + locale-independent tool sort#2320
Merged
Conversation
…ocale-independent Follow-up polish to the cache-efficiency guardrails (#2314): - /status "cache detail" line was hard-coded English; route it through i18n (statusCacheDetail / statusCacheChurn) so it matches every other status row. EN + zh-CN translated; ja/de/ru inherit EN like the rest of their observability block. - sortToolSpecs used localeCompare, which is locale-sensitive and could let the host locale reshuffle the serialized tool prefix and reintroduce the very cache churn the sort is meant to prevent. Switch to a stable codepoint compare. No change for ASCII tool names (all existing tests pass). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Follow-up polish to the cache-efficiency guardrails merged in #2314. Two non-blocking nits surfaced during review.
Changes
1. Localize the
/statuscache-detail line#2314added acache detail: …row to/statusbut built it as a hard-coded English string, unlike every other status row which goes throught(). Routed it through i18n:statusCacheDetail/statusCacheChurnunderhandlers.observability.EN+zh-CNtranslated;ja/de/ruinheritEN.handlersexactly like the rest of their observability block (which is already English).cache …label style so it lines up withcost …/ctx ….2. Locale-independent tool-spec sort
sortToolSpecsusedString.prototype.localeCompare, which is locale-sensitive. Since the whole point of the sort is to make the serialized tool prefix byte-stable (so MCP reconnect/registration order can't churn the prompt cache), a locale-dependent comparator could itself reshuffle the order on a differently-configured host and reintroduce the churn it's meant to prevent. Switched to a stable codepoint compare.No behavior change for ASCII tool names — all existing tool-order/fingerprint tests pass unchanged.
Verification
tsc --noEmit: clean (the unrelated pre-existingqrcoderesolution error from feat(weixin): render ilink qr in terminal #2246 is the only diagnostic; not touched here)biome check: clean on changed filescache-shape,mcp-reconnect-prefix-invariant,mcp-cache-canonicalization,tools,loop,slash,loop-slash,telemetry,context-manager-cache-aligned-fold, plus i18n suitesEN/zh-CN/ja/de/ru🤖 Generated with Claude Code