Skip to content

fix(tech-insights): pass the scheduler abort signal to fact retrievers - #12025

Open
mevan-karu wants to merge 1 commit into
backstage:mainfrom
mevan-karu:tech-insights-retriever-abort-signal
Open

mevan-karu wants to merge 1 commit into
backstage:mainfrom
mevan-karu:tech-insights-retriever-abort-signal

Conversation

@mevan-karu

Copy link
Copy Markdown

Hey, I just made a Pull Request!

The tech-insights backend schedules each fact retriever with the SchedulerService, but the function it registers ignores the scheduler's abort signal. The scheduler contract says a task function "may optionally accept an abort signal argument. When the signal triggers, processing should abort and return as quickly as possible." When a run exceeds its timeout, the task is released so a new invocation can start, possibly on a different worker. Since retrievers never see the signal, a slow retriever keeps running after its timeout while another replica may already be running the same retriever.

FactRetrieverContext in tech-insights-node gets an optional signal?: AbortSignal, and the backend now passes the scheduler's signal through to factRetriever.handler. It aborts when the run times out or the backend shuts down. Existing retrievers keep working unchanged, and ones that want to stop early can pass the signal to their requests or check it between steps. The backend README mentions the new field in the section on writing retrievers.

Storage on abort is deliberately left alone. Facts a retriever returns after the signal fires are still inserted as before, because skipping insertFacts would quietly change behaviour for every existing retriever. That can be its own discussion if people want it.

Tests cover the real scheduler handing the handler a signal, and a stubbed scheduler showing the handler gets the exact signal and sees it abort.

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

Retrievers can now stop when a run times out or the backend shuts down.

Signed-off-by: Mevan <mevan.karu@gmail.com>
@mevan-karu
mevan-karu requested review from a team, Xantier, kurtaking and punkle as code owners November 12, 2026 08:49
@backstage-service backstage-service added the workspace/tech-insights Used to tag tech-insights workspace issues and pull requests label Nov 12, 2026
@backstage-goalie

Copy link
Copy Markdown
Contributor

Important

This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage-community/plugin-tech-insights-backend workspaces/tech-insights/plugins/tech-insights-backend patch v3.1.0
@backstage-community/plugin-tech-insights-node workspaces/tech-insights/plugins/tech-insights-node minor v2.9.0

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

workspace/tech-insights Used to tag tech-insights workspace issues and pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants