Skip to content
Engineering Case Study
Awaiting weekly review
The Receipt Was Corrupted. Why Didn't the Task Start Again?
Open-source engineering · Controlled research

The Receipt Was Corrupted. Why Didn't the Task Start Again?

Corrupting a receipt caused another executor callback, but the real dispatch chain did not start a second execution. Two rounds of counterexamples separate read anomalies, repeated calls, execution attempts and external effects.

Full-resolution cover

The Receipt Was Corrupted. Why Didn't the Task Start Again?

We deliberately corrupted a command's completion record and submitted the same command again. The system did call the function responsible for execution a second time.

But do two function calls necessarily start the task twice? Once we connected the function to the product's actual dispatcher, the answer was no. The simulated execution interface still started only once, leaving one execution-attempt record.

Counting function calls alone could easily lead to a premature conclusion of duplicate task execution.

We call that function the execution callback below. The simulated interface replaces the SDK through which the runtime connects to a model. It simulates a start in memory, without a real model, payment, email or code push.

Another callback is not another start. Another start is not, by itself, evidence of a duplicated external effect.

This is not an account of a production duplicate-dispatch incident. It is how counterexamples made us withdraw a premature engineering conclusion.

1. Why can a receipt affect the next execution?

CodeFlowMu is our local multi-agent collaboration system. FCoP organizes task identity and business records; the runtime handles dispatch, sessions and technical execution.

When a user asks to retry a task, the system must both handle the command and record its processing. A response may be lost or a process restarted. On seeing the same request later, the system must distinguish a new command from one already handled.

An idempotency key identifies the same intent. A command receipt is typically recorded as pending while being processed, then appended as completed when a result exists. Receiving the same key again can return the old result instead of repeating the operation.

We first inspected selected historical files to avoid mistaking event counts for incidents.

Historical sample read September 8Count
Task-command receipt rows10
Distinct idempotency keys5
Pending / completed5 / 5
Malformed / exactly duplicated rows0 / 0

The records were from September 5. Ten rows represented state events for five commands, not five duplicate dispatches. They did not contain the corruption later injected by the experiment.

We therefore asked in isolated fixtures: if a completion receipt can no longer be read, how does the system judge the same retry request?

2. First round: the bytes remain, but the readable state moves backward

The current receipt reader searches lines in reverse order. It skips an unparseable line or a record with an unrecognized schema version, continuing to a readable match.

This tolerates unrelated bad lines, but it also means that a damaged completion may reveal an older pending receipt. If both target records are unreadable, the reader may return null: no usable record found.

Neither the inspected code nor the experiment showed the reader deleting original bytes. The difference concerns the evidence available to the caller, not what remains on disk.

To isolate this behavior, we used the real command kernel and receipt store, a fixed governance snapshot permitting retry, and a counting executor. Each retry created a new kernel instance so the previous instance's memory cache could not supply the answer.

Read the table for three patterns first: intact receipts allow replay; damaged target receipts can lead to another call; downstream deduplication can still coalesce the effect. The other controls test the conditions under which those statements hold.

Controlled conditionSecond read or handling resultCumulative callbacks / synthetic effects
Intact completionReuses completed result1 / 1
Unrelated malformed line onlyStill reuses target completion1 / 1
Damaged completion, intact pendingEnters callback again2 / 2
Both target receipts damagedNo usable receipt; enters callback again2 / 2
Both damaged, current revision changedRejects stale revision1 / 1
Reader explicitly throwsStore unavailable; no further call1 / 1
Completion changed to unsupported versionFinds older pending; enters callback again2 / 2
Damaged completion, intact pending, revision changedDetects state advance; no further call1 / 1
Damaged completion, executor deduplicates same keyCallback repeats; effect is coalesced2 / 1

The explicit reader error was an injected counterexample, not a claim that the current reader reports corruption this way. The unsupported version was also synthetic. The last row's deduplication set lived in the experiment's memory, not a durable database.

The first-round conclusion therefore stops at the call boundary: without an explicit read-anomaly signal, the real kernel can call the executor again; whether the effect repeats depends on that executor. The existing kernel already permits retries from pending when the revision is unchanged, expecting downstream work to coalesce under the same key.

3. Second round: measure whether another execution actually starts

Instead of merely incrementing a counter, the second-round callback entered the product's actual task-starting flow. Components responsible for dispatch, attempt persistence, task lifecycle and sessions all came from the current product implementation.

A fixed governance snapshot permitted retry so the request could reach that layer. The final execution interface was still the in-memory substitute described above. We did not issue a request through the web interface: research code passed the same key and dispatch arguments following the web service's retry logic. This exercised actual dispatch components, not the entire web entrance end to end.

This answers a narrower question closer to execution: does the real dispatch chain turn the repeated call into another attempt and another SDK start?

Every scenario first confirmed that an execution started, then damaged isolated receipts and performed the second step. Counts include that first execution. Look first for two outcomes: original-key scenarios did not start again; the new-key control could start. The intervening rows distinguish cancellation, revision changes and concurrency.

ScenarioChangeSecond resultCumulative SDK starts / attempts
I0Intact receiptsReceipt-level replay1 / 1
I1Completion corruptedAlready dispatched1 / 1
I2Both target receipts corruptedAlready dispatched1 / 1
I3I2, new process reads original disk stateAlready dispatched1 / 1
I4I2, cancel original session, retry original keyAlready dispatched1 / 1
I5I2, governance revision changedKernel rejects stale revision1 / 1
I6I2, eight kernels concurrently call one dispatcherAll eight return already dispatched1 / 1
I7Cancel, then use a new command keyNew attempt and start2 / 2

I2 repeats the callback without a second SDK start; I7 changes the command key and creates another attempt.

Figure 1. Cumulative counts include the first execution. The protection layers listed are not a claim that I2 traversed every check. Synthetic SDK starts are not external effects. Source: formal I2/I7 observations and boundaries.

Open full-size figure

I1 and I2 correct the most dangerous extrapolation from round one. The receipt could no longer tell the kernel that processing had completed, but session and lease evidence still told the dispatcher not to start again.

I4 adds that cancelling a session does not turn the same command into a new one. Actual reconciliation moved the old attempt to a terminal state. The same key continued to reuse that attempt without another start. Here, the internal phrase “already dispatched” must not be translated as “the old process is still running.”

I7 is an essential control. Without it, readers could suspect the system simply never executes anything. With a different key, the new command allowed by synthetic governance created a second attempt. That is not a same-key duplicate effect, and it does not mean changing a key grants human authority. We did not test the complete authentication and approval interface.

4. The second start was not stopped by one all-powerful receipt

The source explains the observations.

First, the dispatcher checks sessions and active execution leases for the current task and round. A lease describes execution occupancy: who holds which attempt for a task. It is not a business conclusion that the task is complete. Existing sessions or active occupancy should not naturally grant another start merely because dispatch is entered again.

Second, the attempt store reuses records by idempotency key. offer() finds or proposes an attempt; claim() tries to acquire occupancy. These are not equivalent to “one call, one start.” Terminal attempts and conflicting leases have their own rejection conditions.

Finally, one dispatcher serializes redispatch for the same task. Preventing duplicate attempt records alone would not prevent two flows from simultaneously changing task placement. I6 therefore tests the single-instance protection around the larger operation.

I3 exposes a detail worth explaining. The new process has no old in-memory running handle, but the session list still reads a durable running record, and the lease remains. This conservatively blocks a second start. It does not establish that the original executor is alive or that work has recovered.

We did not run full startup recovery or simulate hardware power loss. “The new process retained existing occupancy evidence” accurately describes the result. “Power-loss recovery passed” would not.

5. Why external log repair cannot be imported as a local defect

One starting point was Orca's session-log repair proposal. It addresses a different risk: repair deleting log content after a damaged position, while provider-side conversation history cannot reconstruct the application's own receipts.

At the September 8 research snapshot, the proposal was still a draft. It preserves the original log, publishes the readable prefix as a new generation, and restricts writes for unsupported versions. This was not a released capability independently verified by us. Orca #19399

The two cases are not equivalent. Orca's proposal removes destructive repair; the reader in our experiment did not delete original text. The common concern is that recovery needs its own evidence. Reopening a conversation, or having the model remember it, does not establish that recovery's decision evidence stayed unchanged.

Nor do all local stores skip bad input. The inspected single-record session store distinguishes missing files from corrupt ones. Corrupt operation approvals return an explicit error. These readers also preserve the original bytes. Such counterexamples prevent generalizing one JSONL reader into a claim that the whole system treats corruption as absence.

6. The engineering question is read health, not a verdict of duplicate execution

The second round did not remove the read-layer anomaly. A damaged completion can still leave the caller seeing only an older pending receipt or no usable record, without knowing that corruption lies behind that answer.

Existing execution protections held in the tested scenarios, so the review question should be narrower: can the read result express both which record was found and whether reading was healthy? Should absence, corruption and unsupported versions carry distinct diagnostics? Which commands should those diagnostics affect, and which signals should support explanation or reconciliation only?

This does not immediately prescribe stopping the whole system for one bad line. Unrelated damage, a usable target receipt, version compatibility and actual execution occupancy need separate handling. A blanket block could cut off recovery paths that already work.

A reusable research method is to count each layer: original bytes retained, result read, callback entries, attempts created, executions started and external effects produced. Make conclusions only about the layer actually measured.

Reliability research is not about proving a problem as quickly as possible. It is about locating the problem where a counterexample from the next layer can no longer overturn it.

Here, the callback arrived twice without starting the task again. Preserve the protections that worked; clarify the read anomaly that remains unexpressed.

Research and evidence boundaries

The fixed first-party source was c008d9db91a21136fc61a4f60314e22db395d5d2, examined September 8. Round one contained 18 module controls. Round two contained eight dispatch scenarios and four identity probes. Each set had two formal runs. This article uses related subsets, not repetition counts as incident samples or a reliability percentage.

All corruption was injected into isolated fixtures. Kernel, store, dispatch and session components were real; governance inputs and SDK were synthetic. No real external effects were tested. Eight-way concurrency shared one dispatcher in one process. The cross-process case was sequential handoff, not a cross-process write-lock test. Hardware power loss, all commands, all execution platforms and independent QA remain outside scope.

English evidence guide · Chinese guide. Sanitized per-run observations, source hashes, aggregate history and a record checker are public. The checker verifies saved observations, not a fresh execution of the product. Original operational records, complete before/after fixtures and full product replay remain access-restricted. The research changed no product code and authorized no recovery implementation.

Last updated: