Skip to content

bug(core): AbortSignal is ignored when source resolution has no timeout #376

Description

@vamgan

Summary

Abort cancellation for asynchronous context-source resolution is ignored unless timeoutMs is also provided.

Root cause

packages/core/src/context.ts, runSourceTask(), returns the source promise immediately when timeoutMs === undefined. The AbortSignal listener is only installed in the timeout branch.

A pending source resolved with { signal } but no timeout therefore remains pending after the caller aborts.

Proposed fix

Race against abort whenever a signal is supplied, independently of timeout handling. Remove abort listeners on every success/failure/timeout path.

Acceptance criteria

  • Aborting a pending source without a timeout rejects promptly
  • Abort with a timeout still works
  • Already-aborted signals remain rejected immediately
  • Successful and failed tasks remove signal listeners
  • No timer is created when no timeout is configured

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreCore package and cross-package runtime behaviorbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions