Skip to content

feat(gong): Convert to Checkpoint Connector#8827

Open
justin-tahara wants to merge 1 commit intomainfrom
02-26-feat_gong_convert_to_checkpoint_connector
Open

feat(gong): Convert to Checkpoint Connector#8827
justin-tahara wants to merge 1 commit intomainfrom
02-26-feat_gong_convert_to_checkpoint_connector

Conversation

@justin-tahara
Copy link
Contributor

@justin-tahara justin-tahara commented Feb 26, 2026

Description

How Has This Been Tested?

Additional Options

  • [Optional] Please cherry-pick this PR to the latest release version.
  • [Optional] Override Linear Check

Summary by cubic

Converted the Gong connector to a checkpointed connector with cursor-based pagination and multi-workspace support. Adds reliable resuming, better error handling, and comprehensive tests.

  • New Features

    • Switched to CheckpointedConnector with GongConnectorCheckpoint (cursor, workspace_index).
    • Added load_from_checkpoint and build_dummy_checkpoint; removed legacy polling path.
    • Handles pagination per workspace; resumes via API cursor; skips 404 workspaces.
    • Retries fetching call details with exponential backoff to avoid API race conditions.
    • Applies a 1‑day lookback and honors GONG_CONNECTOR_START_TIME.
    • Emits ConnectorFailure on missing call details when continue_on_fail=True.
    • Respects hide_user_info to anonymize speaker names.
    • Updated tests: daily test uses checkpoint loader; added thorough unit tests for paging, workspaces, retries, and flags.
  • Migration

    • Replace poll_source/load_from_state with load_from_checkpoint in a checkpoint loop (e.g., via connector_runner CheckpointOutputWrapper).
    • No credential changes required; GONG_CONNECTOR_START_TIME continues to be supported.

Written for commit 26a35eb. Summary will update on new commits.

@justin-tahara justin-tahara marked this pull request as ready for review February 26, 2026 22:41
@justin-tahara justin-tahara requested a review from a team as a code owner February 26, 2026 22:41
Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

No issues found across 4 files

Confidence score: 5/5

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

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 26, 2026

Greptile Summary

Successfully converts the Gong connector from the legacy LoadConnector/PollConnector interfaces to the modern CheckpointedConnector pattern. This enables more granular state management and better resumability for large data syncs.

Key improvements:

  • Implements checkpoint-based pagination with GongConnectorCheckpoint tracking cursor position and workspace index
  • Extracts retry logic into dedicated _fetch_call_details_with_retry() method
  • Refactors time range computation into reusable _compute_time_range() helper
  • Adds proper ConnectorFailure support for better error tracking

Minor note:
The batch_size parameter is initialized but never used in the new implementation. The checkpointed architecture processes one API page at a time rather than batching internally. Consider removing this parameter if it's no longer needed, or documenting why it's retained for backward compatibility.

Confidence Score: 5/5

  • This PR is safe to merge with high confidence
  • The checkpoint conversion is well-implemented with comprehensive test coverage. The core logic correctly handles pagination, multi-workspace scenarios, error cases, and state management. All edge cases (404 responses, invalid workspaces, missing call details) are properly tested. The only minor issue is an unused batch_size parameter which doesn't affect functionality.
  • No files require special attention

Important Files Changed

Filename Overview
backend/onyx/connectors/gong/connector.py Converted from LoadConnector/PollConnector to CheckpointedConnector with proper pagination and state management. Refactored retry logic into separate method, added checkpoint model, and improved error handling with ConnectorFailure support.
backend/tests/unit/onyx/connectors/gong/test_gong_checkpointing.py Comprehensive unit tests covering checkpoint serialization, pagination, multi-workspace handling, 404 responses, error handling, and hide_user_info flag. All test scenarios appear well-designed.
backend/tests/daily/connectors/gong/test_gong.py Updated integration test to use new checkpoint-based loading mechanism. Test validates basic functionality with real Gong API credentials.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    Start([load_from_checkpoint called]) --> Init[Initialize from checkpoint<br/>workspace_idx and cursor]
    Init --> LoopStart{workspace_idx less than<br/>workspace count?}
    
    LoopStart -->|No| AllDone[Set has_more=False<br/>Return checkpoint]
    LoopStart -->|Yes| CheckCursor{Has cursor from<br/>checkpoint?}
    
    CheckCursor -->|Yes| AddCursor[Add cursor to request body]
    CheckCursor -->|No| FetchTranscripts[Fetch transcripts for workspace]
    AddCursor --> FetchTranscripts
    
    FetchTranscripts --> Check404{Status 404?}
    Check404 -->|Yes| IncrementWS[Increment workspace_idx<br/>Continue to next workspace]
    IncrementWS --> LoopStart
    
    Check404 -->|No| FetchDetails[Fetch call details with retry]
    FetchDetails --> YieldDocs[Yield documents/failures]
    YieldDocs --> CheckNextCursor{Response has<br/>cursor?}
    
    CheckNextCursor -->|Yes| SaveCursor[Save cursor<br/>Keep same workspace_idx<br/>Set has_more=True]
    CheckNextCursor -->|No| NextWS[Clear cursor<br/>Increment workspace_idx<br/>Set has_more accordingly]
    
    SaveCursor --> Return[Return checkpoint]
    NextWS --> Return
    Return --> End([Checkpoint returned])
    AllDone --> End
Loading

Last reviewed commit: 26a35eb

@github-actions
Copy link
Contributor

🖼️ Visual Regression Report

Project Changed Added Removed Unchanged Report
admin 0 0 0 109 ✅ No changes
exclusive 0 0 0 8 ✅ No changes

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.

1 participant