Skip to content

fix(host): contain background failures and retry execution settlement - #80

Merged
cloader merged 1 commit into
devfrom
codex/fix-durable-settlement
Nov 1, 2026
Merged

cloader merged 1 commit into
devfrom
codex/fix-durable-settlement

Conversation

@cloader

@cloader cloader commented Nov 1, 2026

Copy link
Copy Markdown
Owner

What changed?

A rejected storage startup or execution-settlement promise could escape to DSH's fatal rejection handler. Settlement also dropped its run entry before the ledger write, leaving a running record and claim with no tracked recovery when persistence failed.

  • Add terminal handlers to startup cleanup/external-sync chains. Keep the original readiness promise rejected so tools and data routes cannot serve an empty ledger as healthy; storage diagnostics remain accessible and report filesystem startup errors.
  • Share settlement handling across fresh and adopted runs, success, failure, and cancellation. Retain the outcome intent, completion time, evidence, and concurrency reservation until persistence succeeds. Retry failed writes after 1s, 5s, 15s, and 60s; after exhaustion, retain tracking and log recovery instructions (restore storage, then retry Stop or reload).
  • Give cancellation priority over uncommitted results, wait for agent disposal, suppress prompt submission after a failed startup cancellation, and cancel retry timers at teardown. Terminal-record checks make retries idempotent, including periodic successor creation.
  • Handle external-session event and periodic-scan rejections at their background boundaries.

How verified?

  • Windows, Node 22.23.1 and Node 26.13.0: typecheck, build, and all 48 test files / 622 tests pass.
  • 17 new regressions cover fatal startup isolation in real child processes, guarded tools/routes, fresh/adopted settlement retries, failed/cancelled outcomes, cancellation races and startup windows, bounded retries, teardown, periodic idempotency, and external-session callbacks.
  • The two startup regressions fail against the pre-change build with a fatal child-process exit and pass against the fixed build.
  • An initial Windows full run hit EPERM in the unchanged cross-process ledger-lock test. Its isolated rerun and subsequent full runs passed; no lock implementation changes are included.

Related issue

Fixes #74.

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.

[bug] Unhandled rejections in fire-and-forget chains kill the whole DSH host (storage boot, execution settlement)

1 participant