Offline expenses upload twice after a partial sync failure
A Flutter expense app loses track of what it already uploaded when the server rejects one item.
WHAT THE AGENT RECEIVES, WORD FOR WORD.
Expenses created offline get uploaded twice. Repro: go offline, add three expenses, have the server reject the second one, reconnect, then sync again later. Expected: expenses 1 and 3 are uploaded once; expense 2 stays queued with its error and uploads on the next sync. Actual: expense 1 is uploaded again on the next sync. Do not change SyncService’s public API.
Shows up late
The bug appears only on the second sync, after a partial server failure.
No file pointer
The report describes user behavior, not the code to change.
A tempting wrong fix
Retrying the whole batch passes a naive test and fails ours.
A fixed boundary
The sync service’s public API can’t change, so the fix has to live inside it.
WHAT SHIPS WITH IT.
instruction.mdThe text abovetask.tomlMetadata, timeouts, resourcesenvironment/DockerfilePinned Flutter SDK, warmed package cache, network offsolution/solve.shReference fix. Private, never shown to the agenttests/test.shGrading script. Privatetests/hidden/*_test.dartHidden tests. Private
HOW IT’S GRADED.
- Restore the original test folder, undoing any agent edits.
- Copy in the hidden tests.
- Run the full suite. Reward is 1 only if everything passes.
test('partial failure never re-uploads synced items', () async {
final api = FakeExpenseApi(rejectIds: {'e2'});
final queue = InMemorySyncQueue([exp('e1'), exp('e2'), exp('e3')]);
final sync = SyncService(api: api, queue: queue);
await sync.run();
api.rejectIds.clear();
await sync.run();
expect(api.uploadCount('e1'), 1);
expect(api.uploadCount('e2'), 1);
expect(await queue.pending(), isEmpty);
});
MEASURED RESULTS.
Calibration results, pass rates by agent and model over repeated runs, ship with every task set. This public sample isn’t calibrated yet.

