# Lacuna Under Real Log Loss: 269 of 277 Runs Covered, 23 Set Aside

> I killed the collectors mid-run to see whether capture-recapture still counts the actions no log recorded, over 420 runs. I predicted it would miss its bar. Counted as misses, the 23 set-aside runs leave it at 269 of 300.

- Published: 2026-11-16
- Reading time: 14 min read
- Tags: ML, Agent Systems
- Author: Caio Theodoro (https://caio.theodoro.dev/about.md)
- Canonical HTML: https://caio.theodoro.dev/blog/lacuna-real-log-loss-passed-with-23-runs-missing
- Source repository: https://github.com/caiotheodoro/lacuna

---

I ran a fifth pre-registered study on lacuna, the project that estimates how many actions an AI agent took that none of its logs recorded. This time no loss was simulated. Two agent processes replayed recorded sessions through real telemetry components, and I killed the collectors mid-run. Before the first run I registered a prediction that the estimator would miss its bar.


It covered the true count in 269 of 277 runs, a Wilson interval of 0.944 to 0.985 against a bar of 0.90. 23 of the 300 planned runs never reached the test. Counted as misses, they make it 269 of 300, 0.857 to 0.926, which straddles the bar.

- **Measured**: 420 registered runs, 24 replayed sessions each, about 333 actions per stressed run, every one with ground truth
- **Pre-registered**: a signed tag, on GitHub under four minutes before the first of the 420 runs
- **Headline**: 269 of 277 runs covered; 269 of 300 if the runs set aside count against it
- **Against a sequence counter**: closer to the true count in 223 of the 277 runs in the test
- **My prediction**: that it would fail. Wrong on the 277 runs in the test; with the 23 counted against it, the registered reading is "not shown"

## The limit the last post left


[The first post](https://caio.theodoro.dev/blog/lacuna-counting-what-no-log-saw) ended on a limit I wrote myself: "Coverage under real log loss, from a real gateway with real faults, isn't measured." Every number in it came from complete logs with loss applied afterwards. I chose which records to drop and how.


There was a second gap. Where one trusted counter sees every action, a sequence number beats any of this, and nobody needs an estimator. The registration for this study opens with that sentence: if a trusted counter exists at the source or at the sink, use it. Study 5 is about the case where none can exist. Actions come from separate processes that share no counter, and the logs that record them lose records on their own.


## The rig


Two originators replay recorded agent sessions over MCP. Plane A goes through an unmodified agentgateway; plane B goes straight to an MCP front. Each plane has three witnesses.


```mermaid
flowchart LR
  A["agent-a<br/>replays sessions"]
  B["agent-b<br/>replays sessions"]
  G["agentgateway<br/>unmodified"]
  MA["MCP front A"]
  MB["MCP front B"]
  K[("kernel<br/>ledger = ground truth")]
  R1["span relay<br/>OTel collector"]
  R2["log relay<br/>OTel collector"]
  W1[("spans")]
  W2[("access log")]
  W3[("end state<br/>+ outbound sink")]
  A --> G --> MA --> K
  B --> MB --> K
  A -. "SDK spans" .-> R1
  B -. "SDK spans" .-> R1
  G -. "access lines" .-> R2
  MB -. "access lines" .-> R2
  R1 --> W1
  R2 --> W2
  K --> W3
```


| witness   | what it is                                                             | how it loses records                                             |
| --------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------- |
| spans     | the originator's own OpenTelemetry spans, through a relaying collector | the SDK gives a batch up when the relay is away past its retries |
| access    | the receiver's access log, tailed by a second collector                | lines written while that relay is away are skipped               |
| end state | the final state and the outbound sink, each row with its last writer   | an action overwritten or undone later leaves nothing             |


Every SDK and collector setting is its default. No code in the repository drops a record. In the stressed condition both relays are killed partway through a run and restarted 15 to 45 seconds later. The sessions were recorded once from deepseek-v4.1-flash and GLM 5.3, three pools of 72, and each run draws 24 of them. The tasks are back-office tickets where later tickets correct, revert or delete what earlier ones did, so the end state hides things too.


On average a stressed run had 0.068 of its actions in no log at all. The span log missed 0.190 and the access log 0.300.


## What I predicted


The pilot ran 20 restart runs on recorded sessions. The estimator covered 18. That is a Wilson interval of 0.699 to 0.972, and the bar sits on the lower end: with 300 runs it asks for 281 covered. With a flat prior, 18 of 20 puts a pass at 0.165.


The two pilot misses had outages of 17.9 and 19.3 seconds, among the shortest in the first pool, and I built a story on that: a short outage takes a thin slice of each session, and whether the end state hides an action depends on where in the session it falls. I proposed splitting the condition into a short restart and a long one. A refuter showed the line was drawn around the two misses, and I withdrew the split. A second refutation went at my explanation: pooled over the pilot runs, the end state showed the lost actions about as often as the rest, 584 of 966 against 3,352 of 5,634. That is weak support, since the pilot's 84 sessions are counted many times, but it was enough to take the story away. The registration keeps one condition of 15 to 45 seconds. The scripted pilot had covered 23 of 24, which puts a pass at 0.494; the recorded one is the study's kind of session, and 18 of 20 was still 18 of 20. I registered a miss.


The estimator is `ll_sa_hom`: one model named in advance, with one interaction between the two telemetry logs because they lose records to the same outage, and an interval widened by how much sessions disagree. It is not the `ll_bic` of the first four studies. I picked it from the pilot, before the freeze.


## What happened


| prediction                                                                     | result                                                                                           | held?                |
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -------------------- |
| the stressed condition loses enough to test: 0.03 to 0.09 of actions in no log | 0.068                                                                                            | yes                  |
| coverage misses the bar                                                        | 269 of 277, lower end 0.944; 269 of 300 with the 23 set aside counted as misses, lower end 0.857 | no, on the runs left |
| under 5% of intervals have no upper end                                        | 0 of 277                                                                                         | yes                  |
| closer to the truth than a sequence-gap count                                  | 223 of 277 runs                                                                                  | yes                  |
| closer than the union of the logs                                              | 261 of 277, 3 ties                                                                               | yes                  |
| without the end state, coverage is missed                                      | 10 of 277                                                                                        | yes                  |
| unstressed, no interval sits above the truth                                   | none in 58                                                                                       | yes                  |


```json
// cv-chart
{"type":"forest",
 "title":"Share of stressed runs whose 95% interval held the true count",
 "panels":[
  {"metric":"coverage (bar 0.90 on the lower end)","rows":[
    {"label":"ll_sa_hom, the 277 runs in the test","point":0.9711,"ci":[0.9441,0.9853],"color":0},
    {"label":"ll_sa_hom, the 23 runs set aside counted as misses","point":0.8967,"ci":[0.8571,0.9262],"color":1},
    {"label":"ll_bic, the estimator of studies 1 to 4","point":0.8556,"ci":[0.8093,0.8921],"color":1},
    {"label":"sequence-gap count","point":0.1227,"ci":[0.0892,0.1666],"color":1},
    {"label":"two telemetry logs, no end state","point":0.0361,"ci":[0.0197,0.0652],"color":1},
    {"label":"union of the logs","point":0.0072,"ci":[0.002,0.0259],"color":1}]}],
 "caption":"Wilson intervals over runs. Runs replay sessions drawn from three pools of 72, so they are not independent and the intervals are narrower than new sessions would give. Rows 1 and 5 have registered criteria; row 2 is the registered bound with no criterion of its own; the rest are descriptive."}
```


Of the eight misses, seven intervals ended 1 to 5 actions below the truth and one started 9 above it. The median error of the point was 3.9 actions; the union's was 22.0.


The win over the union is weak by construction. The union can't be above the truth and the estimate adds to it, so it wins whenever it adds a sensible amount. The comparison that carries information is the sequence-gap count, which reads missing request ids per plane and covered 34 runs. Even that one is uneven: the gap count never sees the end state, so it compares information as much as method.


The point itself is nothing new. It is the plain two-list estimate between telemetry and the end state, and a simple Chapman interval on the same two lists covered 250 of the 277 runs. What the registered estimator adds is its interval, 269 against 250.


## Without the end state


Take the end state away and estimate from spans and access alone: 10 of 277. In this rig that follows from the design. Both relays are killed together, so the two logs lose the same seconds and their overlap says almost nothing about what both missed. The result does not speak to telemetry logs whose collectors fail on their own.


The third witness fails for an unrelated reason. A state diff does not care that a collector was down; it loses an action only when a later one overwrites it. The estimate still rests on an assumption the study did not test inside a run: that the actions both logs lost are as visible in the end state as the rest. In the pilot the end state showed actions unevenly, 0.42 of those in the first fifth of a session against 0.82 in the last. What I would carry out of this study before the coverage number is narrower than the number: in this rig, two telemetry logs behind relays that die together were one witness with two names.


## The 23 runs


A run is set aside when the rig did not do what the schedule said. The registered check lists the reasons. A replayed call more than 0.25 seconds late is one, an originator not ready at the start is another, a container clock off the driver's is a third. A run set aside is not replaced.


34 of the 420 runs failed that check, 23 of them in the stressed condition. Most were late calls. I ran the study on a laptop under Docker Desktop, and at run 323 Docker Desktop quit. One run died with it. I restarted the engine and the launcher picked up where it stopped.


The restart does not fit as the cause, though I offered it as a candidate in the first version of the results entry. A refuter I ran on that entry counted the runs in order, and the trouble starts before the quit.


```json
// cv-chart
{"type":"bars","title":"Runs set aside, in the order the runs were made","series":[{"key":"aside","label":"set aside","color":1},{"key":"kept","label":"in the test","color":0}],"domain":[0,307],"data":[{"label":"runs 1 to 307","aside":7,"kept":300},{"label":"308 to 322","aside":4,"kept":11},{"label":"323 (Docker quit)","aside":1,"kept":0},{"label":"324 to 378","aside":21,"kept":34},{"label":"379 to 420","aside":1,"kept":41}],"caption":"All conditions. The trouble starts before the quit and ends with no change I know of. Eight runs have calls 20 s or more late or a container clock 24 to 104 s behind, which is what a sleeping host leaves. The rest are under 6 s late. Neither cause is established."}
```


The careful reader's objection is short: I dropped 23 runs and passed on the rest. The rule that dropped them was frozen before any run, and none of the 23 is of the two kinds the registration flags as able to follow from the loss itself. That is not enough. The runs set aside are bunched in time, and they are rarer with no stress, 2 of 60 against 23 of 300, so lateness may come partly from the stress. I cannot show that being set aside was independent of what the logs lost.


The registration has an answer for that and it is the only one I offer. Count every planned run that is not in the test as not covered: 269 of 300. By the registered readings that is "not shown", neither a pass nor a miss. The pass is real on the runs left, and it does not survive counting the missing ones against it.


## What the tool ran


On one unstressed run, where no log lost anything, the estimator failed to converge and returned an infinite estimate. By the registered rule an interval with no upper end counts as covering, so it changed no verdict. An estimator that returns nothing on a complete log is still broken.


The installable tool also did not run the estimator the study tested. I built `lacuna estimate` before the study, on the model-selecting estimator of the earlier ones, and wrote in the decision log that the default would be revisited once the study was in. `ll_sa_hom` lived in a study script.


Both are changed in the release, after the verdicts were read, which makes them post hoc. The tool now runs `ll_sa_hom` when the map has the study's layout, two id-linked logs and a state diff per plane, and says under every estimate whether that is the estimator the study tested. Where the registered fit gives no answer, the library version falls back to the model's closed form; on that one run it returns 325, interval 325 to 326, a figure a test in the repository reproduces and no study artifact holds. Recomputed once over the raw runs, it matched the registered code on the other 385; that check is in no committed artifact either. The registered artifacts were not regenerated.


## Limits


**One rig, and I built it.** One topology, one task mix, two models recording benign sessions, relays killed together for 15 to 45 seconds. I make no claim by outage length, pool or any other subset; the registration bars it.


**Part of the pass is my own design.** I wrote the task mix that decides what the end state hides, and its weights. I chose the estimator and the condition after a pilot on the same rig.


**Runs share sessions.** Each pool has 72 sessions and every run draws 24. The Wilson bound treats runs as independent. New sessions would move the number more than the interval says.


**The end state comes from one kernel.** In the rig a single service holds the final state. The registration stipulates that it stands for several downstream systems whose logs are not collected. The study does not show that.


**No adversary.** Nothing here tried to hide an action.


**I work on a commercial AI gateway.** Nothing from that product is in the study. Every component is open source and pinned by digest, and all data is synthetic.


**The public record is one timestamp.** The freeze is a signed tag, and GitHub's own record puts the push at 01:05:23 UTC. The other times are my machine's: the sample run the registration reads started at 01:05:47 and the launcher for the 420 at 01:09:15. I made no deposit on OSF or Zenodo, against an earlier decision of mine to make one.


**What I knew before the analysis.** The launcher printed each run's exit status as it went, so I knew how many runs had failed the integrity check before any was analysed. I saw no run's contents and no estimate until the runs were sealed.


**An AI assistant did much of the work.** It wrote code and text under my direction, and it made the registration's tag on my instruction, with my key. The registration says so, and says it does not claim I read its final text.


## What to check before relying on this kind of count

1. If one counter sees every action, use it. This is for when none can.
2. Find a witness that fails for a different reason than your telemetry, and check that the reason really is different. Two logs whose relays died together covered 10 of 277.
3. Report the union of the logs as a floor, never as the total. It held the true count in 2 of 277 runs.
4. When your own evaluation drops runs, publish the number with them counted against you next to the one without.

Everything is in the repository: the verdicts, the registration, and the decision log, including the entry that corrects my first account of the results.

- Verdicts: [study5-verdicts.json](https://github.com/caiotheodoro/lacuna/blob/v1.0.0rc1/artifacts/robustness/study5-verdicts.json)
- Registration: [PREREG-STUDY5.md](https://github.com/caiotheodoro/lacuna/blob/prereg-study5/docs/PREREG-STUDY5.md)
- Results and their correction: [decision log, D92 and D93](https://github.com/caiotheodoro/lacuna/blob/main/docs/DECISIONS.md)
- Tool: `pip install lacuna-mse` ([PyPI](https://pypi.org/project/lacuna-mse/))
- Paper: [release v1.0.0](https://github.com/caiotheodoro/lacuna/releases/tag/v1.0.0)
- Raw runs: [release v1.0.0rc1](https://github.com/caiotheodoro/lacuna/releases/tag/v1.0.0rc1)
- Code: [github.com/caiotheodoro/lacuna](https://github.com/caiotheodoro/lacuna)

---

More posts: https://caio.theodoro.dev/blog.md · About the author: https://caio.theodoro.dev/about.md · Machine-readable index: https://caio.theodoro.dev/llms.txt
