Skip to content

fix: retry failed worker initialization - #842

Open
OskarEichler wants to merge 1 commit into
krisk:mainfrom
OskarEichler:codex/retry-worker-initialization
Open

OskarEichler wants to merge 1 commit into
krisk:mainfrom
OskarEichler:codex/retry-worker-initialization

Conversation

@OskarEichler

Copy link
Copy Markdown

Problem

When any shard rejects during FuseWorker initialization, the rejected promise remains cached and the partially initialized workers remain alive. Every later search()/add() call immediately receives that same rejection, even if a fresh worker generation would initialize successfully. Pending initialization calls can also retain their handlers.

Fix

  • Clear the cached initialization promise after that exact attempt fails.
  • Terminate every shard from the failed generation.
  • Reject and clear the remaining pending initialization calls with the same failure.
  • Reuse the cleanup path for explicit terminate().
  • Add a regression in which the first generation fails, is fully terminated, and the next search creates a fresh successful generation.
  • Rebuild the committed worker proxy and declarations.

This changes only initialization-failure recovery; runtime worker replacement remains outside this PR.

Verification

  • Focused worker suite: 19 tests passed.
  • Full suite: 22 files and 450 tests passed.
  • ESLint and TypeScript checks passed.
  • Worker proxy distributions and declarations rebuilt successfully.
  • Changed files pass Prettier and git diff --check.

This branch has not been deployed

No deployments
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