[Fix] API shutdown can hang before Fast answers start - #1958
Merged
roomote-roomote[bot] merged 2 commits intoAug 31, 2026
Conversation
Contributor
Contributor
Author
daniel-lxs
approved these changes
Aug 31, 2026
roomote-roomote
Bot
requested review from
brunobergher and
mrubens
as code owners
August 31, 2026 22:55
roomote-roomote
Bot
deleted the
fix/fast-shutdown-lock-wait-341sa68px8bq3
branch
August 31, 2026 22:56
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.
What changed
Why this change was made
This is a standalone follow-up to the review finding on PR #1950, based on the latest
developbranch. A SIGTERM arriving while pre-answer setup was stalled could leaveabortForShutdownwaiting indefinitely and prevent the API's graceful shutdown from completing.Impact
API shutdown no longer depends on pre-answer or answer-service setup reaching cancellation-aware inference. Active inference still receives the existing opportunity to post and persist its interruption closeout before its Redis turn lock is released. PR #1950 is not modified by this change.
Validation
pnpm exec dotenvx run -f .env.test -- pnpm --filter @roomote/cloud-agents exec vitest run src/server/fast-agent/__tests__/fast-agent-turn-lock.test.ts src/server/fast-agent/__tests__/fast-agent-service.test.ts(107 tests passed)pnpm --filter @roomote/cloud-agents check-typespnpm --filter @roomote/cloud-agents format:checkpnpm exec oxlint --deny-warnings packages/cloud-agents/src/server/fast-agent/fast-agent-turn-lock.ts packages/cloud-agents/src/server/fast-agent/fast-agent-service.ts packages/cloud-agents/src/server/fast-agent/__tests__/fast-agent-turn-lock.test.ts packages/cloud-agents/src/server/fast-agent/__tests__/fast-agent-service.test.tscheck-types:fast, and knip