Urgent.News

What's breaking now, across thousands of outlets.

Tech

48-Hour Field Notes: My Batch Job Trusted Local Disk, and a Restart Re-Bought Every Token

48-Hour Field Notes: My Batch Job Trusted Local Disk, and a Restart Re-Bought Every Token I had a batch job that walked a queue of documents, called a model for each one, and wrote a summary into an output table. It ran fine for six hours on a small worker, and I felt clever about the whole arrangement. Then the worker restarted, the queue replayed from the top, and every item got processed a…

In the first six hours, the batch job processed five documents serially, writing summaries into an output table. The process was straightforward: claim an item, build a prompt, call the model, write the result, and mark the item as finished. Despite its simplicity, the author trusted the smoke test because it was fast and gave green output, but this was an unreliable proxy for proper recovery behavior.

The issue arose when the worker restarted mid-run, causing duplicate processing of previously completed items. This happened because the resume mechanism depended on the worker's local disk, which does not guarantee durability if the worker restarts. The author realized that they had been making three assumptions without testing them: the local disk survives a restart long enough for a checkpoint file to matter, the job already ran can be figured out from its own state, and a restart is similar to a crash, so the same recovery logic applies to both.

To address this, the author created a receipts table instead of relying on a checkpoint file. The table uses the content of the work as the primary key, ensuring that each call is uniquely identified. The author also introduced the idem_key function to generate a unique identifier for each item. By marking items as claimed before the call to the model and updating the state accordingly, the author solved the problem of repeated work and latency during the restart.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Order Is a Hidden Input: Permutation-Sweeping an Agent-Patched Test Suite

An agent patch can pass your entire suite in the default order and still be order-coupled. The green run proves the suite works in one sequence, not that the tests are independent.

  • Order is a hidden input in agent-patched test suites
  • Patch stability depends on default code order, not just affected code
  • Stateful suite reveals order-coupled issues from caches and side effects

Two Commits per Refactor: A Diff Gate That Keeps Pins Away From the Move

Most messy-repo refactors fail at review, not at runtime. The riskiest commit is the one that edits tests and production code together.

  • Script splitgate.py separates pins from moves in repository
  • Config file defines testglobs, codeglobs, and neutralglobs
  • Script exits with codes 0 (clean), 1 (mixed), 2 (unclassified), or 3 (git error)

Principles of Anchor Engineering

  • Anchor Engineering shifts focus to human judgment in AI-driven development
  • Anchors are high-level design decisions guiding AI code implementation
  • Shared "Anchor Book" ensures team alignment and reduces inefficiencies

★ HomeView Thoughts and Observations

There’s a real “*Why do we need this?*” question here and I don’t think Apple’s video answers it, at all. You need to think you want it if you’re going to buy it.

  • Apple unveils HomeView, a home hub device
  • Product's name criticized as inconsistent with other Apple products
  • Practical concerns raised over cable and installation needs

More from Saturday 17 October →