Skip to content

fix(mcp): make explore cross-context dedup opt-in - #1624

Closed
danusha2345 wants to merge 10 commits into
colbymchenry:mainfrom
danusha2345:fix/1620-explore-context-dedup
Closed

danusha2345 wants to merge 10 commits into
colbymchenry:mainfrom
danusha2345:fix/1620-explore-context-dedup

Conversation

@danusha2345

Copy link
Copy Markdown
Contributor

Summary

Fixes #1620.

An MCP connection is not a reliable conversation boundary: hosts may reuse it for subagents or keep it alive across context compaction. Suppressing source by default can therefore point an agent at text that its current context never received.

  • default cross-call source deduplication to off
  • enable it only for explicit truthy CODEGRAPH_EXPLORE_DEDUP=1 style values
  • preserve the existing optimization for hosts that guarantee one durable agent context per connection
  • test both the safe default and explicit opt-in behavior

This is deliberately limited to the correctness fix and does not add installer hooks or host trust state.

Verification

  • npm run build:kernel
  • npm run build
  • focused dedup suite — 26 passed
  • npm test -- --reporter=dot — 194 files, 3231 passed, 10 skipped

@danusha2345
danusha2345 force-pushed the fix/1620-explore-context-dedup branch from d8e500b to 63992fa Compare August 28, 2026 07:03
@bompus

bompus commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Verified on a real TypeScript repo (Chrome MV3 extension, 582 files, TS/JS/Vue/markdown, Windows 11, tree-sitter wasm walker, kernel off). Branch: this PR merged onto current main (b9ca4b7) plus our fork's markdown/literal extras; control build indexed the same tree without the PR.

Merges clean onto main. No index change (identical node/edge counts), as expected for an opt-in flag. PR test files: 26/26 pass.

Verified alongside #1621 on the same tree; that one has two Windows-only test failures (details there), this one none. Either fixes the subagent "already sent" case for us; this one does it without installing session hooks into user settings.

danusha2345 added 2 commits September 8, 2026 11:12
@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (3adf067, post-#1770) into this branch: head a568428. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (43271f3) into this branch: head ac52e7c. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (85550eb) into this branch: head 09f4dcf. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (8733c28) into this branch: head 5f7e6c7. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (8c04734) into this branch: head a7323aa. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (ee83636) into this branch: head 17d77e0. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (e720f6c) into this branch: head d3c6a04. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@colbymchenry

Copy link
Copy Markdown
Owner

Superseded by Forge landing PR #1788, which cherry-picks this approach (opt-in CODEGRAPH_EXPLORE_DEDUP) onto current main with CHANGELOG conflict resolved + MCP server-instructions alignment. Thanks @danusha2345 — closing as superseded.

colbymchenry added a commit that referenced this pull request Sep 8, 2026
Land the #1624 approach by @danusha2345: re-serve source by default so
subagents and compacted contexts never inherit stale already-sent pointers.
Keep cross-call dedup available through explicit truthy
CODEGRAPH_EXPLORE_DEDUP values for durable contexts.

Preserve current Unreleased entries, credit the contribution, and align
the MCP server guidance with the safe default.

Validation on Linux / Node 22.23.2:
- Reproduced default-on failure before the fix; default-off now passes.
- Focused explore-cross-call-dedup suite: 26 passed.
- TypeScript: npx tsc -p tsconfig.json --noEmit passed.

Fixes #1620.

(cherry picked from commit 63992fa)

Co-authored-by: danusha2345 <ewidusoc498@gmail.com>
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.

codegraph_explore tells a fresh subagent that source was "already sent" to a different context

3 participants