Skip to content

[Fix] Background service failures can surface as unhandled rejections - #1352

Merged
edelauna merged 2 commits into
mainfrom
fix/service-background-promises-0w723cyfrtfqr
Aug 23, 2026
Merged

[Fix] Background service failures can surface as unhandled rejections#1352
edelauna merged 2 commits into
mainfrom
fix/service-background-promises-0w723cyfrtfqr

Conversation

@zoomote

@zoomote zoomote Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

​Created by Roomote. Follow up by mentioning @roomote, in the web UI, or in Discord.

What changed

  • Expanded the type-aware @typescript-eslint/no-floating-promises ratchet to services/**/*.ts and resolved all six existing findings.
  • Added explicit failure handling for detached code-index startup and MCP settings watcher initialization.
  • Replaced scanner cleanup finally() chains with success/failure cleanup handlers that cannot create an unobserved rejected promise.
  • Replaced test-only Promise scheduling with queueMicrotask and added focused startup-rejection and threshold-batch cleanup coverage.

Why this change was made

Long-running indexing and MCP watcher setup are intentionally started in the background, but their rejected promises were not owned by a terminal handler. Scanner cleanup also discarded the promise returned by finally(), which can reject whenever its source rejects.

Impact

Background service failures are now logged instead of surfacing as unhandled rejections, batch cleanup still runs on success and failure, and future floating promises in services/** fail lint. Background execution timing remains unchanged.

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@edelauna
edelauna marked this pull request as ready for review August 23, 2026 04:06
@zoomote

zoomote Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both lines from Codecov’s initial report with a threshold-one scanner test that executes the in-loop batch cleanup path. Local coverage confirms the reported lines are now exercised; the full lint, type-check, and test suites pass.

Pushed in commit b1bfc2d55. Codecov will refresh from the updated branch.

@edelauna
edelauna enabled auto-merge August 23, 2026 04:21
@edelauna
edelauna added this pull request to the merge queue Aug 23, 2026
@github-actions github-actions Bot added the awaiting-review PR changes are ready and waiting for maintainer re-review label Aug 23, 2026
Merged via the queue into main with commit 78c712a Aug 23, 2026
15 checks passed
@edelauna
edelauna deleted the fix/service-background-promises-0w723cyfrtfqr branch August 23, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR changes are ready and waiting for maintainer re-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants