Skip to content

feat(ingest): shared connector builder + opt-in in-process sync scheduler (#428) - #435

Merged
CheeryProgrammer merged 1 commit into
mainfrom
feat/428-shared-connectors-scheduler
Jul 20, 2026
Merged

feat(ingest): shared connector builder + opt-in in-process sync scheduler (#428)#435
CheeryProgrammer merged 1 commit into
mainfrom
feat/428-shared-connectors-scheduler

Conversation

@CheeryProgrammer

Copy link
Copy Markdown
Contributor

Closes #428.

What

Two things, both keeping the minimal single-user stack unchanged (opt-in):

  1. Shared connector builder. The ~150-line connector-construction switch was duplicated in the CLI (buildConnector) and the MCP server (importFunc). It now lives once in internal/connectors.Build(ctx, kb, cfg, source, path, ocr); both adapters are thin wrappers. OAuth token resolution (Per-source credential / OAuth store #246) lives inside the builder; the OCR fallback is passed in by the caller so the exec shell-out stays in the cmd layer. Net −100 lines, one place to edit a connector.

  2. Opt-in in-process sync scheduler. cmd/http gains autoSync (mirrors the existing autoImport): with SYNC_INTERVAL set (e.g. 15m), the HTTP server re-ingests every configured remote connector on a timer — the in-process form of kb sync (Background streaming-sync scheduler + upsert re-ingest + push adapters (follow-up to #395) #415) — incrementally, honoring INGEST_PRUNE_DELETED. markdown is skipped (already swept by autoImport).

Default offSYNC_INTERVAL empty ⇒ the scheduler never starts, minimal config unchanged.

Tests

  • internal/connectors: Build construction + error cases (no DB needed — non-OAuth sources don't touch the core).
  • internal/config: SyncInterval() parse + SYNC_INTERVAL env.
  • gofmt / vet / golangci-lint clean; full non-DB suite green (DB-gated tests run in CI).

Docs

  • SYSTEM.md decision log (2026-07-20) + .env.example document SYNC_INTERVAL.

Follow-up

🤖 Generated with Claude Code

…uler (#428)

Deduplicate connector construction into internal/connectors.Build, reused by
the CLI (buildConnector) and MCP (importFunc) as thin wrappers, and add an
opt-in background sync in cmd/http.

- internal/connectors.Build(ctx, kb, cfg, source, path, ocr) is the single place
  connectors are built; OAuth resolution (#246) lives inside, OCR is passed in by
  the caller so the shell-out stays in the cmd layer. CLI + MCP now delegate to it
  (net -100 lines, one place to edit a connector).
- cmd/http autoSync: with SYNC_INTERVAL set (e.g. 15m), re-ingest every configured
  REMOTE connector on a timer — the in-process form of `kb sync` (#415) —
  incrementally, honoring INGEST_PRUNE_DELETED. markdown is skipped (autoImport
  already sweeps it). Default off (empty SYNC_INTERVAL) so the minimal single-user
  stack is unchanged.
- Config: Ingest.SyncInterval + SyncInterval() + SYNC_INTERVAL env.
- Tests: connectors.Build construction/error cases (no DB); SyncInterval parse +
  env. SYSTEM.md decision log + .env.example documented.

Push adapters (fsnotify/webhooks) remain a follow-up.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@CheeryProgrammer
CheeryProgrammer merged commit b559822 into main Jul 20, 2026
5 checks passed
@CheeryProgrammer
CheeryProgrammer deleted the feat/428-shared-connectors-scheduler branch July 20, 2026 05:00
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.

In-process sync scheduler + push adapters (fsnotify/webhooks) — follow-up to #415

1 participant