Skip to content

HistoryJournalStore.dispose() is fire-and-forget: recorder dispose errors are swallowed and scratch is removed asynchronously #3867

Description

@acoliver

Problem

In PR #3852 (#854), HistoryJournalStore.dispose() (packages/core/src/services/history/historyJournalStore.ts) is synchronous. When the store owns its recorder, it hands the real work to a detached promise chain:

void this.fanoutFeed
  .settle()
  .catch(() => undefined)
  .then(() => recorder.dispose())
  .catch(() => undefined)
  .then(() => {
    if (this.binding.ownsRecorder) removeTempDir(tempDir);
  });

That has three consequences:

  1. Errors disappear. A failure to settle mirror delivery or to dispose the recorder is swallowed twice, so nothing reports it. This conflicts with the project's fail-fast rule.
  2. Callers can't wait. Nothing can await completion, so code that disposes and then exits, or disposes and immediately checks scratch, races the cleanup.
  3. Scratch can leak. If the process exits before the chain runs, the llxprt-history-* scratch directory stays on disk.

Proposal

Make disposal awaitable, for example dispose(): Promise<void> or an [Symbol.asyncDispose], and let failures propagate to the owner that disposes the store. Keep a synchronous path only where an owner genuinely cannot await, and make that path report failures somewhere visible instead of discarding them.

Acceptance

  • A recorder dispose failure surfaces to the disposing owner.
  • After awaited disposal, the store's scratch directory no longer exists.
  • Existing scratch-after-dispose and journal lifecycle tests stay green.

Follow-up from #854 / PR #3852, listed there as a known open item.

Activity

  1. github-actions commented on Oct 13, 2026

    @github-actions
    Contributor

    LLxprt Issue Planner — infrastructure failure

    The autonomous planner failed with exit code 1. Please inspect the workflow logs (Run planner agent section) and re-run once resolved.

  2. added theissue type on Oct 13, 2026
  3. added this to the 0.12.0 milestone on Oct 13, 2026
  4. added a commit that references this issue on Oct 13, 2026
    bff4614
  5. moved this from Todo to In Progress in LLxprt Roadmapon Oct 15, 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

    Code Quality / ModularizationIssues to do with the quality of llxprt code and its maintainability.packages/coreIssues related to packages/core component

    Type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions