Repository navigation
Keep provider usage requests alive across login-shell env refreshes - #6571
Merged
Merged
Conversation
Provider usage refreshes the login-shell env with allowStale, so the refresh can land mid-request. A PATH change shut down the maintenance runtime the request was using, failing it with "Provider is not running". With fnm, every probe mints a new fnm_multishells dir, so this happened on every usage call. Retire a busy maintenance runtime instead: new requests get a fresh runtime, and the old one shuts down once its requests finish. Daemon shutdown still stops it immediately. Shell env comparison now ignores fnm multishell PATH entries. Fixes #6533 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
Since #6219,
providerUsagerefreshes the login-shell env withallowStale: true, so the refresh can land while the usage request is still running. When PATH changed,RuntimeManager.replaceBaseShellEnvshut down the provider maintenance runtime immediately, including one with a request in flight, and that request failed withProvider "codex" is not running. With fnm, PATH changes on every probe (eval "$(fnm env)"mints a newfnm_multishells/<pid>_<ms>dir), so every usage call on that host failed. Fixes #6533.What changed
apps/host-daemon/src/runtime-manager.ts:shutdownAllstill stops every slot right away, busy or retired. This replaces the old pending/generation/active-count fields.shellEnvEqualsignores thefnm_multishells/<id>segment of PATH entries, so per-shell fnm drift no longer counts as an env change for maintenance or environment runtimes (the trigger behind claude-code: new thread's first turn silently killed by idle-runtime eviction on cosmetic shell-env drift (fnm multishells) — stuck on "Working…" forever #1156).No wire changes, so there is no
HOST_DAEMON_PROTOCOL_VERSIONbump.How you verified
runtime-manager.test.ts:shutdownAllstops a retired runtime that still has a request in flight.runtime-manager.tsand pass with the fix.pnpm exec turbo run typecheck test lint --filter=@bb/host-daemon: 839 tests passed.Fixes #6533
🤖 Generated with Claude Code