Skip to content

fix: honor per-instance connectorConfig in gmail, slack, x connectors#288

Merged
Colin Francis (colifran) merged 3 commits into
langchain-ai:mainfrom
bikeusaland:fix/connector-config-overrides
Jul 14, 2026
Merged

fix: honor per-instance connectorConfig in gmail, slack, x connectors#288
Colin Francis (colifran) merged 3 commits into
langchain-ai:mainfrom
bikeusaland:fix/connector-config-overrides

Conversation

@bikeusaland

@bikeusaland Greg Land (bikeusaland) commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Problem

ingestion.ts passes each source instance's connectorConfig overrides to every connector:

// src/ingestion.ts
connectorConfig: sourceConfig.connectorConfig,

But only hackernews and web-search actually merged those overrides on top of the on-disk config:

const config = {
  ...(await readConnectorConfig<HackerNewsConfig>("hackernews", { ... })),
  ...((options.connectorConfig ?? {}) as HackerNewsConfig),
};

gmail, slack, and x read only the on-disk config and ignored options.connectorConfig entirely. As a result, per-instance overrides defined during onboarding (e.g. a different query, maxMessages, or streams for a specific source instance) were silently dropped for those three connectors — no error, just the on-disk defaults.

Fix

Apply the exact merge pattern the other two connectors already use to gmail, slack, and x: read the on-disk config first, then spread options.connectorConfig on top so per-instance overrides win.

No behavior change for users who don't set per-instance overrides (the spread of an empty object is a no-op).

Verification

typecheck, lint:check, format:check, and the full test suite (200 tests) all pass.

Note: the source connectors currently have no unit-test harness (they call readConnectorConfig on the real ~/.openwiki home and global fetch with no injection seam), so a direct ingest() regression test is out of scope here — it depends on the broader connector-testability work. This change is the same one-line merge pattern already proven by the two connectors that had it.

🤖 Generated with Claude Code

Related PRs

Part of a batch from a single codebase-review pass. Independent, main-based branches that can merge in any order.

Security

Correctness

Feature

(This PR is #288.)

ingestion.ts passes each source instance's connectorConfig overrides to
every connector, but only hackernews and web-search merged them on top
of the on-disk config. gmail, slack, and x read only the disk config, so
per-instance overrides from onboarding were silently dropped for those
three connectors.

Apply the same merge pattern the other two connectors already use:
disk config first, then options.connectorConfig overrides on top.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@colifran

Copy link
Copy Markdown
Contributor

Greg Land (@bikeusaland) thanks for the PR! Could we get some tests for this?

Adds test/connector-config-overrides.test.ts, addressing the review
request on langchain-ai#288.

Each test points $HOME at a throwaway temp dir (the same pattern used by
onboarding/env-behavior tests), writes an on-disk connector config, and
asserts that options.connectorConfig is merged on top of it. The tests
are network-free: they observe which short-circuit gate the run stops at
(enabled -> "skipped", missing token -> "error"), so the merge behavior
is proven without any fetch. Verified the x/slack cases fail against the
pre-fix code (they return "skipped" instead of "error").

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bikeusaland

Copy link
Copy Markdown
Contributor Author

Thanks Colin Francis (@colifran)! Added tests in test/connector-config-overrides.test.ts (commit 5dc8e8b).

Approach: the gmail/slack/x connectors read config from ~/.openwiki/connectors/<id>/config.json and then call fetch, so to keep the tests network-free I point $HOME at a throwaway temp dir (the same pattern as the existing onboarding/env-behavior tests), write an on-disk config, and observe which short-circuit gate the run stops at:

  • x / slack (default disabled): on-disk enabled: false + ingest({ connectorConfig: { enabled: true } }) → the merge lets it pass the enabled gate and stop at the missing-token gate (status: "error"). Without the fix it stays "skipped".
  • gmail (default enabled): on-disk enabled: true + ingest({ connectorConfig: { enabled: false } }) → the override disables the run (status: "skipped") before any Gmail API call.

I confirmed the x/slack tests fail against the pre-fix code (returning "skipped" instead of "error"), so they genuinely guard the regression. Full gate passes locally: typecheck, lint:check, format:check, and the suite (200 tests).

@colifran Colin Francis (colifran) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice one. Thanks Greg Land (@bikeusaland)!

@colifran
Colin Francis (colifran) merged commit ddd1f60 into langchain-ai:main Jul 14, 2026
9 checks passed
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.

2 participants