← Back to Pull requests

feat(zendesk): article and ticket access for permission sync #18701

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 27, 2026 23:43 UTC
Author

Description

Second PR for Zendesk permission sync, on top of #18699. It adds who may read each article and ticket, sets that access when indexing with permissions and in the perm-sync slim walk, and adds the doc-sync capability checks. The sync is not registered yet; the next PR adds group sync and the registration.

Articles (ee/onyx/external_permissions/zendesk/access.py)

  • No user segment: all signed-in users (<subdomain>:all_users). Public only when Zendesk serves the article to a request without credentials, checked once per run (is_article_public; a redirect or a non-article answer is not public).

  • With segments: <subdomain>:segment:<id> for each, plus <subdomain>:guide_managers.
  • Tickets

  • Admins and agents whose role reads all tickets (private groups too, checked live).

  • The ticket's group (group:<id>), agents whose role adds every public group (public_groups), and agents restricted to the ticket's organization (org_agents:<id>).

  • The assignee, followers, CCs and requester, by email (from the export's include=users sideload, so no extra lookups).

  • End users (requester, CCs, members of an organization that shares tickets) only with the new grant_end_users connector option, and only for tickets without an internal note. The option is off by default: finding internal notes reads every such ticket's comments on each sync, since the ticket events export leaves out some private comments. The form warns that it slows syncing a lot. A user with no known role counts as an end user, and a ticket whose comments return 404 counts as having an internal note.
  • Connector

  • CheckpointedConnectorWithPermSync: indexing with permissions reuses the comments it already reads.

  • retrieve_all_slim_docs (pruning) reads no access; retrieve_all_slim_docs_perm_sync sets it.

  • Both slim walks now skip what indexing skips (drafts, articles without a body or with a skip label, deleted tickets), so pruning removes them. A stop signal raises instead of ending the listing early.

  • Fix: tickets read the submitter from submitter, but the field is submitter_id, so tickets never had an owner.
  • Checks (DOC_PERMISSION_SYNC): zendesk_perm_sync_admin (the token's user is an admin), zendesk_article_access, zendesk_ticket_access (users' emails and comments are readable).

    How Has This Been Tested?

  • Unit: access rules, comment reads only when end users would be granted, the default (no comment reads), skipped items, missing comments, unknown roles, the anonymous probe. The unknown-role and skip tests fail without their fixes.

  • Live, against onyx_ps_ fixtures on the CI Zendesk account: indexing and the perm-sync slim walk give the same access for every document, and it matches what each fixture user can open in Zendesk (requester, CC, org peer, follower, private-group member, assignee, restricted segments).

  • tests/daily/connectors/zendesk, the source-operation coverage and import fence tests, and the web connector tests pass.
  • Docs

  • Customer-facing change: I updated documentation/ for the page's reader and task, at the level of detail of the whole page.

  • No docs change needed: the existing docs stay correct (internal, tests, CI, multi-tenant cloud only, or the UI explains it).
  • Permission sync is not registered until the next PR, which updates the Zendesk docs page.

    Additional Options

  • [Optional] Please cherry-pick this PR to the latest release version.
  • 🤖 Generated with Claude Code

    <!-- This is an auto-generated description by cubic. -->
    ---

    Summary by cubic


    Adds who may read each Zendesk article and ticket, sets that access when indexing with permission sync and in the permission-sync slim walk, and adds the permission-sync capability checks. Fixes tickets never having an owner because the submitter was read from submitter instead of submitter_id.

  • Articles go to their user segments, plus Guide managers; articles without segments go to all signed-in users unless Zendesk serves them without sign-in, probed once per run with netrc credentials suppressed (proxy and CA settings preserved).

  • Tickets go to admins, agents by their role's ticket access, the ticket's group, organization-scoped agents, and the requester, assignee, followers, and CCs by email; tickets without a group also go to public-group agents.

  • End users get tickets free of internal notes only when the new grant_end_users connector option (off by default) is on, since finding internal notes reads every such ticket's comments and slows syncing a lot.

  • Both slim walks skip what indexing skips, so pruning removes them; a stop signal raises on every item and before the last batch, with progress reported per ticket, instead of ending the listing early.

  • The ticket access check probes a live ticket's comments and only warns when the sampled users have no email.

  • The sync is not registered yet; the next PR adds group sync and registration.
  • <sup>Written for commit fb7bd9ac4977946768343e783fe587b7eff82c81. Summary will update on new commits.</sup>

    <a href="https://cubic.dev/pr/onyx-dot-app/onyx/pull/18701?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/onyx-dot-app/onyx/18701?returnTo=https%3A%2F%2Fgithub.com%2Fonyx-dot-app%2Fonyx%2Fpull%2F18701&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>

    <!-- End of auto-generated description by cubic. -->

    <!-- Macroscope's pull request summary starts here -->
    <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. -->
    <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. -->

    [!NOTE]

    ### Add Zendesk article and ticket external access for permission sync

    - Adds EE permission-sync for Zendesk: article access derives from Help Center visibility and user segments, ticket access from admin/all-ticket groups, ticket groups, organizations, and named users (see access.py)

    - Connector separates permission-sync from normal indexing paths; ticket pages request users/groups/organizations sideloads only for permission sync (connector.py)

    - New capability checks require an admin user and probe article/ticket reads (capability_checks.py)

    - New opt-in grant_end_users config (default false) grants end-user ticket access but requires reading ticket comments; shown in the ticket connector UI with localized labels in 10 languages

    - Behavioral Changes: tickets with an internal note (or a 404 comment read, or a missing/false public comment flag) exclude end-user and organization access; submitter lookup now uses submitter_id; a stop signal during slim listing now raises RuntimeError instead of returning partial results; end users are not granted access by default

    > <!-- Macroscope's review summary starts here -->

    > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized fb7bd9a.</sup>

    <!-- Macroscope's review summary ends here -->

    <!-- Macroscope's pull request summary ends here -->

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Zendesk ticket connectors can grant eligible end users, including requesters and CCs, access to tickets without internal notes. This option is available for ticket sources and is off by default; enabling it may increase sync time.
    Permission syncing reflects Zendesk article visibility, ticket groups, organizations, and user roles.
    Bug Fixes
    Ticket listings exclude deleted tickets, and article listings omit drafts, skipped articles, and articles without a body.
    Stop requests no longer return partial listings.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: evan-onyx Review duration: 4057m
    All Vouch review confidence checks passed
    Residual risk 0.43 = Change Risk (0.75) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.75 · 650 lines diff across 8 files
    0.75
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.075
    Real PR Conversation Timeline
    1 comments
    "Review active on #18701"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 43.0% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 75.2% (HIGH) · Higher = larger blast radius
    75.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 43.0% · Lower = rushed or shallow review
    43.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 42.9% · Moderate risk
    42.9%