Skip to content

chore(cache): localize /status cache-detail line + locale-independent tool sort#2320

Merged
esengine merged 1 commit into
mainfrom
chore/cache-diagnostics-polish
May 30, 2026
Merged

chore(cache): localize /status cache-detail line + locale-independent tool sort#2320
esengine merged 1 commit into
mainfrom
chore/cache-diagnostics-polish

Conversation

@esengine

Copy link
Copy Markdown
Owner

Follow-up polish to the cache-efficiency guardrails merged in #2314. Two non-blocking nits surfaced during review.

Changes

1. Localize the /status cache-detail line

#2314 added a cache detail: … row to /status but built it as a hard-coded English string, unlike every other status row which goes through t(). Routed it through i18n:

  • New keys statusCacheDetail / statusCacheChurn under handlers.observability.
  • EN + zh-CN translated; ja/de/ru inherit EN.handlers exactly like the rest of their observability block (which is already English).
  • Reformatted to the aligned cache … label style so it lines up with cost … / ctx ….

2. Locale-independent tool-spec sort

sortToolSpecs used String.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-existing qrcode resolution error from feat(weixin): render ilink qr in terminal #2246 is the only diagnostic; not touched here)
  • biome check: clean on changed files
  • Targeted suites pass: cache-shape, mcp-reconnect-prefix-invariant, mcp-cache-canonicalization, tools, loop, slash, loop-slash, telemetry, context-manager-cache-aligned-fold, plus i18n suites
  • Runtime-verified the new keys resolve correctly across EN/zh-CN/ja/de/ru

🤖 Generated with Claude Code

…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>
@esengine esengine merged commit 512e3dd into main May 30, 2026
4 checks passed
@esengine esengine deleted the chore/cache-diagnostics-polish branch May 30, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant