Skip to content

fix: gate connector tools to personal/local-wiki runs (#444) - #603

Open
Krish (akyourowngames) wants to merge 1 commit into
langchain-ai:mainfrom
akyourowngames:fix/connector-tool-mode-gating
Open

fix: gate connector tools to personal/local-wiki runs (#444)#603
Krish (akyourowngames) wants to merge 1 commit into
langchain-ai:mainfrom
akyourowngames:fix/connector-tool-mode-gating

Conversation

@akyourowngames

Copy link
Copy Markdown
Contributor

Summary

Fixes #444 — connector ingest tools are exposed to code-mode agents even though a codebase-documentation run has no business ingesting Gmail/Slack/X.

  • createOpenWikiConnectorTools now accepts an outputMode and returns [] for repository (code) mode.
  • The single call site (src/agent/index.ts) passes options.outputMode, which is already "repository" for code mode and "local-wiki" for personal/chat (see getRunModeOutputMode).
  • Personal/local-wiki runs are unchanged — they keep the full connector toolset.

Why

In code mode the agent documents a repo and writes openwiki/*.md. With the full connector toolset present, a subagent can call e.g. openwiki_ingest_connector({connectorId:"google"}), which throws Gmail refresh token is required for OAuth refresh because no connector credentials are configured (a normal state for a pure codebase-doc run / CI). It also wastes tokens discovering external sources it should not touch.

Test plan

  • Added test/raw-connector-tools.test.ts cases asserting:
    • local-wiki mode exposes openwiki_ingest_connector / openwiki_ingest_all_connectors
    • repository mode returns no connector tools
    • defaulting (no mode arg) behaves like local-wiki (preserves existing raw-tool tests)
  • npx tsc -p tsconfig.json --noEmit and tsconfig.client.json pass.
  • npx eslint clean on changed files.
  • All 9 tests in test/raw-connector-tools.test.ts pass.

Notes

This is distinct from #449 (operator allow/deny + graceful connector-tool failures) — that PR makes connector tools fail gracefully and adds operator tooling, whereas this PR gates them by run mode so code-mode agents are never offered them in the first place. The two are complementary.

createOpenWikiConnectorTools now takes an outputMode and returns no
connector tools for repository (code) mode, so code-mode agents are no
longer handed credentialed external ingestion tools (Gmail, Slack, X, ...)
that throw on missing credentials. Personal/local-wiki runs are unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 6, 2026 17:44
@changeset-bot

changeset-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7f93f8c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openwiki Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

[Bug]: Connector ingest tools are exposed to code-mode agents (should be gated by run mode)

2 participants