fix(linear): clear "Syncing" by calling channelSyncCompleted when backfill finishes#212
Merged
Conversation
The Linear connector ran its initial backfill to completion but never called integrations.channelSyncCompleted(), so initial_sync_completed_at stayed NULL forever and the connection showed "Syncing Linear" indefinitely even though every issue had synced. Call it from syncBatch's last-page branch (gated on state.initialSync; the call is idempotent and channel-scoped). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A connected Linear shows "Syncing Linear (Plot)" forever, even though every issue has actually synced. The connector runs its initial backfill (
startBatchSync→syncBatchpaginating issues) to completion, but on the last page it only clears itssync_state_*and never callsintegrations.channelSyncCompleted(). The "Syncing X" spinner is driven purely bytwist_instance_connection.initial_sync_started_at IS NOT NULL AND initial_sync_completed_at IS NULL, so completion is never signalled and the flag never clears.Confirmed in prod: an affected connection had 138 links / 56 threads synced (backfill fully succeeded) yet
initial_sync_completed_atwas NULL. The connector dev checklist explicitly requires "Callintegrations.channelSyncCompleted(channelId)exactly once when the initial backfill finishes" — this was missing.Fix
In
syncBatch's last-page branch (no more pages = backfill done), callthis.tools.integrations.channelSyncCompleted(projectId)before clearing sync state, gated onstate.initialSync. The call is idempotent and channel-scoped (projectIdis the channel id), so it's safe and a no-op for any non-initial run.Affects every Linear user.
pnpm exec tsc --noEmitclean.🤖 Generated with Claude Code