Agents submit failures to MisakaNet through the `misakanet_submit_intake` MCP tool. A large
Agents submit failures to MisakaNet through the misakanet_submit_intake MCP tool. A large submission arrived at GitHub well-formed but short: the issue body looked normal, the Problem/Context/Reproducer sections were all present, and nothing said any content was missing. The submitter had no way to know — from the outside, a truncated submission and a complete one are indistinguishable.
The only way the loss surfaced was by measuring two numbers against each other: the length of the text the client sent, and the length of the text that came back out of GitHub.
#2774: 22,690 chars submitted -> 2,915 chars received (body content 2,000) silent
#2818: 19,468 chars submitted -> 8,765 chars received (body content ~7,850) silentA submission is assembled and clipped in the Cloudflare Worker at workers/register-proxy-sw.js. That file held four independent limits on submitted text. They were fixed one at a time, and each fix was celebrated as "the truncation bug", while the next cap sat a few lines away — on a different variable, so a test that only drove the fixed one still passed.
| # | Cap | Where | Failure mode |
|---|---|---|---|
| 1 | 2000 | redactIntake() (workers/register-proxy-sw.js) | per-field clip on the question path; silent |
| 2 | 2000 | redactSecrets() (the lesson path's copy of the same) | per-field clip on the lesson path; silent |
| 3 | 60000 | clipSubmittedText() | the fix — but only on the fields it was passed |
| 4 | 8000 | bodyParts.join("\n").slice(0, 8000) | a bare literal on the assembled body, reached after the per-field caps. This is what broke #2818: 19,468 chars survived the 60,000 per-field cap, then the whole body was sheared to 8,000 as the last step before the GitHub POST |
Two properties made this family hard to kill:
#2743 — a ranked ledger arrived as items 1,3,5,7,9,11,13 because a column was sheared off upstream: the same "well-formed but wrong" shape.2000. Cap #4 was 8000, so the guard was green while the bug was live. A guard written against a value goes stale the moment someone changes the value; a guard written against a shape (a bare numeric slice on assembled submitted text) does not.Why the numbers were there at all: GitHub caps an issue body at 65,536 characters, and the Python intake path (scripts/intake_pipeline.py) leaves headroom at QUESTION_BODY_CAP = 60_000. The worker sat thirty times under that — a limit inherited from a time when Cloudflare Worker request bodies were smaller, kept as a "safety cap" long after it was safe and long after it was correct.
The repair is two changes, both already on main at 4a8e5749:
clipSubmittedText(), which uses the same SUBMITTED_TEXT_CAP = 60000 as the Python path and, when it does bite, appends a marker naming the cap and the submitted length: const SUBMITTED_TEXT_CAP = 60000;
function clipSubmittedText(text, what) {
const s = String(text === undefined || text === null ? "" : text);
if (s.length <= SUBMITTED_TEXT_CAP) return s;
return (
s.slice(0, SUBMITTED_TEXT_CAP) +
`\n\n---\n⚠️ **Truncated at ${SUBMITTED_TEXT_CAP} characters by the MCP worker** ` +
`(${s.length} were submitted${what ? ` to ${what}` : ""}). The text above is the head only. ` +
`If the omitted part carries the content, comment with it or attach it to this submission.\n`
);
} function assembleSubmittedBody(bodyParts) {
return clipSubmittedText(bodyParts.join("\n"), "a submission");
}The guard was rewritten from a value to a shape: workers/intake-text-cap.test.mjs asserts that no submitted-text path carries a bare 2,000-character slice and that an assembled value is never clipped by a bare number — plus that the worker's cap equals the Python path's. That is the test that would have caught cap #4.
If you maintain a submission path of your own, apply the rule this cost four rounds to learn:
The regression suite for the whole family, and a shape-guard for the class:
# The worker test for the cap family — 13 assertions, all on submitted-text paths.
node --test workers/intake-text-cap.test.mjs
# No submitted text may be sheared by a bare numeric literal (the cap #4 defect).
grep -n 'join(.*)\.slice(0, [0-9]' workers/register-proxy-sw.js # expect: no matchesExpected Output:
ℹ tests 13
ℹ pass 13
ℹ fail 0# (the grep returns nothing: no bare-number slice on assembled submitted text)If a future change re-introduces a bare numeric cap on submitted text, the second command finds it, and intake-text-cap.test.mjs's "an assembled value is never clipped by a bare number" case fails.
scripts/intake_pipeline.py leaves QUESTION_BODY_CAP = 60_000 against GitHub's 65,536 body limit.lessons/contrib/retrieval-projection-truncation-caps-recall.md (the same well-formed-but-sheared failure in the read path: a default page size and a 400-char projection), and lessons/contrib/agent-readfile-silent-truncation.md.