FA-29371 / HTTP retries / Open access
Replay source snapshot: A partially consumed body remains readable after cancellation closes it · case 01
A partially consumed body remains readable after cancellation closes it
ROOT CAUSE
A partially consumed body remains readable after cancellation closes it
VERIFIED REPAIR
Close independently of whether EOF was reached.
Unsuccessful approach: The attempted repair changes the faulty site to closed = pos==len(body) elif but still violates a regression oracle.
Case contract
Events open(list of integer bytes, starting index), mutate(index,byte), read(count), retry, close. Opening freezes bytes and origin. Reads advance within the frozen representation. Retry rewinds to origin. Reads after close return closed; retry after close returns closed. Output read chunks or status markers.
Why this case matters
Offline deterministic model of HTTP request retries.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(events):
body = (); live = []; origin = 0; pos = 0; closed = True; out = []
for e in events:
if e[0] == 'open':
live = list(e[1])
body = tuple(live)
origin = e[2]
pos = origin
closed = False
elif e[0] == 'mutate':
live[e[1]] = e[2]
elif e[0] == 'close':
closed = False
elif e[0] == 'read':
if closed:
out.append('closed')
continue
chunk = list(body[pos:pos+e[1]])
pos += len(chunk)
out.append(chunk)
elif e[0] == 'retry':
if closed:
out.append('closed')
continue
pos = origin
out.append('rewound')
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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 |
|---|---|---|---|
| 0 | [] | [] | Passed |
| 1 | [[2], 'rewound', [2, 3]] | [[2], 'rewound', [2, 3]] | Passed |
| 2 | [[1, 2], [3], []] | [[1, 2], [3], []] | Passed |
| 3 | ['rewound', [1, 2]] | ['rewound', [1, 2]] | Passed |
| 4 | [[], 'rewound', []] | [[], 'rewound', []] | Passed |
| 5 | [[1], 'rewound'] | ['closed', 'closed'] | Failed |
| 6 | [[1], [], 'rewound', [3]] | [[1], 'closed', 'closed', [3]] | Failed |
SHA-256 / acd2cbb2ff2f7ae5f8c23385f6feea14cabc4fa5d8c0338fbcb09467c3363faa
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(events):
body = (); live = []; origin = 0; pos = 0; closed = True; out = []
for e in events:
if e[0] == 'open':
live = list(e[1])
body = tuple(live)
origin = e[2]
pos = origin
closed = False
elif e[0] == 'mutate':
live[e[1]] = e[2]
elif e[0] == 'close':
closed = pos==len(body)
elif e[0] == 'read':
if closed:
out.append('closed')
continue
chunk = list(body[pos:pos+e[1]])
pos += len(chunk)
out.append(chunk)
elif e[0] == 'retry':
if closed:
out.append('closed')
continue
pos = origin
out.append('rewound')
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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 |
|---|---|---|---|
| 0 | [] | [] | Passed |
| 1 | [[2], 'rewound', [2, 3]] | [[2], 'rewound', [2, 3]] | Passed |
| 2 | [[1, 2], [3], []] | [[1, 2], [3], []] | Passed |
| 3 | ['rewound', [1, 2]] | ['rewound', [1, 2]] | Passed |
| 4 | [[], 'rewound', []] | [[], 'rewound', []] | Passed |
| 5 | [[1], 'rewound'] | ['closed', 'closed'] | Failed |
| 6 | [[1], 'closed', 'closed', [3]] | [[1], 'closed', 'closed', [3]] | Passed |
SHA-256 / 891163fd2da45101ae0b17a3145540a5be1beb23982a9b264e2ba7bbcf1b3d5c
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(events):
body = (); live = []; origin = 0; pos = 0; closed = True; out = []
for e in events:
if e[0] == 'open':
live = list(e[1])
body = tuple(live)
origin = e[2]
pos = origin
closed = False
elif e[0] == 'mutate':
live[e[1]] = e[2]
elif e[0] == 'close':
closed = True
elif e[0] == 'read':
if closed:
out.append('closed')
continue
chunk = list(body[pos:pos+e[1]])
pos += len(chunk)
out.append(chunk)
elif e[0] == 'retry':
if closed:
out.append('closed')
continue
pos = origin
out.append('rewound')
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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 |
|---|---|---|---|
| 0 | [] | [] | Passed |
| 1 | [[2], 'rewound', [2, 3]] | [[2], 'rewound', [2, 3]] | Passed |
| 2 | [[1, 2], [3], []] | [[1, 2], [3], []] | Passed |
| 3 | ['rewound', [1, 2]] | ['rewound', [1, 2]] | Passed |
| 4 | [[], 'rewound', []] | [[], 'rewound', []] | Passed |
| 5 | ['closed', 'closed'] | ['closed', 'closed'] | Passed |
| 6 | [[1], 'closed', 'closed', [3]] | [[1], 'closed', 'closed', [3]] | Passed |
SHA-256 / 5f84087f10982bdd62ce744fb9e49abe266682dab8d7e0790a9253cf04d033cb
Verification & scope
Stipulated bounded simulator, not a complete HTTP implementation or a standards conformance claim. 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-29T14:41:42.557593+00:00.
Case digest / ee6fb4a9fadb457754d2c872401cc90ef030bf1d7057470d6864a94681c3b214