Repository navigation
test: adversarial byte-fidelity corpus for tool-call arguments, all four wires - #2743
Conversation
…our wires (#1039, #1960) Four directions (upstream parse / downstream emit / re-request rebuild / client-echo round-trip) crossed with 13 hostile payloads and byte-level SSE chunking (whole, 1-byte, seeded RNG, every-offset splits for short payloads). String wires asserted byte-exact; anthropic/google object wires asserted canonically. Teeth verified: a JSON-normalize defect planted on the exercised chat passthrough emission site turns 18 cases red; clean tree 674/674.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2988-pr.2743.7409a7eThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2743.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review of PR #2743 ( Verification performed (targeted, local):
Structured conclusion (八问):
CI:guard 类 job(kernel-guard / version-guard / docs-coverage / lane-guard / docs-sync / pi-subagents-guard / lock-sync / unused-exports / config-surface-guard / build-artifact)全绿;4 个 test job 在我检查时仍在跑——本地定向验证已两次全绿,等 CI test job 转绿即可合。 判定:可合并(待 CI test job 转绿;合并按规矩由人来执行:#2743 )。review 中未发现需要顺手修的小问题。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.267-master.43c1b57 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Second deliverable of the consumer-path audit (#2738 follow-up; the remaining 🟡-grade gap from the audit table): point coverage for tool-argument byte fidelity becomes a systematic adversarial corpus.
What this pins
tests/toolargs-adversarial.test.ts— 674 cases crossing four directions × four wires × 13 hostile payloads × byte-level SSE chunkings:Directions (every hop the bytes take):
adapter.parseStream— the loop's accumulated view feeds the re-request rebuildadapter.emitToolCall— becomes the client's persisted historyadapter.buildRequest— [acp-loop] In-turn compress re-request edits the latest assistant message → Anthropic 400 "thinking blocks … cannot be modified" (session stays broken) #1960's class of hazard (re-request body)toCoreon the rebuilt wire shape — the next request's history parserWires: chat, anthropic, responses (both real argument paths — ACP-tool delta accumulation AND client-tool done-carries-full passthrough), google (string args and object args).
Payloads (#1039 discipline — arguments are user intent): quote/escape soup, CRLF/tab escapes, CJK, astral 4-byte, literal
\usequences, tag-shaped bytes built with hex escapes, SSE-frame look-alikes, empty string, bare-empty args, whitespace-only, 2 KiB, unparseable-but-forwardable truncated JSON, duplicate keys + nesting.Chunkings: whole / 1-byte / seeded RNG (17, 97) / every-byte-offset two-chunk splits for short payloads (splits inside escapes, inside multi-byte UTF-8, across frame terminators, mid-
data:-prefix).Assertion form: string wires (chat, responses) byte-exact; anthropic/google (parsed-object wires) canonical JSON equivalence, with google's documented
{}degradation for unparseable args asserted as such.Teeth (A/B)
A planted defect — "helpfully" normalizing arguments via
JSON.stringify(JSON.parse(args))at the chat passthrough emission site — turns 18 cases red (literal \uandduplicate keyspayloads across all chunkings). Clean tree: 674/674.Three harness bugs were found and fixed during development (worth recording):
Buffer.toString()re-encoding destroying byte-split multibyte sequences (must enqueue raw bytes), template-literal\"silently corrupting corpus escapes (String.raw / JSON.stringify construction), and responses non-ACP tools relaying full arguments onoutput_item.donerather than deltas (both real paths now covered).Config surface
None — test-only.
Kernel boundary
None — host tests only; kernel used read-only via its public wire exports.