Skip to content

fix(selectors): close residual cancellation gaps - #7358

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/selector-cancellation-gaps
Sep 1, 2026
Merged

fix(selectors): close residual cancellation gaps#7358
waleedlatif1 merged 2 commits into
stagingfrom
fix/selector-cancellation-gaps

Conversation

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor

Summary

  • pass the selector AbortSignal into the existing signal-aware OpenRouter embedding catalog fetch
  • make each selector OAuth credential waiter abortable without attaching a caller signal to shared refresh or mint work
  • reject late provider results before selector sanitization and success presentation

Intentional behavior

Shared local and Redis refresh coordination, token caches, credential-row updates, and refresh or mint producers remain unchanged. If one or every selector waiter disconnects, shared work may finish and persist refreshed credentials for other workflows, webhooks, or future requests.

This is a resource-efficiency change only. It does not alter authorization, selector response contracts, protected-value handling, workflow configuration, or credential storage semantics.

Test plan

  • 9 focused Vitest files: 76 tests passed
  • bun run --cwd apps/sim type-check
  • bun run --cwd apps/sim lint:check
  • bun run check:api-validation

@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 1, 2026 6:43pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR consistently propagates selector cancellation through OpenRouter catalog fetching and shared OAuth credential waiters, while preserving shared refresh and mint work. It also prevents provider results completed after cancellation from being sanitized, logged as successful, or returned.

  • Adds request-local abort handling around shared credential token and bundle resolution.
  • Threads selector signals into authorized credentials and OpenRouter catalog requests.
  • Rejects late provider results before sanitization and success presentation.
  • Adds focused cancellation and shared-work tests.

Confidence Score: 5/5

The PR appears safe to merge, with cancellation propagated through the affected selector paths without canceling shared credential work.

The updated waiters reject canceled callers before request-local credential bookkeeping, affected providers receive the request signal before external work, and late provider results are discarded before sanitization or successful presentation.

Important Files Changed

Filename Overview
apps/sim/lib/selectors/application/execute-selector.ts Propagates the request signal into credential resolution and rejects provider results that arrive after cancellation.
apps/sim/lib/selectors/server/credentials.ts Adds an abortable request-local waiter around shared OAuth credential work without canceling the shared producer.
apps/sim/lib/selectors/server/providers/credential-bundle.ts Applies the same abortable-wait behavior to credential bundle resolution while preserving cancellation errors.
apps/sim/lib/selectors/server/internal.ts Passes the selector signal into the signal-aware OpenRouter embedding catalog fetch.
apps/sim/lib/selectors/server/types.ts Extends authorized selector credentials with the request-local cancellation signal consumed by credential helpers.

Sequence Diagram

sequenceDiagram
  participant R as Selector request
  participant E as Selector executor
  participant W as Credential waiter
  participant S as Shared credential work
  participant P as Provider
  R->>E: Execute with AbortSignal
  E->>W: Resolve credential with signal
  W->>S: Start or join shared resolution
  alt Request aborts while waiting
    R-->>W: Abort
    W-->>E: Reject waiter with abort reason
    Note over S: Shared work continues independently
  else Credential resolves
    S-->>W: Token or bundle
    W-->>E: Credential result
    E->>P: Execute with signal
    P-->>E: Provider result
    E->>E: throwIfAborted()
    E-->>R: Sanitized result
  end
Loading

Reviews (1): Last reviewed commit: "fix(selectors): close residual cancellat..." | Re-trigger Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 9 files

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/selectors/server/credentials.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 9 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 69d7266 into staging Sep 1, 2026
26 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/selector-cancellation-gaps branch September 1, 2026 18:56
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.

2 participants