Skip to content

fix(cloud): preserve existing stream sync settings in set_selected_streams - #1461

Closed
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1794330309-preserve-stream-config-on-select
Closed

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1794330309-preserve-stream-config-on-select

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Overview

👉 TL;DR: Changing which streams a Cloud connection syncs (via the SDK or the Cloud MCP tool) silently reset every stream that stayed selected to Full Refresh | Overwrite. Streams that stay selected now keep their existing sync settings; only newly added streams get the API defaults.

Specifically, CloudConnection.set_selected_streams() now fetches fresh connection info and passes its configurations.streams to api_util.build_stream_configurations(..., existing_streams=...), which resends each kept StreamConfiguration unchanged (sync_mode, cursor_field, primary_key, selected_fields, mappers, namespace, ...).

Resolves https://github.com/airbytehq/oncall/issues/13947:

Close on merge: no — customer-filed; support confirms the fix with the customer before closing.

Changes

  • api_util.build_stream_configurations: new keyword-only existing_streams; matching streams are reused as-is, unmatched names get StreamConfiguration(name=...) (unchanged behavior for create_connection, which doesn't pass it).
  • CloudConnection.set_selected_streams: fetches connection info with force_refresh=True before building the PATCH body; docstring documents the behavior.
  • set_cloud_connection_selected_streams MCP tool docstring: says existing streams keep their sync settings and new streams use the API default.
  • New tests/unit_tests/test_cloud_stream_selection.py pinning the serialized PATCH body.

Root cause

The public API (PATCH /v1/connections/{id}) maps a stream configuration with no syncMode to FULL_REFRESH + OVERWRITE. Previously the PATCH body contained only stream names, so every kept stream was rewritten as Full Refresh | Overwrite.

New-stream defaults

Newly added streams still send only name, i.e. the API default (Full Refresh | Overwrite). Picking an incremental default was left out to keep scope minimal.

Test Coverage

tests/unit_tests/test_cloud_stream_selection.py (6 tests, mocked API): kept streams retain syncMode/cursorField/primaryKey and other fields, deselected streams are dropped, new streams are added name-only, stale cache is bypassed, empty configurations work, and GET failures propagate. 4 of the 6 fail with the production change removed (the PATCH body contained [{'name': 'kept'}, {'name': 'new'}]); all pass with it. Full unit suite: 1302 passed, 1 skipped.

Follow-ups

  • Possible platform follow-up (not here): public API PATCH could preserve an existing stream's config when syncMode is omitted, and record catalog changes in the connection timeline.
  • Cloud MCP evals: the changed-tools run (https://github.com/airbytehq/cloud-mcp-evals/actions/runs/42862060267) failed before running any scenario because the eval sandbox image would not start (exec: "sandbox": executable file not found). It needs one re-run once the image is fixed.

Link to Devin session: https://app.devin.ai/sessions/e2115dbec37c49dd8f35b0763070f74b
Open in Devin Desktop: https://app.devin.ai/desktop/session/e2115dbec37c49dd8f35b0763070f74b?variant=devin

…reams

Co-Authored-By: bot_apk <apk@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

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/1794330309-preserve-stream-config-on-select' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1794330309-preserve-stream-config-on-select'

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
  • /evals - Runs the Cloud MCP evals that use the MCP tools this PR changed (/evals full=true runs the full suite)
📚 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 Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage overview

Languages: Python

Python / code-coverage/pytest-no-creds

main d9f652f devin/1794330309-pre... 9ebfbd6 +/-
65% 77% +12%
View coverage of the 10 most impacted files.
File main d9f652f devin/1794330309-pre... 9ebfbd6 +/-
airbyte/mcp/cloud.py 52% 71% +19%
airbyte/_util/api_util.py 36% 56% +20%
airbyte/mcp/_otel.py 0% 89% +89%
airbyte/mcp/int..._registry_ui.py 0% 92% +92%
airbyte/cloud/models.py 0% 95% +95%
airbyte/mcp/_sso_auth.py 0% 96% +96%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%
airbyte/_direct...nnector_docs.py 0% 97% +97%
airbyte/mcp/agents.py 0% 98% +98%
airbyte/_direct...ctors/models.py 0% 99% +99%

Python / code-coverage/pytest

main d9f652f devin/1794330309-pre... 9ebfbd6 +/-
71% 80% +9%
View coverage of the 10 most impacted files.
File main d9f652f devin/1794330309-pre... 9ebfbd6 +/-
airbyte/mcp/cloud.py 52% 71% +19%
airbyte/mcp/_otel.py 0% 89% +89%
airbyte/mcp/int..._registry_ui.py 0% 92% +92%
airbyte/_direct...ors/api_util.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/_direct...nnector_docs.py 0% 97% +97%
airbyte/mcp/agents.py 0% 98% +98%
airbyte/_direct...ctors/models.py 0% 99% +99%

Python / code-coverage/pytest-unit

main devin/1794330309-pre... 9ebfbd6 +/-
— 73% —

Line coverage data for the main branch is not yet available.

View coverage of the 10 most covered files.
File main devin/1794330309-pre... 9ebfbd6 +/-
airbyte/mcp/agents.py — 98% —
airbyte/mcp/_sso_auth.py — 96% —
airbyte/cloud/models.py — 95% —
airbyte/cloud/client.py — 91% —
airbyte/mcp/_otel.py — 89% —
airbyte/exceptions.py — 84% —
airbyte/progress.py — 80% —
airbyte/mcp/cloud.py — 71% —
airbyte/shared/...ql_processor.py — 68% —
airbyte/_util/api_util.py — 56% —

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated November 10, 2026 17:23 UTC

@aaronsteers
Aaron ("AJ") Steers (aaronsteers) marked this pull request as ready for review November 11, 2026 18:24
Copilot AI balanced review requested due to automatic review settings November 11, 2026 18:24

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.

🟢 Approval recommended

No active review issues remain for the change preserving existing sync settings when stream selections are updated.

No open issues 🎉

What changed in this PR

Fixes Cloud stream selection updates so streams that remain selected retain their existing sync settings instead of resetting to Full Refresh | Overwrite.

Changes:

  • Fetches fresh connection settings and reuses existing stream configurations; newly selected streams retain API defaults.
  • Documents the preservation behavior in the SDK and Cloud MCP tool.
  • Adds regression tests for serialized PATCH payloads, stale-cache bypass, empty configurations, and GET failures.
File Description
tests/​unit_tests/​test_cloud_stream_selection.py Adds six regression cases covering configuration preservation and update behavior.
airbyte/​mcp/​cloud.py Clarifies stream sync settings behavior in the tool docstring.
airbyte/​cloud/​connections.py Fetches fresh configurations before updating stream selection.
airbyte/​_util/​api_util.py Adds optional reuse of existing stream configurations.

Review effort: Balanced

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Closing in favor of #1460, which carries the same stream-preservation fix on release-candidate/v1 (the branch Cloud MCP prod deploys from) and adds a supported-mode default for newly selected streams. Tracking issue: #1459.


Posted by Devin, on behalf of Aaron ("AJ") Steers (@aaronsteers).

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.

1 participant