FA-99581 / RAG context assembly / Open access
Context budget double-counts shared token overlap · case 01
Context budget double-counts shared token overlap.
ROOT CAUSE
The assembler charges each chunk’s full token length even when adjacent chunks share a prefix boundary.
THE FAILURE
The assembler charges each chunk’s full token length even when adjacent chunks share a prefix boundary.
Unsuccessful approach: Subtracting a single shared token misses multi-token repeated boundaries.
Case contract
Token-list chunks append under budget; each later chunk incurs only tokens after maximal exact suffix-prefix overlap. Return assembled tokens.
Why this case matters
A small deterministic evidence assembly model makes context budgeting behavior inspectable.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(chunks, budget):
out=[]
for c in chunks: out.extend(c)
return out[:budget]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a='a'+str(N); b='b'+str(N); c='c'+str(N)
check('overlap permits fit', solve([[a,b,c],[b,c,'d']],4), [a,b,c,'d'])
check('cannot partially append', solve([[a,b],[b,c]],2), [a,b])
check('empty', solve([],N), [])
check('zero budget', solve([[a]],0), [])
check('no overlap exact', solve([[a],[b]],2), [a,b])
check('full overlap', solve([[a,b],[a,b]],2), [a,b])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| overlap permits fit | ['a1', 'b1', 'c1', 'b1'] | ['a1', 'b1', 'c1', 'd'] | Failed |
| cannot partially append | ['a1', 'b1'] | ['a1', 'b1'] | Passed |
| empty | [] | [] | Passed |
| zero budget | [] | [] | Passed |
| no overlap exact | ['a1', 'b1'] | ['a1', 'b1'] | Passed |
| full overlap | ['a1', 'b1'] | ['a1', 'b1'] | Passed |
SHA-256 / 2bcf5f7d2b94ed9f0569a943ab4b37ac7f861377715b28ecbf7fd0501dfb951c
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(chunks, budget):
out=[]
for c in chunks:
k=1 if out and c and out[-1]==c[0] else 0
out.extend(c[k:])
return out[:budget]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a='a'+str(N); b='b'+str(N); c='c'+str(N)
check('overlap permits fit', solve([[a,b,c],[b,c,'d']],4), [a,b,c,'d'])
check('cannot partially append', solve([[a,b],[b,c]],2), [a,b])
check('empty', solve([],N), [])
check('zero budget', solve([[a]],0), [])
check('no overlap exact', solve([[a],[b]],2), [a,b])
check('full overlap', solve([[a,b],[a,b]],2), [a,b])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| overlap permits fit | ['a1', 'b1', 'c1', 'b1'] | ['a1', 'b1', 'c1', 'd'] | Failed |
| cannot partially append | ['a1', 'b1'] | ['a1', 'b1'] | Passed |
| empty | [] | [] | Passed |
| zero budget | [] | [] | Passed |
| no overlap exact | ['a1', 'b1'] | ['a1', 'b1'] | Passed |
| full overlap | ['a1', 'b1'] | ['a1', 'b1'] | Passed |
SHA-256 / 35376a7c71f9f98245758a9bc3472c8e2c9ab6749e10c5aacef384a3c8b4c5fd
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 6 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-30T16:48:25.802618+00:00.
Case digest / ba5634a63f4b36c420fa0051003a1b4e52cd1cd5cf0ea656545866606f567150