Skip to content

Add deterministic worker idle waiting - #35

Merged
ggoodman merged 3 commits into
mainfrom
codex/wait-for-idle
Jul 27, 2026
Merged

Add deterministic worker idle waiting#35
ggoodman merged 3 commits into
mainfrom
codex/wait-for-idle

Conversation

@ggoodman

@ggoodman ggoodman commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

What

  • Add LedgerWorkers.waitForIdle({ signal }).
  • Resolve at an idle linearization point when no pending, delayed, leased, or executing work remains.
  • Share one generation-based change signal between event following and worker-state waiting.
  • Supervise dispatch and work-processing failures through one worker failure state that preserves arbitrary rejection reasons and lease ownership.
  • Make event-stream and worker-idle reads stop waiting promptly on cancellation while safely observing the underlying storage operation.

Why

Consumers can coordinate with Sledge's worker runtime without polling ledger projections in user space. The shared internal primitives close read/subscribe races once, keep cancellation behavior consistent across consumers, and leave durable state authoritative.

Checks

  • node --run lint
  • node --run typecheck
  • node --run test — 132 passing
  • node --run build
  • npm pack --dry-run

@ggoodman

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5546c7b358

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ledger/database-ledger-engine.ts Outdated
Comment thread src/ledger/database-ledger-engine.ts Outdated
Comment thread src/ledger/database-ledger-engine.ts Outdated
@ggoodman

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ac3e39dcf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ledger/database-ledger-engine.ts
@ggoodman

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 2b00f64fff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ggoodman
ggoodman merged commit d797902 into main Jul 27, 2026
1 check passed
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