Skip to content

fix(host-daemon): retry provider probes after invalidation - #2381

Merged
ymichael merged 1 commit into
mainfrom
fix/provider-probe-invalidation-race
Aug 25, 2026
Merged

ymichael merged 1 commit into
mainfrom
fix/provider-probe-invalidation-race

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

What was wrong

A shell-environment refresh could clear the provider-installation gate and shut down its maintenance runtime while real thread starts were awaiting a shared provider status probe. The gate correctly avoided caching the stale result, but it still returned the interrupted promise to existing callers, so every concurrent thread.start sharing that probe became a permanent error thread. See #2380 and the investigation thread.

What changed

The provider-installation gate now treats a generation change as an instruction to join or start the probe for the current generation. This applies to both stale successful answers and rejected maintenance RPCs, while stable provider errors and unsupported-version results retain their existing behavior. Added focused gate coverage plus a command-dispatch regression with two concurrent thread starts interrupted by replaceBaseShellEnv.

There are no host/server wire changes, so HOST_DAEMON_PROTOCOL_VERSION is unchanged.

How you verified

  • Added a deterministic concurrent-start regression that rejected with Runtime shutting down before the fix and passes after it.
  • pnpm exec turbo run test --filter=@bb/host-daemon -- --run src/provider-installation-gate.test.ts src/command-dispatch.test.ts — 52 passed.
  • pnpm exec turbo run test --filter=@bb/host-daemon --force — 557 passed.
  • pnpm exec turbo run typecheck --filter=@bb/host-daemon — passed.
  • pnpm exec turbo run build --filter=@bb/host-daemon — passed.
  • Formatting and git diff --check — passed.

Fixes #2380

AGENT GENERATED

@ymichael
ymichael merged commit 787eb14 into main Aug 25, 2026
15 checks passed
@ymichael
ymichael deleted the fix/provider-probe-invalidation-race branch August 25, 2026 04:33
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.

Shell environment refresh can permanently fail concurrent thread starts

1 participant