{"abstract":"Context budget double-counts shared token overlap.","category":"RAG context assembly","checks":6,"contract":"Token-list chunks append under budget; each later chunk incurs only tokens after maximal exact suffix-prefix overlap. Return assembled tokens.","contract_signature":"chunks, budget","evaluation_group":"ragctx-overlap-stitch","failed_approach":"Subtracting a single shared token misses multi-token repeated boundaries.","family":"w3-rag-context-assembly-marginal-token-cost","id":"FA-99581","implementations":{"attempt":{"sha256":"35376a7c71f9f98245758a9bc3472c8e2c9ab6749e10c5aacef384a3c8b4c5fd","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(chunks, budget):\n    out=[]\n    for c in chunks:\n        k=1 if out and c and out[-1]==c[0] else 0\n        out.extend(c[k:])\n    return out[:budget]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\na='a'+str(N); b='b'+str(N); c='c'+str(N)\ncheck('overlap permits fit', solve([[a,b,c],[b,c,'d']],4), [a,b,c,'d'])\ncheck('cannot partially append', solve([[a,b],[b,c]],2), [a,b])\ncheck('empty', solve([],N), [])\ncheck('zero budget', solve([[a]],0), [])\ncheck('no overlap exact', solve([[a],[b]],2), [a,b])\ncheck('full overlap', solve([[a,b],[a,b]],2), [a,b])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"2bcf5f7d2b94ed9f0569a943ab4b37ac7f861377715b28ecbf7fd0501dfb951c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(chunks, budget):\n    out=[]\n    for c in chunks: out.extend(c)\n    return out[:budget]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\na='a'+str(N); b='b'+str(N); c='c'+str(N)\ncheck('overlap permits fit', solve([[a,b,c],[b,c,'d']],4), [a,b,c,'d'])\ncheck('cannot partially append', solve([[a,b],[b,c]],2), [a,b])\ncheck('empty', solve([],N), [])\ncheck('zero budget', solve([[a]],0), [])\ncheck('no overlap exact', solve([[a],[b]],2), [a,b])\ncheck('full overlap', solve([[a,b],[a,b]],2), [a,b])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"Toy inputs and token counts only; this does not claim compatibility with a tokenizer, prompt format, or production retrieval system. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w3-rag-context-assembly-marginal-token-cost","generated_at":"2026-09-30T16:48:25.802618+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A small deterministic evidence assembly model makes context budgeting behavior inspectable.","root_cause":"The assembler charges each chunk’s full token length even when adjacent chunks share a prefix boundary.","sha256":"ba5634a63f4b36c420fa0051003a1b4e52cd1cd5cf0ea656545866606f567150","title":"Context budget double-counts shared token overlap · case 01","variant":1,"variant_policy":"The fixture code references N, supplied as 1 through 5. Fixed boundary checks may repeat. These records share one mechanism and must remain together in evaluation splits.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":29.554,"exit_code":1,"observations":[{"actual":["a1","b1","c1","b1"],"check":"overlap permits fit","expected":["a1","b1","c1","d"],"passed":false},{"actual":["a1","b1"],"check":"cannot partially append","expected":["a1","b1"],"passed":true},{"actual":[],"check":"empty","expected":[],"passed":true},{"actual":[],"check":"zero budget","expected":[],"passed":true},{"actual":["a1","b1"],"check":"no overlap exact","expected":["a1","b1"],"passed":true},{"actual":["a1","b1"],"check":"full overlap","expected":["a1","b1"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"overlap permits fit\", \"actual\": [\"a1\", \"b1\", \"c1\", \"b1\"], \"expected\": [\"a1\", \"b1\", \"c1\", \"d\"], \"passed\": false}, {\"check\": \"cannot partially append\", \"actual\": [\"a1\", \"b1\"], \"expected\": [\"a1\", \"b1\"], \"passed\": true}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"zero budget\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"no overlap exact\", \"actual\": [\"a1\", \"b1\"], \"expected\": [\"a1\", \"b1\"], \"passed\": true}, {\"check\": \"full overlap\", \"actual\": [\"a1\", \"b1\"], \"expected\": [\"a1\", \"b1\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":28.266,"exit_code":1,"observations":[{"actual":["a1","b1","c1","b1"],"check":"overlap permits fit","expected":["a1","b1","c1","d"],"passed":false},{"actual":["a1","b1"],"check":"cannot partially append","expected":["a1","b1"],"passed":true},{"actual":[],"check":"empty","expected":[],"passed":true},{"actual":[],"check":"zero budget","expected":[],"passed":true},{"actual":["a1","b1"],"check":"no overlap exact","expected":["a1","b1"],"passed":true},{"actual":["a1","b1"],"check":"full overlap","expected":["a1","b1"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"overlap permits fit\", \"actual\": [\"a1\", \"b1\", \"c1\", \"b1\"], \"expected\": [\"a1\", \"b1\", \"c1\", \"d\"], \"passed\": false}, {\"check\": \"cannot partially append\", \"actual\": [\"a1\", \"b1\"], \"expected\": [\"a1\", \"b1\"], \"passed\": true}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"zero budget\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"no overlap exact\", \"actual\": [\"a1\", \"b1\"], \"expected\": [\"a1\", \"b1\"], \"passed\": true}, {\"check\": \"full overlap\", \"actual\": [\"a1\", \"b1\"], \"expected\": [\"a1\", \"b1\"], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}