Skip to content

Retire a buffer from any state - #124

Merged
krokicki merged 9 commits into
pause-keeps-the-filefrom
retire-anywhere
Nov 29, 2026
Merged

krokicki merged 9 commits into
pause-keeps-the-filefrom
retire-anywhere

Conversation

@krokicki

Copy link
Copy Markdown
Member

A buffer can be retired from wherever it is. Until now retire was accepted only where a buffer serves (ready, idle), so a buffer that was cancelled, never started, stopped at needs-human or shelved could not be retired.

Stacked on #122. Spec: docs/specs/2026-11-26-retire-anywhere.md.

What changes

buffer-api accepts it (1348d3b)

  • STAGE_ACTIONS has retire at every buffer stage but retired.
  • A shelved buffer takes unshelve and retire; a shelved dataset or request takes unshelve alone, as before.
  • When a buffer's stage is written as retired, its hold ends in the same transaction, with a timeline entry that says so. A retired buffer then reads the status done.

The workflow acts on it where the buffer is (295715d, 5f5a930, 4510e17)

  • A person's retire has a queue of its own (retire_events, beside cancel_events), so no step of a round refuses it.
  • A round in progress or at a gate is ended as a cancel ends it (jobs killed, locks released) and the buffer rests at retired. The same holds for a ready buffer whose late datasets still source.
  • A buffer that serves abandons a rebuild; one that rests has nothing to end.
  • Every version of the buffer that is still registered is then released. The list is read from the registry (new read activity live_buffers), not from the workflow's state, so a run that the retire itself started releases what earlier runs registered.
  • The entry that writes retired names who retired the buffer and each version released, or says that nothing was registered.
  • A round whose job could not be killed ends needs-human saying so, as a cancel does; a retire sent there finishes it.
  • A run does not roll over while a retire waits, and a redelivered retire is dropped where it arrives.
  • The new handling is behind workflow.patched("retire-anywhere"), taken in the signal handler. The keeper's retire of one idle version stays a lifecycle signal.

The page asks first (2de6a38)

  • Retire gets a confirmation built from the subject's stage: what this retire ends where the buffer is now, then what every retire does (every registered version released, draws archived, off the shelf if shelved, can be planned again).

Docs (9e753c4, 35c88eb, f462d7f, dbc2424): the spec and plan, AGENTS.md (a new rule, the stage-table and shelving rules), docs/development.md, the README and the page's guide.

Known limits

  • A retire of a serving buffer during a rebuild cancels the rebuild's tasks, but a stage job one of them had running is not killed and runs to its end. A go there behaves the same way. Ending it needs the rebuild to unwind as a round does; the spec records it as a known gap (§3.6).
  • A run whose history already holds a person's retire as a lifecycle signal keeps that handling (refused outside ready and idle) until it rolls over.
  • A go and a retire that both wait while the buffer rests are taken retire first. The page sends one action at a time.

Deployment

The buffers worker and buffer-api restart together: the workflow calls an activity the worker must have registered, and buffer-api reads the stage table when it starts.

Checks

  • Run locally: the full suite (1963 passed), lint and typecheck.
  • New workflow tests cover a retire at rest (new, needs-human with a buffer registered, cancelled), in sourcing, at the plan gate and at staged, at ready with a superseded version and with a late dataset still waiting, with a job that cannot be killed, at retired, across a rollover, and redelivered. buffer_history_retire.json is a new replay fixture; the recorded fixtures replay unchanged.
  • Also tested: the stage table, _rules for a shelved buffer, the hold ending with the retired write, live_buffers, and the confirmation text per state (imported under node).
  • An independent review found three bugs, fixed in 4510e17 with tests: a retire of a ready buffer with a late dataset waiting was neither acted on nor refused, a redelivered retire could end a later round, and a retire that started the run wrote retired without an entry.
  • Not checked: the confirmation dialog in a browser.

🤖 Generated with Claude Code

krokicki and others added 9 commits November 26, 2026 21:01
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…elved; retired ends its hold

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…eases every version

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…edelivery, and says what it released with no round

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@krokicki
krokicki added this pull request to stack #125 November 28, 2026 03:18
@krokicki
krokicki merged commit d8e6dcd into main Nov 29, 2026
1 check passed
@krokicki
krokicki deleted the retire-anywhere branch November 29, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant