Skip to content

fix(llm): preserve pre-aborted signals in local provider health checks (#2110) - #2590

Open
turkonthelurk wants to merge 3 commits into
tetsuo-ai:mainfrom
turkonthelurk:cursor/local-health-preabort-4ce3
Open

turkonthelurk wants to merge 3 commits into
tetsuo-ai:mainfrom
turkonthelurk:cursor/local-health-preabort-4ce3

Conversation

@turkonthelurk

Copy link
Copy Markdown
Contributor

Closes #2110

Draft for review only. Not to be merged by automation; a maintainer decides when and whether it lands. Opened from fork turkonthelurk/agenc-core. Nothing pushed to main on either repo. Based on upstream main only. Independent of #2109 and #2112.

Problem

The shared local-provider health wrapper listened for later aborts but never checked a signal that was already aborted. AbortSignal does not replay an earlier abort to a later listener, so Ollama/LM Studio operations could begin and complete after cancellation when the signal was aborted before entry.

Verified still present on upstream main at 6a2a92d before changing anything.

Change

runLocalProviderHealthSidecar now:

  • attaches the upstream listener first
  • honors params.signal.aborted
  • aborts the derived controller with params.signal.reason
  • rejects with that reason before the health timer or provider operation starts
  • keeps existing in-flight abort, consecutive health-failure, and cleanup behavior

Tests

Hermetic tests/llm/providers/shared/local-health.test.ts: 11/11 passed (red-green: pre-abort and setup-race cases failed on main wrapper). Related Ollama/LM Studio provider tests: 38/38 passed.

This does not merge.

Opened from fork turkonthelurk/agenc-core. Companion fork PR (to close): turkonthelurk#29

AbortSignal does not replay an earlier abort to a later listener, so the
shared Ollama/LM Studio health wrapper could start provider work after
the caller had already cancelled. Check the caller signal before starting
the timer or operation, abort the derived controller with the same
reason, and keep listener cleanup for later aborts.

Co-authored-by: turk <turkonthelurk@users.noreply.github.com>
cursoragent and others added 2 commits September 18, 2026 10:20
Parameterize pre-abort and setup-race coverage through one helper so
SonarCloud new-code duplication stays under the quality gate.

Co-authored-by: turk <turkonthelurk@users.noreply.github.com>
Share the in-flight and live-signal assertions through one helper and
stop cloning the token-accounting abort-reason construction so Sonar
new-code duplication stays under the quality gate.

Co-authored-by: turk <turkonthelurk@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

@turkonthelurk
turkonthelurk marked this pull request as ready for review September 18, 2026 10:48

This branch has not been deployed

No deployments
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.

fix(llm): preserve pre-aborted signals in local provider health checks

2 participants