Repository navigation
Conversation
Refs linuxfoundation/lfx-cdp-insights-ops#1156 Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Refs linuxfoundation/lfx-cdp-insights-ops#1156 Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Refs linuxfoundation/lfx-cdp-insights-ops#1156 Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
…quest Refs linuxfoundation/lfx-cdp-insights-ops#1156 Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
…first The retry time counts from the failed mint and is never shorter than the delay. A parked or budget-exhausted entry still decides the wait, as before this change. Refs linuxfoundation/lfx-cdp-insights-ops#1156 Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
|
|
PR SummaryMedium Risk Overview Run-cap admission treats Temporal workflows in Orphan deferral is guarded: New Reviewed by Cursor Bugbot for commit 320e0f6. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
@mbani01 I'm starting review 1 of this pull request now (started 2026-11-26 17:07 UTC using review agent v0.1.34). This usually takes a few minutes. I'll update this comment with the summary when I'm done. If there's no summary here after about 45 minutes, the review stopped: push a new commit, or post a comment that begins with a mention of me followed by Hi @mbani01, thanks for the clear write-up and the thorough tests. SummaryThis pull request makes a transient token-mint failure park the unit with a retry time instead of counting as an auth failure. It also treats a paused sync workflow as a live run and stops a late deferral from overwriting a finished run's schedule. The change is small and well tested. Decision✅ Approved DetailsOverall impression: The three changes are scoped tightly to the connectors framework and follow the repo's conventions. Other reviewers and CI checks: Cursor Bugbot and Greptile found no issues. The required Documentation reminder: changed Rule files: read Questions, problems, or feedback: https://github.com/linuxfoundation/lfx-review-agent/issues |
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryThis PR hardens token acquisition and capped connector runs.
Acknowledged limits from
|
lfx-one
left a comment
There was a problem hiding this comment.
No blocking, security or privacy findings. The token pool, run cap and guarded deferral changes read correctly and the new tests cover each path.
Documentation
This pull request changes behavior that may also be described outside this repository, such as product pages or an external docs site. I can't read those, so please check them; the author and maintainers own those updates. Changed here:
token pool acquire after a transient mint failure(now throws a rate-limit error with a retry time instead of a token pool empty auth error)paused sync run workflow(now counts as a live run for run caps)
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the connector retry and concurrency changes.
No open issues 🎉
What changed in this PR
Hardens the shared connector framework for single-token platforms with a one-run limit, ahead of Sessionize’s planned use of this configuration.
Changes:
- Parks transient token-mint failures with a retry deadline instead of treating them as authentication failures.
- Counts paused workflows as live runs when enforcing concurrency limits.
- Preserves deadlines recorded by completed runs during dispatcher deferral, with regression tests for all three changes.
| File | Description |
|---|---|
services/libs/data-access-layer/src/connectors/syncUnits.ts |
Restricts rescheduling to units that remain locked. |
services/libs/data-access-layer/src/connectors/syncUnits.test.ts |
Tests deferral before and after a run completes. |
services/libs/connectors/src/pool/tokenPool.ts |
Adds retry deadlines for transient mint failures while preserving existing wait-time precedence. |
services/libs/connectors/src/pool/tokenPool.test.ts |
Covers pool failure states, fallback entries, and HTTP retry boundaries. |
services/apps/connectors_worker/src/activities/dispatcherActivities.ts |
Treats PAUSED workflows as live for run-cap accounting. |
services/apps/connectors_worker/src/activities/dispatcherActivities.test.ts |
Extends live-run admission coverage to paused workflows. |
Review effort: Balanced
What this fixes
Three weaknesses in the shared connectors framework. They start to matter when a connector runs with a one-entry token pool and
maxConcurrentRuns: 1, which the Sessionize connector will do. No connector behaviour changes in the normal case.1. A temporary sign-in failure no longer looks like a broken credential
When a pool entry has no cached token and minting one fails for a temporary reason (
provider.unavailableorprovider.rate_limit),acquireused to end withProviderAuthError('token pool empty'). That class dead-letters a unit after 5 failed runs, so a provider login outage of about 15 minutes stopped healthy units until someone restarted them.Now such a failure gives a retry time: the provider's own resume time, and never less than 5 minutes after the failed mint.
acquirethrows aRateLimitErrorwith that time, so the unit is parked and runs again by itself. The HTTP client does not retry this error, so a failed mint is tried once per run.provider.auth,provider.contract) still quarantines the entry, as before. Any other error class keeps the old outcome.token pool has no usable token, waiting to retry a failed mint, and does not carry the mint error.2. A paused run counts as a live run
For a platform with a run cap, the dispatcher asks Temporal whether a lease-lapsed unit still has a run. Only the status
RUNNINGcounted. A workflow that an operator paused was treated as having no run, so a second run could start for the same unit.PAUSEDnow counts as live.3. Releasing an orphaned unit cannot overwrite what a finished run recorded
A long run could end in the few seconds between the dispatcher's claim and its deferral write. The deferral then replaced the next run time the run had just saved, which cost one extra run.
rescheduleUnitnow updates the unit only while it is still locked ("lockedAt" IS NOT NULL). Every end-of-run write clears the lock, so a unit whose run has ended is left alone. The lookup is by primary key; no index or schema change.Effect on existing connectors
Known limits, not fixed here
rescheduleUnitreturns nothing, so a caller can log a deferral that the new guard skipped.Tests
New
tokenPool.test.ts(the pool had no tests): a table of pool states, plus one test with the real HTTP client that proves a failed mint is called once per request.dispatcherActivities.test.tscoversPAUSED.syncUnits.test.tshas a database test for the guarded deferral. 1,019 connector and worker tests and 62 data-access connector tests pass.Notes for review
services/libs/data-access-layer/src/connectors/syncUnits.tsneeds a code owner.rescheduleUnithas one comment line for the lock invariant, under the "non-obvious invariant" rule inAGENTS.md.Refs linuxfoundation/lfx-cdp-insights-ops#1156