FAILURE MAP
← Case archive

FA-99881 / Agent workflow termination / Open access

Workflow: completion is delayed after the last result drains the queue · case 01

The final result drains the queue, but the completion check still sees the pre-result count.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Completion is tested against the pending count before the latest result transition.

THE FAILURE

Completion is tested against the pending count before the latest result transition.

Unsuccessful approach: Treating one remaining item as drained can stop before its final result arrives.

Case contract

Return complete iff pending_before - received is zero; received is zero or one and cannot exceed pending_before.

Why this case matters

This toy decision rule isolates one bounded agent-loop completion contract.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(pending_before, received):
    return pending_before == 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('last result drains', solve(1,1),True)
check('still one pending', solve(N,0),False)
check('already drained', solve(0,0),True)
check('whole batch drains', solve(N,N),True)
check('no result pending', solve(1,0),False)
check('multiple drained by one', solve(2,1),False)
check('one still pending', solve(N+1,N),False)
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 fixtureActualExpectedOutcome
last result drainsFalseTrueFailed
still one pendingFalseFalsePassed
already drainedTrueTruePassed
whole batch drainsFalseTrueFailed
no result pendingFalseFalsePassed
multiple drained by oneFalseFalsePassed
one still pendingFalseFalsePassed

SHA-256 / 2c8865673b3315c7ddc886ace2ac9b61635c57b4ebb5f30f596f57f8f37ae5a1

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(pending_before, received):
    return pending_before - received <= 1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('last result drains', solve(1,1),True)
check('still one pending', solve(N,0),False)
check('already drained', solve(0,0),True)
check('whole batch drains', solve(N,N),True)
check('no result pending', solve(1,0),False)
check('multiple drained by one', solve(2,1),False)
check('one still pending', solve(N+1,N),False)
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 fixtureActualExpectedOutcome
last result drainsTrueTruePassed
still one pendingTrueFalseFailed
already drainedTrueTruePassed
whole batch drainsTrueTruePassed
no result pendingTrueFalseFailed
multiple drained by oneTrueFalseFailed
one still pendingTrueFalseFailed

SHA-256 / 8362ab82c2d00fd665e1f82841ca93245d93690dde8284ee2f42f7b52896d02a

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 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

Inputs satisfy 0 <= received <= pending_before. 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:29.419209+00:00.

Case digest / 0f7dee1ea3d7642054e226d07e7bdb3e4c522a34200e2288412343091d44235e