Skip to content

fix(cloud): normalize Cloud execute data/meta response envelope - #1248

Merged
Aaron ("AJ") Steers (aaronsteers) merged 2 commits into
release-candidate/v1from
devin/1790299122-cloud-execute-envelope
Sep 25, 2026
Merged

Aaron ("AJ") Steers (aaronsteers) merged 2 commits into
release-candidate/v1from
devin/1790299122-cloud-execute-envelope

Conversation

@aaronsteers

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

Copy link
Copy Markdown
Member

Summary

Targeted extraction of one piece of #1240 (Piotr Kozikowski (@pkozikow), AGENTIC-2244) so it can land ahead of the rest of that PR.

The Cloud Config API POST /{sources,destinations}/{id}/execute routes return {"data": ..., "meta"?: {...}}, but execute_cloud_connector_action returned the raw body and callers validated it as ExternalApiExecuteResult (which requires status and reads result/connector_metadata). As soon as the backend returns a 200 on these routes, every execute_api_query / execute_sql_query call (and the execute_external_* MCP tools) would fail on model validation.

 def execute_cloud_connector_action(...) -> ExternalApiExecuteResult:
-    return make_cloud_agent_request(...)
+    response = make_cloud_agent_request(...)
+    # raise AirbyteError if "data" missing or "meta" not a dict
+    return ExternalApiExecuteResult(
+        status="success", result=response["data"], connector_metadata=response.get("meta", {})
+    )

CloudConnector._execute_direct_action now returns that typed result directly instead of calling model_validate on a dict. data is passed through untouched (including None/falsy values and nested {"data","meta"} SQL payloads); top-level meta becomes connector_metadata so has_next_page/end_cursor resolve as before.

Tests: _patch_execute now fakes requests.request and runs the real execute_cloud_connector_action, so the boundary is exercised; new cases cover payload preservation, top-level meta mapping, and malformed envelopes.

Not included from #1240: write-action rejection, docs-probe resilience, describe guidance changes.

Related: AGENTIC-2274 (backend currently returns 422/502/504 on these routes on the Fusion test workspace — this PR does not change that, it only makes the success path correct).

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)

Co-authored-by: Piotr Kozikowski <piotr.kozikowski@gmail.com>
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/1790299122-cloud-execute-envelope' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1790299122-cloud-execute-envelope'

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 6b75d73 in the devin/1790299122-clo... 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/1790299122-clo... 6b75d73 +/-
airbyte/_util/api_util.py 36% 57% +21%
airbyte/mcp/cloud.py 52% 75% +23%
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 6b75d73 in the devin/1790299122-clo... 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/1790299122-clo... 6b75d73 +/-
airbyte/cloud/connectors.py 51% 71% +20%
airbyte/mcp/cloud.py 52% 75% +23%
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 6b75d73 in the devin/1790299122-clo... 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/1790299122-clo... 6b75d73 +/-
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 — 75% —
airbyte/shared/...ql_processor.py — 68% —
airbyte/cloud/connectors.py — 63% —
airbyte/_util/api_util.py — 57% —

Updated September 25, 2026 02:00 UTC

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

@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: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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

🟢 Approval recommended

The reviewed changes correctly normalize Cloud responses and include focused test coverage.

Review effort: Lite
Findings: None

What changed in this PR

Normalizes Cloud execute API responses into the expected result structure while preserving payloads and pagination metadata.

Changes:

  • Validates and maps data and meta response fields.
  • Preserves payloads, including falsy and nested values.
  • Adds coverage for successful and malformed responses.
File Description
tests/​unit_tests/​test_cloud_direct_execute.py Tests response normalization, metadata mapping, payload preservation, and errors.
airbyte/​_direct_connectors/​api_util.py Validates and normalizes Cloud execution responses.

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

…loud_connector_action

Co-Authored-By: AJ Steers <aj@airbyte.io>
@aaronsteers
Aaron ("AJ") Steers (aaronsteers) merged commit eeeee1b into release-candidate/v1 Sep 25, 2026
23 checks passed
@aaronsteers
Aaron ("AJ") Steers (aaronsteers) deleted the devin/1790299122-cloud-execute-envelope branch September 25, 2026 15:31
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