Skip to content

[Bug]: GitHub Connector discovery cache ignores commit SHA, causing UI to permanently show stale repository structure #1871

@joelstucki-taulia

Description

@joelstucki-taulia

Describe the bug
The GitHub connector discovery process aggressively caches repository structure based only on the branch name and ref, ignoring the commit SHA (sourceRevisionRef). This causes the discovery UI to become permanently stuck showing an old version of the repository if the user restructures their plugin/marketplace folders or fixes a manifest error.

Even when GitHub successfully delivers push webhooks and the backend logs show a successful sync cycle, the UI will continue returning the original cached structure.

To Reproduce

  1. Connect a GitHub repository as a plugin hub.
  2. Open the discovery UI (it fetches and caches the initial state).
  3. Push a commit that significantly changes the folder structure (e.g., adding .claude-plugin/marketplace.json and moving a skill into a subfolder).
  4. Return to the discovery UI. It will still show the old structure and likely report "0 imported objects" because the old paths no longer exist in the actual repo.
  5. Deleting the connector instance and re-adding it is the only way to clear the cache via the UI.

Expected behavior
The discovery cache should be invalidated if the sourceRevisionRef (commit SHA) from the webhook or live fetch does not match the cached sourceRevisionRef.

Root Cause Analysis
In ee/apps/den-api/src/routes/org/plugin-system/store.ts, the resolveGithubConnectorDiscovery function checks the cache:

  if (cached
    && cached.branch === discoveryContext.branch
    && cached.ref === discoveryContext.ref
    && cached.repositoryFullName === discoveryContext.repositoryFullName) {
    return { ... }
  }

It is missing a check against discoveryContext.headSha (or similar) vs cached.sourceRevisionRef. It assumes that if the branch name is the same, the content hasn't changed.

Workaround
Currently, users must either:

  1. Delete and recreate the entire GitHub integration in the Den UI.
  2. Manually clear the githubDiscoveryCache JSON key from the connector_target table in the database.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions