Skip to content

[Fix] API shutdown can hang before Fast answers start - #1958

Merged
roomote-roomote[bot] merged 2 commits into
developfrom
fix/fast-shutdown-lock-wait-341sa68px8bq3
Aug 31, 2026
Merged

[Fix] API shutdown can hang before Fast answers start#1958
roomote-roomote[bot] merged 2 commits into
developfrom
fix/fast-shutdown-lock-wait-341sa68px8bq3

Conversation

@roomote-roomote

@roomote-roomote roomote-roomote Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

​Opened on behalf of @daniel-lxs. Follow up by mentioning @roomote-roomote, in the web UI, or in Slack.

What changed

  • Mark Fast shutdown closeout delivery as pending only when inference enters its cancellation-aware retry path.
  • Release locks that are still in provider history, attachment, or session setup without waiting for a closeout resolver that cannot run.
  • Preserve the existing graceful wait for answers that are active, and preserve rejection of lock acquisitions racing with process shutdown.

Why this change was made

This is a standalone follow-up to the review finding on PR #1950, based on the latest develop branch. A SIGTERM arriving while pre-answer setup was stalled could leave abortForShutdown waiting 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-types
  • pnpm --filter @roomote/cloud-agents format:check
  • pnpm 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.ts
  • Pre-push checks: oxlint, residual lint, check-types:fast, and knip

@roomote-community

roomote-community Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

No code issues found. See task

  • packages/cloud-agents/src/server/fast-agent/fast-agent-service.ts:872 Shutdown can still wait on uninterruptible answer-service setup.

Reviewed 8540d49

Comment thread packages/cloud-agents/src/server/fast-agent/fast-agent-service.ts Outdated
@roomote-roomote

roomote-roomote Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the outstanding shutdown setup finding in 8540d49: closeout waiting now begins only inside cancellation-aware inference, and focused coverage exercises SIGTERM while session setup is stalled. See task.

@roomote-roomote
roomote-roomote Bot marked this pull request as ready for review August 31, 2026 22:55
@roomote-roomote
roomote-roomote Bot merged commit d385517 into develop Aug 31, 2026
17 checks passed
@roomote-roomote
roomote-roomote Bot deleted the fix/fast-shutdown-lock-wait-341sa68px8bq3 branch August 31, 2026 22:56
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