Configure

Sync

Sync

Bring GitHub issues and pull requests into local SQLite. Idempotent, incremental, and tunable per workflow.

#The default

gitcrawl sync owner/repo

This fetches open issues and pull requests for the repository. To keep local state from rotting, an incremental sync also sweeps recently closed items so that issues and PRs closed between runs are reflected locally.

A sync writes:

  • repositories — repo metadata
  • threads — issues and PRs (titles, bodies, authors, author association, labels, state, timestamps)
  • thread_revisions — immutable revisions with content-addressed canonical evidence payloads when fully hydrated thread or review evidence changes
  • thread_fingerprints — one deterministic thread-fingerprint-v2 row for each persisted revision
  • documents — canonical thread documents (when bodies change)
  • sync_runs — sync run statistics and retry checkpoints

Revision and fingerprint production fails closed on incomplete evidence. Issues require --include-comments; pull requests require both --include-comments and --include-pr-details (or --with pr-details). Without that hydration, sync still updates the thread and document rows but intentionally does not create a revision that could appear complete while omitting discussion, review, file, commit, or check evidence. Pull request revisions also track draft state, review decisions, workflow runs, and check transitions, so those changes invalidate downstream summaries and review evidence even when the title and body are unchanged. Summary prompts read the exact canonical payload bound to the selected revision and skip revisions whose payload is missing or too large.

threads.github_id is the decimal-text REST Issue database ID, including the Issue behind each pull request. GraphQL PR history resolves it through /issues/N with a bounded per-sync cache and the normal REST quota guard; resolution failure prevents that thread from being written. Provider PR and node IDs remain in raw evidence. Revisiting a legacy PR/node ID corrects only the provider identity; the local thread ID and child references remain stable. Cloud identity guards reject such changes until an independently approved archive reconciliation is complete.

#State filters

gitcrawl sync owner/repo --state open    # default
gitcrawl sync owner/repo --state closed  # only closed
gitcrawl sync owner/repo --state all     # full backfill

--state all is the right choice for a one-shot historical backfill on a new repository. After that, the default --state open (with its closed sweep) is enough for ongoing freshness.

#Time-windowed sync

gitcrawl sync owner/repo --since 2026-04-01T00:00:00Z

--since accepts an RFC 3339 timestamp and limits the GitHub query to threads updated after that point. Combine with --state to scope tightly:

gitcrawl sync owner/repo --state all --since 2026-04-01T00:00:00Z

#Pooled REST acquisition

gitcrawl sync owner/repo --octopool --state all --since 2026-04-01T00:00:00Z --include-comments

--octopool sends native REST reads through Octopool's POST /v1/github/request relay. Supply the existing caller session in OCTOPOOL_TOKEN; OCTOPOOL_URL defaults to https://octopool.dev and OCTOPOOL_POOL to maintainers. The command does not read Octopool's saved login file, resolve a GitHub token, run a token command, or fall back to direct GitHub acquisition. Explicit tokens belong to the configured relay endpoint; HTTPS is required except for loopback development servers.

The relay owns provider identity selection, access and quota. This mode supports one public repository per invocation: issue/PR metadata, issue comments, reviews and inline review comments. GraphQL history, --with, --include-pr-details and --github-token-command are rejected before acquisition. Private repositories and unsupported relay routes fail without a native fallback. Full PR revisions remain incomplete without their separately required PR-detail evidence.

Reads request cache-control: max-age=0; stale relay results fail the sync. Complete items survive a partial failure, and a failed traversal cannot advance its qualified checkpoint. Scheduled pooled collectors must explicitly pass --octopool; other invocations retain their existing transport.

After the explicit cutoff bootstrap above succeeds, resume with:

gitcrawl sync owner/repo --octopool --state all --include-comments --incremental --json

--incremental requires that exact transport/state/hydration profile. It rejects --since, --numbers, --limit, GraphQL and PR enrichment. A missing or legacy checkpoint refuses before provider acquisition; it never falls back to a full recrawl or a window relative to the current time. Each resume reads the native sync_runs qualification and requests its through timestamp minus one minute. The single repository metadata GET must still match the checkpoint's immutable GitHub repository ID before any list or hydration request.

A typed octopool_checkpoint in the successful run's statistics records the profile, repository IDs, exact request lower bound, initial coverage_since, and through. Qualification is committed with the run receipt only after complete pagination and all selected comments/reviews hydrate successfully. through is the run's start, not its finish time or the newest returned item. A long run or downtime therefore does not move the next request past unobserved changes. Failed, cancelled, partial, limited, targeted, metadata-only, enrichment and legacy runs cannot bootstrap or advance this checkpoint.

Manual --since behavior remains available. A successful matching-profile run can bootstrap from that explicit cutoff, or advance an existing checkpoint when its request interval overlaps the previous through. A disjoint manual window still succeeds as a manual sync but does not skip the checkpoint's gap. The initial coverage_since stays unchanged. Provider identity changes require a separately qualified native source. Repeating --since against the same store cannot reset or rebind the existing checkpoint; no reset/delete path is supplied.

This records the selected REST acquisition profile since the explicit cutoff, not full history, complete PR-detail evidence, absence of provider deletions, or report-publication authority. The overlap is not a provider snapshot consistency guarantee. No scheduler state, source journal rearm, index build or outbox migration is performed. A timer firing alone is not proof of catch-up.

#Scheduled acquisition

operations/gitcrawl-acquire@.service and .timer are inactive Linux systemd templates for the qualified incremental profile above. They neither install themselves nor bootstrap a checkpoint. Keep the existing collector until the replacement source, scope and recovery path are qualified.

Each instance runs as gitcrawl, with /var/lib/gitcrawl/<instance> as its working directory. Before installation, qualify a readable existing native.sqlite there and the exact matching Octopool checkpoint. The service refuses a missing or empty native file. Configure the root-owned, group-readable /etc/gitcrawl/acquire-<instance>.toml with absolute paths for that database and its cache, vector and log directories inside the instance directory. Confirm that environment overrides do not select a different database or runtime path. Do not configure a portable store or remote publication in this acquisition instance. Preserve the current exclusions and qualify their owner before use.

A root-owned mode-0600 /etc/gitcrawl/acquire-<instance>.env supplies:

  • GITCRAWL_REPOSITORY: one qualified public owner/repo.
  • OCTOPOOL_TOKEN: the existing relay caller session, kept out of argv.
  • OCTOPOOL_URL and OCTOPOOL_POOL, when overriding the documented defaults.

The command always selects --octopool --state all --include-comments --incremental. There is no direct GitHub fallback, historical bootstrap, summary generation or report publication. Missing or incompatible checkpoints fail through the normal sync contract. Do not use a rolling --since window to hide a failed checkpoint. Private repositories and PR-detail enrichment remain outside this relay profile.

The persistent acquire.lock prevents concurrent invocations using the same instance; manual acquisition must take that same lock. Do not assign two instances to one native database, and stop for ownership review if an existing collector can still write it. Delivery uses its separate delivery.lock and native snapshot contract; it may read committed progress while acquisition continues. The timer starts two minutes after boot, then five minutes after the previous run completes, with up to15seconds jitter. Acquisition does not depend on archive availability; the separate delivery timer resumes retained requests.

The template caps acquisition at four minutes, allows30seconds for termination, and limits memory to512MiB and CPU to one core. These are bounded starting settings, not evidence that a source fits: qualify them on the intended host before activation. A timeout can retain completed native writes but cannot advance the qualified checkpoint for an incomplete traversal. Repeated timeouts mean the scope or budget needs review; never reset the checkpoint or silently expand a budget. There is no immediate restart loop.

Validate exact units with systemd-analyze verify --man=no before installation. After separately admitted activation, measure the successful checkpoint's through time and query-visible watermark. Timer firings do not prove freshness.

#Exact rows

gitcrawl sync owner/repo --numbers 123,456 --include-comments
gitcrawl sync owner/repo --numbers https://github.com/owner/repo/issues/123 --with pr-details

--numbers is the safest way to refresh specific issues or PRs — it bypasses list ordering and the updated-time window, fetching exactly the rows you ask for. Pair it with --include-comments and/or --include-pr-details to hydrate the conversation and PR-only data at the same time.

GitHub redirects a transferred issue to its new repository and number. Such a selection fails as an issue fetch, and local threads are left unchanged. The error names the new location and the gitcrawl sync <owner/repo> --numbers <n> command that mirrors it there. Renamed repositories still follow their redirects.

--numbers accepts comma-separated thread references, not just integers: 123, #123, issues/123, pull/123, owner/repo#123, and full GitHub issue or pull request URLs.

Repository-qualified references must match the owner/repo argument (case-insensitively). Mismatched repositories, unsupported URL forms, empty comma-separated entries, and an explicitly empty --numbers value are rejected before synchronization starts. Omit --numbers to select a repository-wide sync. The same rule applies to threads --numbers and to embed or summarize --number: an explicitly empty selection is an error, not an omitted filter.

#Hydration depth

#Batched GraphQL history

gitcrawl sync owner/repo --numbers 123,456 --state all --include-comments --with pr-metadata --graphql-history

This opt-in profile fetches exact selections in GraphQL batches of at most 25 parents. It fully paginates labels, assignees, discussion comments, reviews, review threads and both sources' nested inline comments. Review threads include standalone comments with no review association; comments found through both paths are deduplicated by provider identity while review bodies and metadata remain separate. It then uses the existing per-thread transactions, observation ordering, failure resolution and document persistence. It performs one REST /issues/N identity lookup per PR (cached within the sync) through the same REST quota guard. Issue IDs use GraphQL fullDatabaseId; GraphQL conversation failures never fall back to REST hydration.

The profile requires the flags above; it rejects --since, --limit and full PR-detail hydration. It does not collect files, commit bodies, checks or Actions logs. An incomplete GraphQL response, unavailable parent, missing identity, duplicate child within a connection, mismatched or changing count, or nonadvancing cursor fails the batch before archive writes. Supervisors should retry failed selections in isolation. Empty reviews remain retained, including approvals without bodies. Minimized comments and null (deleted) authors are retained as returned by GitHub; deleted comments that GitHub no longer returns cannot be reconstructed. The ordinary empty-comment filtering contract is unchanged. The authenticated user's own unsubmitted (PENDING) review and its draft inline comments are visible only to that user, so this profile omits them everywhere, including from the retained _graphql object.

Analytics review-state recovery applies the same draft filtering after validating the full review-thread connections. Previously published snapshots and derived artifacts are not retroactively sanitized by this change.

Stored raw maps are explicitly labelled projections: _gitcrawl_source is graphql, and _graphql retains the hydrated provider object. Existing thread local IDs are preserved. Every github_id is the decimal REST Issue ID; legacy PR/node IDs are corrected when their parent observation is accepted. Comments/reviews use exact fullDatabaseId strings; PR metadata uses its PR database ID. Bot logins receive REST-compatible [bot] suffixes in normalized fields while raw actor names remain intact. GraphQL review creation, update and submission timestamps are retained.

GitHub sometimes names the same bot differently between transports: Copilot inline comments can use Copilot in REST and copilot-pull-request-reviewer in GraphQL. This profile keeps the latter as copilot-pull-request-reviewer[bot], consistent with its review bodies, and preserves the original provider actor.

Provider differences remain visible: for example GraphQL can return a null head repository when REST previously named one. No missing value is invented from that earlier observation. Keep a consistent archive backup when migrating transports; this mode does not claim every REST-only field is available through GraphQL or reconstruct uncaptured historical edits.

Each command probes GraphQL's own quota and preserves a 500-point floor. Sanitized graphql budget and graphql cost log records expose request sequence, conservative unanswered-request charge and actual response cost. External multi-process supervisors must additionally preserve a shared point budget across token renewals and restarts. REST request counts are not GraphQL costs. graphql timing <sequence> <milliseconds> records elapsed time for each history request, including failed requests. Supervisors can use the sum across parallel workers to pace work against GitHub's separate compute-time secondary limit. Response time is an estimate, not a measurement of GitHub CPU usage; explicit provider cooldowns always take precedence. Internal retry waits are included in the timing, so consumers should avoid adding another pacing delay after a known provider cooldown.

History reads retry transient HTTP 500/502/503/504 responses, transport timeouts and truncated/empty response bodies up to two times in place. The same query and variables are retained, so a gateway failure does not immediately discard a whole selection and force individual-record retries. Delays are one and two seconds; an explicit longer Retry-After takes precedence, and cancellation stops the wait. Authentication, permission, missing-record and GraphQL semantic errors do not get this additional retry policy. Existing rate-limit handling is unchanged. Exhausted retries still fail acquisition and leave normal isolated recovery available to the supervisor.

Each transient attempt has a separate budget/timing identity. Unanswered attempts retain their conservative charge even if a later quota receipt looks higher. Transient backoff occurs outside the per-attempt timing; the underlying HTTP client's rate-limit retry wait can still be included as described above.

FlagWhat it adds
--include-commentsIssue comments, PR review comments, reviews
--with pr-metadataPR object, including merge attribution, head/base references, and diff counts
--include-pr-detailsPR object, files, commits, status checks, workflow runs, review threads
--with pr-detailsSame as --include-pr-details (gh-style flag)
--forceDownload selected data again, bypassing unchanged issue-comment reuse
--progress-file <absolute-path>Atomically publish sanitized machine-readable activity

pr-metadata writes only pull_request_details, using the normal per-thread observation ordering. It does not fetch, clear, or mark files, commits, checks, workflow runs, or review-thread resolution as fresh. Comments remain independent: add --include-comments when needed. Selecting both hydration modes uses full pr-details hydration. Metadata-only hydration does not create full PR revisions or fingerprints. It resolves PR metadata-fetch failures, not failures of omitted child collections.

The authenticated user's own unsubmitted (PENDING) review and its draft review-thread comments are visible only to that user, and their author can still discard them. REST sync therefore does not archive them; they appear once the review is submitted.

Full PR details also populate pull_request_files, pull_request_commits, pull_request_checks, and github_workflow_runs for local review and search.

With --include-comments, sync reuses issue comments (including the general discussion on PRs) when the freshly fetched parent updated_at matches the last completed comment observation and its comments count matches the exact saved issue-comment membership. Missing or pruned payloads, observations, membership, timestamps or counts, changed timestamps or counts, and unresolved issue-comment failures require a download. Historical comments omitted from the last observation are never reused. Reused comments remain in the archive and revision evidence; they do not count toward comments_synced or progress comments_received. The saved observation is checked again in the item transaction; concurrent replacement requires a retry.

PR reviews, inline review comments, review-thread resolution, and all selected PR details are still fetched on every sync: a parent timestamp or head SHA alone does not prove those collections are unchanged. This preserves check and workflow transitions in fully hydrated revision evidence.

To refresh issue comments that may have changed without moving either parent signal, use gitcrawl sync owner/repo --include-comments --force (or the same flags with refresh). --force bypasses reuse within the selected state, time window, or --numbers; it does not expand that scope or select extra families.

fill-pr-details selects PRs without a metadata row; it does not upgrade existing metadata-only rows. To upgrade them, use gitcrawl sync owner/repo --numbers 123,456 --with pr-details (and --include-comments for full revision evidence).

Review-thread and nested-comment pagination fails if GitHub claims another page but returns an empty or previously followed endCursor. Sync reports a missing endCursor or repeated endCursor error instead of repeatedly fetching the same page. Retry after the GitHub API or proxy returns advancing cursors; the incomplete review-thread response is not saved as complete evidence.

Use gitcrawl coverage [owner/repo] --json to inspect archive completeness after a sync. It reports issue, PR, comment, and review counts alongside hydrated PR detail rows, missing PR details, known failed hydrations, and detail-table row counts per repository. The additive enrichment object exposes supported, eligible, covered, fresh, missing, stale, completeness, ratios, and latest timestamps for revisions, fingerprints, key summaries, clusters, and PR details. Use --repos owner/a,owner/b to compare selected repositories and --min-missing-pr-details N to focus backfill work on repositories with gaps.

gitcrawl sync-failures owner/repo --json lists unresolved issue, comment, and PR hydration failures with their operation, error class and message, timestamps, and retry count. Add --include-resolved to inspect failures cleared by a later successful hydration of that same family. This operational ledger stays local when portable prune runs unless the publisher explicitly passes --include-sync-failures, which retains the ledger only after replacing every error message with a redaction marker.

#Partial failures

Bodyless REST content GETs retry HTTP 502, 503 and 504 responses, with at most three content attempts in total. Default waits are 250 and 500 milliseconds. A valid Retry-After can increase a wait to at most two seconds; an invalid hint, a longer requested wait, or insufficient caller time stops the request. Each attempt rechecks quota and credential guards. Quota probes, non-GET requests, transport/TLS failures and malformed successful responses do not receive this additional retry policy. The existing single rate-limit retry shares the content-attempt ceiling. Only the failed page is retried; an exhausted request remains a sync failure.

Each completed issue or PR commits atomically with its requested children, document, revision, fingerprint, and failure resolutions. A failed item does not roll back completed siblings. Shared-head workflow observations are consolidated before those writes, so sibling ordering cannot replace a newer snapshot. A consolidation failure excludes only its shared-head group, records those items as failed PR-detail hydrations, and preserves unrelated completed items.

An item fetch failure records its actual operation: issue, issue_comments, pull_reviews, pull_review_comments, pull_review_threads, pull_request_metadata, or pull_request_details. A failed issue lookup does not create a thread stub. Failed child fetches can retain the observed parent metadata, but do not replace incomplete child collections or certify complete evidence. Cancellation stops further work; transactions already committed remain. A quota-reserve failure, or a GitHub primary or secondary rate limit that outlasts the client's own wait and retry, also stops new acquisition, including quota probes. Completed payloads can still commit. Skipped requests are not recorded as failures; shared-head groups that still need verification remain uncommitted.

An item transaction failure records each requested operation after rollback, with only an existing parent reference when available. It does not recreate the rolled-back item. A retry resolves only the families it actually persists: metadata-only retries leave comments and full-detail failures unresolved.

An incomplete batch exits nonzero and never records a successful sync or advances the closed-sweep watermark. Before partial writes, archives without a recorded watermark retain their previous retry lower bound as a checkpoint in sync_runs. A new archive uses the default 24-hour lower bound. This checkpoint is not successful list coverage or freshness. Retry the failed numbers with the same hydration flags after resolving the reported cause. Older binaries can read these archives but do not honor the retry checkpoint when writing. Do not downgrade the writer to resume a partially completed sync.

Code hydration is unavailable. --include-code is rejected; remove it from existing invocations.

#Machine-readable progress

Automation may pass an absolute --progress-file path. Gitcrawl atomically replaces that private file as synchronization advances, then leaves the terminal snapshot in place:

{
  "schema": "gitcrawl.sync-progress.v1",
  "repository": "owner/repo",
  "state": "running",
  "stage": "syncing_threads",
  "issues_received": 56,
  "pull_requests_received": 238,
  "comments_received": 350,
  "observed_at": "2026-07-31T04:17:36.000000000Z"
}

state is running, succeeded, or failed; stage is connecting, syncing_threads, or finalizing. Counts describe upstream activity observed by the current process, not rows committed to SQLite. The snapshot never contains credentials, issue content, request URLs, or raw diagnostics.

#Limit and pagination

gitcrawl sync owner/repo --limit 200

--limit caps the number of rows fetched in this invocation. The underlying GitHub paginator surfaces total page counts in run records and honors GitHub's Retry-After and rate-limit response headers, so partial syncs interrupted by rate limiting resume cleanly. A secondary rate limit with no Retry-After and quota still remaining waits one minute, as GitHub documents, before its single retry.

REST pagination stops with an error if a next link returns to an already fetched page. This prevents repeated requests and avoids treating a cyclic response as a complete page collection. Retry when GitHub or the proxy returns advancing links.

#JSON output

The result reports processed thread and hydration counts, not separate insert and update counts. For a compact view:

gitcrawl sync owner/repo --json \
  | jq '{repository, threads_synced, issues_synced, pull_requests_synced, comments_synced, metadata_only, started_at, finished_at}'
{
  "repository": "owner/repo",
  "threads_synced": 124,
  "issues_synced": 100,
  "pull_requests_synced": 24,
  "comments_synced": 0,
  "metadata_only": true,
  "started_at": "2026-05-05T07:30:11Z",
  "finished_at": "2026-05-05T07:30:43Z"
}

The full result also includes PR-detail and enrichment counters, closure and stale-observation counts, the requested scope when present, and the database write destination. Use gitcrawl runs owner/repo --kind sync --json for recorded run IDs.

After partial persistence, sync --json still emits committed counts, but exits nonzero and leaves progress marked failed. fill-pr-details --json likewise reports committed filled and remaining selected items, including a partially completed batch. A quota stop exits nonzero with stopped_reason: "rate-limit-reserve"; other sync failures use "sync-failed". The partial batch and final result retain the stopping request's quota snapshot without a subsequent credential or quota lookup. Automation must check the exit status, not treat a JSON result as success.

#Common workflows

#First-time setup for a repo

gitcrawl sync owner/repo --state all --include-comments
gitcrawl embed owner/repo
gitcrawl cluster owner/repo

Or in one step:

gitcrawl refresh owner/repo --include-comments

#Periodic incremental refresh

gitcrawl sync owner/repo

The closed sweep keeps the open list honest without paying for a full backfill.

#Pull a specific issue + comments + PR detail

gitcrawl sync owner/repo --numbers 123 --include-comments --with pr-details
NUMS=$(gitcrawl search issues "manifest cache" -R owner/repo --json number --limit 20 \
        | jq -r '[.[].number] | join(",")')
gitcrawl sync owner/repo --numbers "$NUMS" --with pr-details

#Required credentials

sync requires a GitHub token. gitcrawl resolves it from GITHUB_TOKEN, the [env] table in config.toml, or from gh auth token if the real gh CLI is installed and authenticated. gitcrawl doctor reports the source.

#See also

#Analytics source preparation

The analytics source command repairs retained review publication timestamps without rewriting raw evidence and maintains a full-history archive through incremental GraphQL collection. Its actor IDs and coverage receipts are source evidence for downstream analytics; account classifications remain derived.