Abort timed-out source sweeps instead of leaving provider work running #16

Open
opened 2026-05-17 12:06:02 +00:00 by MrSphay · 0 comments
Owner

Created from local project scan after reviewing existing issues #1-#13.

Current status:
unSource() in pis/briefing.mjs uses Promise.race() with a 30s timeout, but it does not pass an AbortSignal into source modules or safeFetch(). When a source times out, the sweep moves on while the underlying source work can continue in the background until its own internal fetch timers finish. With many slow providers this can keep sockets, timers, and API work alive after the orchestrator has already marked the source failed.

Code references:

  • pis/briefing.mjs: SOURCE_TIMEOUT_MS and Promise.race() around lines 50-60.
  • pis/utils/fetch.mjs: safeFetch()/safeFetchText() create their own AbortController and do not accept a parent signal.

Acceptance criteria:

unSource() creates a per-source AbortController and passes the signal to source functions that opt in.

  • safeFetch() and safeFetchText() support caller-provided signals, while keeping their own timeout behavior.
  • Timed-out sources abort outstanding fetches and clear timers promptly.
  • Add tests for timeout cancellation and for preserving normal source behavior without a signal.
Created from local project scan after reviewing existing issues #1-#13. Current status: unSource() in pis/briefing.mjs uses Promise.race() with a 30s timeout, but it does not pass an AbortSignal into source modules or safeFetch(). When a source times out, the sweep moves on while the underlying source work can continue in the background until its own internal fetch timers finish. With many slow providers this can keep sockets, timers, and API work alive after the orchestrator has already marked the source failed. Code references: - pis/briefing.mjs: SOURCE_TIMEOUT_MS and Promise.race() around lines 50-60. - pis/utils/fetch.mjs: safeFetch()/safeFetchText() create their own AbortController and do not accept a parent signal. Acceptance criteria: - unSource() creates a per-source AbortController and passes the signal to source functions that opt in. - safeFetch() and safeFetchText() support caller-provided signals, while keeping their own timeout behavior. - Timed-out sources abort outstanding fetches and clear timers promptly. - Add tests for timeout cancellation and for preserving normal source behavior without a signal.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MrSphay/intelligence-terminal#16