Skip to content

fix(mcp): degrade gracefully when the connector feature probe fails - #1249

Merged
Aaron ("AJ") Steers (aaronsteers) merged 5 commits into
release-candidate/v1from
devin/1790299397-feature-probe-degrade
Sep 25, 2026
Merged

Aaron ("AJ") Steers (aaronsteers) merged 5 commits into
release-candidate/v1from
devin/1790299397-feature-probe-degrade

Conversation

@aaronsteers

@aaronsteers Aaron ("AJ") Steers (aaronsteers) commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Client-side mitigation for AGENTIC-2274 (Cloud GET /workspaces/{id}/skills/docs and /execute routes returning 422/502/504 on the Fusion workspace). This PR does not make those calls succeed; it stops one failing docs probe from taking out unrelated MCP tools, gives callers a typed exception to branch on, and makes the 5xx errors self-explanatory.

Before: a single non-403/404 error from the docs probe raised out of list_cloud_connectors feature_filter=… and describe_cloud_connector, and each connector's probe could sit on the 300s request timeout.

After (MCP layer only; CloudWorkspace.list_connectors / CloudConnector.enabled_features semantics unchanged — 403/404 still mean "not enabled", other errors still raise from the library):

  • New AirbyteCloudApiError(AirbyteError) with status_code: int | None. make_cloud_agent_request raises it for any non-2xx Config API response (malformed/non-JSON bodies still raise plain AirbyteError). is_not_enabled_error checks isinstance(..., AirbyteCloudApiError) and status_code in {403, 404}. _error_message no longer appends a generic HTTP reason phrase (401/403 lines unchanged) — callers use status_code, not the message.
  • list_cloud_connectors(feature_filter=…) validates limit > 0 up front (same contract as CloudWorkspace.list_connectors), then lists without the filter and probes per connector:
    probe ok, feature in features        -> included, enabled_features=[...]
    probe ok, feature not in features    -> excluded (unchanged)
    RequestException or 502/503/504      -> this and ALL remaining connectors "unknown" + warning, no further probes
    any other AirbyteError (e.g. 422)    -> only this connector "unknown" + warning, probing continues
    
    Short-circuit rationale: a transport/5xx failure means the docs endpoint is down for the workspace, so paying another timeout per connector buys nothing; a 4xx is connector-specific. Unknowns are included (not dropped) so an agent can still describe/try them. limit counts unknowns.
  • CloudConnectorResult gains warnings: list[str] and enabled_features accepts "unknown" (alongside "not_checked").
  • _describe_cloud_connector: feature lookup + context-layer block wrapped; on failure enabled_features="unknown" + warning instead of raising.
  • _error_guidance: 502/503/504 carry "Cloud accepted the request but its upstream direct-access service failed or timed out … not a credentials or permissions problem".

Tests: typed exception + status code + no phrase, 5xx guidance, workspace-wide 502 short-circuit (probe called exactly twice for 3 connectors), connector-specific 422 (all 3 probed), 404 still excluded, limit with unknowns, limit=0 rejected, describe marks unknown.

Related: #1248 (envelope normalization), AGENTIC-2274.

Link to Devin session: https://app.devin.ai/sessions/131e8cb1f5b547b8b99d66ddfd4b0bda
Open in Devin Desktop: https://app.devin.ai/desktop/session/131e8cb1f5b547b8b99d66ddfd4b0bda?variant=devin
Requested by: Aaron ("AJ") Steers (@aaronsteers)

devin-ai-integration Bot and others added 2 commits September 25, 2026 01:25
Co-Authored-By: AJ Steers <aj@airbyte.io>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

Copy link
Copy Markdown

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

💡 Show Tips and Tricks

Testing This PyAirbyte Version

You can test this version of PyAirbyte using the following:

# Run PyAirbyte CLI from this branch:
uvx --from 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1790299397-feature-probe-degrade' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1790299397-feature-probe-degrade'

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /fix-pr - Fixes most formatting and linting issues
  • /uv-lock - Updates uv.lock file
  • /test-pr - Runs tests with the updated PyAirbyte
  • /prerelease - Builds and publishes a prerelease version to PyPI
📚 Show Repo Guidance

Helpful Resources

Community Support

Questions? Join the #pyairbyte channel in our Slack workspace.

📝 Edit this welcome message.

@github-code-quality

github-code-quality Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: Python

Python / code-coverage/pytest-no-creds

The overall line coverage in commit b8230d6 in the devin/1790299397-fea... branch is 76%. The line coverage in commit d9f652f in the release-candidate/v1 branch is 65%.

Show a line coverage summary of the most impacted files.
File release-candidate/v1 d9f652f devin/1790299397-fea... b8230d6 +/-
airbyte/_util/api_util.py 36% 57% +21%
airbyte/mcp/cloud.py 52% 76% +24%
airbyte/cloud/connectors.py 34% 63% +29%
airbyte/mcp/_otel.py 0% 89% +89%
airbyte/_direct...ctors/models.py 0% 91% +91%
airbyte/_direct...nnector_docs.py 0% 91% +91%
airbyte/mcp/int..._registry_ui.py 0% 92% +92%
airbyte/mcp/_sso_auth.py 0% 96% +96%
airbyte/cloud/models.py 0% 96% +96%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%

Python / code-coverage/pytest

The overall line coverage in commit b8230d6 in the devin/1790299397-fea... branch is 79%. The line coverage in commit d9f652f in the release-candidate/v1 branch is 71%.

Show a line coverage summary of the most impacted files.
File release-candidate/v1 d9f652f devin/1790299397-fea... b8230d6 +/-
airbyte/cloud/connectors.py 51% 71% +20%
airbyte/mcp/cloud.py 52% 76% +24%
airbyte/mcp/_otel.py 0% 89% +89%
airbyte/_direct...ctors/models.py 0% 91% +91%
airbyte/_direct...nnector_docs.py 0% 91% +91%
airbyte/mcp/int..._registry_ui.py 0% 92% +92%
airbyte/mcp/_sso_auth.py 0% 96% +96%
airbyte/cloud/models.py 0% 96% +96%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%
airbyte/mcp/http_main.py 0% 97% +97%

Python / code-coverage/pytest-unit

The overall line coverage in commit b8230d6 in the devin/1790299397-fea... branch is 72%. Line coverage data for the release-candidate/v1 branch is not yet available.

Show a line coverage summary of the most covered files.
File release-candidate/v1 devin/1790299397-fea... b8230d6 +/-
airbyte/mcp/_sso_auth.py — 96% —
airbyte/cloud/models.py — 96% —
airbyte/cloud/client.py — 91% —
airbyte/mcp/_otel.py — 89% —
airbyte/exceptions.py — 85% —
airbyte/progress.py — 80% —
airbyte/mcp/cloud.py — 76% —
airbyte/shared/...ql_processor.py — 68% —
airbyte/cloud/connectors.py — 63% —
airbyte/_util/api_util.py — 57% —

Updated September 25, 2026 17:30 UTC

@aaronsteers
Aaron ("AJ") Steers (aaronsteers) marked this pull request as ready for review September 25, 2026 16:56
Copilot AI lite review requested due to automatic review settings September 25, 2026 16:56
Comment thread airbyte/_direct_connectors/api_util.py Outdated

@devin-ai-integration devin-ai-integration Bot 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.

Devin Review found 2 potential issues.

Devin Review

Comment thread airbyte/mcp/cloud.py
Comment thread airbyte/mcp/cloud.py

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.

Copilot review overview

🟡 Changes recommended

limit=0 and negative limits bypass existing validation when feature_filter is set.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

This PR makes MCP Cloud connector discovery resilient to failed feature probes and improves 5xx error guidance.

Changes:

  • Adds unknown-feature results, warnings, and probe short-circuiting.
  • Makes connector descriptions degrade gracefully.
  • Adds HTTP status phrases and upstream-service guidance.
File Summary
tests/​unit_tests/​test_mcp_cloud.py Tests probe failures, unknown features, filtering, limits, and descriptions.
tests/​unit_tests/​test_cloud_direct_execute.py Tests 5xx guidance and status phrases.
airbyte/​mcp/​cloud.py Handles failed probes and unknown feature states; non-positive filtered limits require validation correction.
airbyte/​_direct_connectors/​api_util.py Improves HTTP error messages and upstream failure guidance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread airbyte/mcp/cloud.py
devin-ai-integration Bot and others added 3 commits September 25, 2026 17:06
…lures per-connector

Co-Authored-By: AJ Steers <aj@airbyte.io>
@aaronsteers
Aaron ("AJ") Steers (aaronsteers) merged commit 5cc2f5d into release-candidate/v1 Sep 25, 2026
22 checks passed
@aaronsteers
Aaron ("AJ") Steers (aaronsteers) deleted the devin/1790299397-feature-probe-degrade branch September 25, 2026 19:13
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