Skip to content

ui-server: receipt schema admission skips oldest-first reclamation and loses the capacity cause #4449

Open

Description

@schlessera

Part of #4426 (follow-ups from #4278). Deferred from the review of PR #4447, which introduced it.

Context

ensureCodeReceiptTables (packages/ui-server/src/brain/journal-accounting.ts:262-279) returns false for JournalCapacityError. captureCheckout (packages/ui-server/src/brain/turn-journal.ts:335) calls it outside retain() (:451-457), and throws JournalStorageUnavailable("checkout_receipt_schema_not_admitted"). A journal near its cap that has reclaimable ended turns therefore refuses the first checkout capture, and the turn records journal_unavailable instead of journal_capacity. It heals when another write triggers reclamation.

Scope

Schema admission in captureCheckout, and the accounting function's refusal signalling. Keep a pinned-WAL refusal unclassified, as SCHEMA_ADMISSION_REFUSAL_DOES_NOT_INVENT_A_CAPACITY_CAUSE requires.

Acceptance criteria

  • A capacity refusal of schema admission collects the oldest ended turn and retries, until the schema is admitted or nothing is left to reclaim.
  • When nothing is left to reclaim, the turn's cause is journal_capacity.
  • A non-capacity refusal still reads journal_unavailable.
  • A test with a cap below the schema allowance and one reclaimable turn admits the tables in the same capture, with a mutation receipt.

Activity

  1. added
    type: fixSomething is broken and must behave the way it is documented.
    area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.
    priority: p3Someday. Needs a driving use case before it starts.
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.priority: p3Someday. Needs a driving use case before it starts.type: fixSomething is broken and must behave the way it is documented.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions