Back to buildsBUILD RECORD

The Glass Archive / Editorial automation / 2026

Building each episode around four tracked frames.

An n8n dispatcher verifies ownership of a story seed and creates episode and frame records before rendering, giving returned assets explicit places to belong.

THE WORK

The project.

The Glass Archive organizes generation around an episode before the first frame is rendered. Its dispatcher claims a ready story seed, verifies the lock owner, and creates an episode with four pending frame records. The worker can then attach returned assets to those identities while the registry shows what is still waiting, rather than reconstructing the episode from a group of finished files.

The source lock also scopes recovery: a failed handoff releases only the seed still owned by that execution. Episode numbering needs a separate rule, however. The current allocator reads the highest number and adds one, so two dispatchers holding different stories can still choose the same next episode. This account describes the exported implementation and that unresolved concurrency case, not an executed collision or verified live run.

IMPLEMENTATION

Design choices.

  1. Claim acquisition is followed by verification. Reaching an update node doesn't prove that it returned one usable row owned by this execution; the readback checks that before episode allocation proceeds.
  2. Episode and frame records exist before rendering. They provide explicit pending state and attachment targets, although the separate upserts don't form one atomic allocation transaction.
  3. Story ownership is distinct from episode-number reservation. Max-plus-one is easy to derive from the registry, but different valid seed owners can read the same maximum. The shared number still needs concurrency control.
  4. Eligible seeds are chosen uniformly at random. A ranking-oriented node name doesn't make the selected story the highest-scored candidate, so the account follows the actual selection code.
  5. Failed handoffs release only a still-owned seed. This avoids clearing another owner's lock, but a lost response after worker acceptance remains ambiguous. An idempotent handoff or acceptance readback is needed before requeueing can resolve that case.

HOW IT FITS TOGETHER

Architecture.

  • The story pool records eligibility, lock owner and expiry. After selecting an eligible seed, the dispatcher conditionally claims it and reads back by external key, locked status and owner. Missing, multiple or mismatched rows stop allocation.
  • The allocator reads the season registry and adds one to the maximum episode number, rolling over after ten episodes. It upserts metadata by the calculated episode key; that shared calculation is separate from ownership of the selected story.
  • The dispatcher creates four pending frame records before handing work to the worker. Provider generation and storage use those episode and frame identities, so an artifact can be attached to the intended frame as it arrives.
  • A rejected or unrecognized handoff response marks the episode failed. Recovery releases the source seed only if its key and owner still match, preserving another execution's claim while leaving lost-response acceptance to resolve.
Explore the architecture map9 components · 14 connections

Seed ownership, episode records and frame production

Dispatch prepares shared episode state before a worker renders frames; failed handoff has a source-lock recovery path.

Direct callAsync taskResponse / returnBlocked / denied
Selection and handoff
Shared records
Frame production

Scroll or drag the background to move. Use the zoom buttons to resize.Arrow keys move between components. Enter selects.

Choose a component to explore

Select a numbered component on the map or use the component menu. Its details and connections will appear here.

No component selected.

All connections (14)
  1. 01 · Story pool02 · Claim and verifyEligible candidate · Direct call
  2. 02 · Claim and verify01 · Story poolOwned lock · Direct call
  3. 02 · Claim and verify03 · Episode allocatorVerified claim · Direct call
  4. 04 · Episode registry03 · Episode allocatorSeason episode rows · Direct call
  5. 03 · Episode allocator04 · Episode registryUpsert episode · Direct call
  6. 03 · Episode allocator05 · Pending frame recordsPending placeholders · Direct call
  7. 05 · Pending frame records06 · Worker handoffPrepared frame context · Direct call
  8. 06 · Worker handoff07 · Frame workerEpisode request · Async task
  9. 07 · Frame worker08 · Image providerSubmit / poll · Async task
  10. 08 · Image provider07 · Frame workerFrame output · Response / return
  11. 07 · Frame worker09 · Stored frame assetsPersist output · Direct call
  12. 09 · Stored frame assets05 · Pending frame recordsResolve frame records · Direct call
  13. 06 · Worker handoff04 · Episode registryMark handoff failed · Blocked / denied
  14. 06 · Worker handoff01 · Story poolRelease matching owned lock · Direct call

MADE WITH

n8n · Apify · Data Tables · OpenAI · Grok · JavaScript · Notion

CHECKS & RESULTS

What was checked.

A source review shows what the code does. It is not a fresh test of the running app.

  1. Code and development records reviewedReviewed

    The code, tests and available development records were checked. Reported test results keep their original scope. No fresh app or live deployment check was run for this write-up.

    Scope of this check
    Code review, not a fresh run of the app

NEXT

Still to work through.

Preallocated frames make the episode easier to follow while generation is incomplete. The next tests need to cross the places where those records are shared: two simultaneous number allocations, then a worker that accepts a request whose response is lost. A per-story lock answers who owns the source; it doesn't answer either of those questions.