v0.12.208 — Fix non-ASCII reasoning header crashing paid responses
Stop non-English prompts from crashing paid responses via the x-clawrouter-reasoning header.
- Non-ASCII routing reasoning crashed
res.writeHeadafter settlement (src/proxy.ts). The routing reasoning string embeds matched keywords from the multilingual lists insrc/router/config.ts(Cyrillic, CJK, …). Debug headers are on by default, so for e.g. Russian prompts the raw Cyrillic keywords landed in thex-clawrouter-reasoningresponse header and Node rejected the write withERR_INVALID_CHAR— after the upstream call had completed and the x402 payment had settled. The client never received the body and retried, signing a fresh payment each round: a paid retry loop. Header values are now percent-encoded outside printable ASCII (sanitizeHeaderValue, reversible viadecodeURIComponent), and as defense in depth a rejectedwriteHeadsanitizes all header values and still delivers the paid body instead of throwing. (Test:proxy.reasoning-header.test.ts, 13 cases, including a live Russian-prompt repro throughclassifyByRulesvalidated against Node'svalidateHeaderValue.) CLAWROUTER_DEBUG_HEADERS=off|false|0— new env kill switch for thex-clawrouter-*debug headers, for clients that can't set the per-requestx-clawrouter-debug: falseheader. Comments claiming the headers were "opt-in" corrected (they are on by default).
npm: @blockrun/clawrouter@0.12.208