Skip to content

feat: add atlas-connection-error-debugger tool behind feature flag COMPASS-10835#8233

Open
paula-stacho wants to merge 4 commits into
mainfrom
COMPASS-10835
Open

feat: add atlas-connection-error-debugger tool behind feature flag COMPASS-10835#8233
paula-stacho wants to merge 4 commits into
mainfrom
COMPASS-10835

Conversation

@paula-stacho

@paula-stacho paula-stacho commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Description

Adding the atlas-connection-error-debugger - behind a feature flag. This is just the initial version, missing customized confirmation and response or the actual fetching of the cluster data.

Note: recommend viewing with 'Hide whitespaces'

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • If this change could impact the load on the MongoDB cluster, please describe the expected and worst case impact
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

Copilot AI review requested due to automatic review settings July 10, 2026 15:57
@github-actions github-actions Bot added the feat label Jul 10, 2026

Copilot AI 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.

Pull request overview

This PR introduces a new, feature-flagged tool intended to help debug Atlas connection failures, and threads the necessary preferences/service dependencies through the generative AI and assistant surfaces so the tool can be conditionally advertised and executed.

Changes:

  • Adds a new development-stage feature flag: enableAtlasConnectionErrorDebugger.
  • Switches tool listing to a preference-driven getAvailableTools(...) helper and updates assistant UI/prompting to use it.
  • Adds an atlas-connection-error-debugger tool to the ToolsController (and adds a placeholder AtlasService.debugConnection()).

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/compass-preferences-model/src/feature-flags.ts Adds the new feature flag definition.
packages/compass-generative-ai/src/tools-controller.ts Wires preferences/atlas service into ToolsController and conditionally registers the new tool.
packages/compass-generative-ai/src/tools-controller.spec.ts Updates controller construction to provide preferences/atlas service.
packages/compass-generative-ai/src/provider.tsx Injects preferences + atlas service into ToolsController provider and updates exports.
packages/compass-generative-ai/src/index.ts Re-exports getAvailableTools instead of AVAILABLE_TOOLS.
packages/compass-generative-ai/src/available-tools.ts Introduces getAvailableTools(...) with conditional atlas debugger listing.
packages/compass-assistant/test/tool-calls.eval.ts Updates ToolsController construction for eval harness.
packages/compass-assistant/src/prompts.ts Makes tool list in context prompt depend on enableAtlasConnectionErrorDebugger.
packages/compass-assistant/src/prompts.spec.ts Updates expected prompt output (currently inconsistent with default flag behavior).
packages/compass-assistant/src/components/tool-toggle.tsx Uses getAvailableTools(...) and preference to render tool list/count.
packages/compass-assistant/src/components/tool-toggle.spec.tsx Updates tool list/count expectations (currently inconsistent with rendered prefs).
packages/compass-assistant/src/components/tool-call-message.tsx Uses getAvailableTools(...) for tool descriptions; adjusts connection chip logic for the new tool.
packages/compass-assistant/src/components/tool-call-message.spec.tsx Updates comments to reflect tool listing source change.
packages/compass-assistant/src/compass-assistant-provider.tsx Threads the new preference into the prompt-building path; introduces an unused/mismatched extra-args type field.
packages/atlas-service/src/atlas-service.ts Adds placeholder debugConnection() API and return type.

Comment thread packages/compass-generative-ai/src/tools-controller.ts Outdated
Comment thread packages/compass-generative-ai/src/tools-controller.ts
Comment thread packages/atlas-service/src/atlas-service.ts
Comment thread packages/compass-assistant/src/prompts.spec.ts
Comment thread packages/compass-assistant/src/compass-assistant-provider.tsx
Comment thread packages/compass-assistant/src/components/tool-toggle.spec.tsx Outdated
Comment thread packages/compass-assistant/src/components/tool-toggle.spec.tsx Outdated
@paula-stacho paula-stacho added the feature flagged PRs labeled with this label will not be included in the release notes of the next release label Jul 14, 2026
@paula-stacho
paula-stacho marked this pull request as ready for review July 15, 2026 10:55
@paula-stacho
paula-stacho requested a review from a team as a code owner July 15, 2026 10:55
@paula-stacho
paula-stacho requested a review from mabaasit July 15, 2026 10:56
return json;
}

async debugConnection(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think so far the rule of thumb was that AtlasService is a generic service that gives you sort of lowish-level fetch methods and the actual fetching with proper paths, schema validation, etc is implemented closer to where it will be used (see rolling indexes service or ai service for example). I think unless you have some strong preference for changing this, I'd stick with that pattern for consistency

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I searched for a better place for this outside of the assistant (mostly around connections), but couldn't find one. I was set to have it outside because I figured we might want to add another flow for users who don't want to use assistant, but might be YAGNI.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd just put it close to the tool itself, I think if we're starting to use more of the admin apis going forward, we might consider adding some sort of admin api service generated from openapi definitions for that (but I similarly not sure if it's worth investment at the moment)

type ExperimentTestGroup,
} from '@mongodb-js/compass-telemetry';

function WithAtlasProviders({ children }: { children: React.ReactNode }) {

@gribnoysup gribnoysup Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I kinda feel like every time some core provider like that is added in the tests, we should consider adding this as a default to the testing-library-compass instead, otherwise we end up with a lot of tests reimplementing the same bootstrap code. Not a requirement to change this, but I'd at least consider this. The testing-library-compass package was added exactly for that purpose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat feature flagged PRs labeled with this label will not be included in the release notes of the next release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants