Skip to content

feat(mcp)!: consented rename-to-delete, AirbyteDeletionGuardError, safe_mode → delete_guard, opt-in disable-delete-guard setting - #1394

Merged
Aaron ("AJ") Steers (aaronsteers) merged 8 commits into
release-candidate/v1from
devin/1792172572-delete-guard-consent-wording
Oct 16, 2026
Merged

Aaron ("AJ") Steers (aaronsteers) merged 8 commits into
release-candidate/v1from
devin/1792172572-delete-guard-consent-wording

Conversation

@aaronsteers

@aaronsteers Aaron ("AJ") Steers (aaronsteers) commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Summary

👉 TL;DR: Agents refused to rename a resource so it could be deleted, even after the user explicitly asked them to. The guidance now allows the rename once the user explicitly consents, and forbids it without asking. When the agent asks, it shows the resource's name and URL. Guard rejections raise a dedicated AirbyteDeletionGuardError carrying the resource type, name and URL. The deletion kwarg safe_mode is renamed to delete_guard, retiring the old "safe mode" term. A new opt-in AIRBYTE_CLOUD_MCP_DISABLE_DELETE_GUARD env var / X-MCP-Disable-Delete-Guard header turns the guard off for MCP delete tools.

Pairs with docs PR: airbytehq/airbyte#89030

Changes

  • DELETE_NAME_GUARD_TIP_TEXT (all delete tools) and the "Deletion guard" bullet in _INSTRUCTIONS_SAFETY: rename only with explicit user consent, and show the resource name + Airbyte URL when asking.
  • New AirbyteDeletionGuardError(AirbyteLibInputError) in airbyte/exceptions.py with resource_type, resource_name, resource_url and default consent guidance. It's raised by permanently_delete_workspace, delete_source, delete_destination, delete_connection and delete_custom_yaml_source_definition. CloudWorkspace now passes workspace_id to the source/destination deletes, so their URLs resolve.
  • Breaking: safe_mode: bool = True → delete_guard: bool = True on those 5 api_util functions, CloudWorkspace.permanently_delete_source / _destination / _connection / permanently_delete_workspace, CloudClient.permanently_delete_workspace and CloudCustomSourceDefinition.permanently_delete. There's no alias: passing safe_mode= now raises TypeError.
  • New opt-in setting: AIRBYTE_CLOUD_MCP_DISABLE_DELETE_GUARD env var, X-MCP-Disable-Delete-Guard header, disable_delete_guard config arg. It's resolved by delete_guard_disabled() through _resolve_policy with the same env-deny-wins / header-narrows rules as the ALLOW_* settings, and defaults to the guard on. The 4 MCP delete paths pass delete_guard=not delete_guard_disabled(ctx). A new "Delete Guard" docs section in airbyte/mcp/__init__.py names ALLOW_DESTRUCTIVE_TOOLS=0 as the stronger option. Agent-facing rejection guidance doesn't mention the opt-out.
  • The removed-option guards for AIRBYTE_CLOUD_MCP_SAFE_MODE / X-MCP-Safe-Mode are unchanged.

Review Spotlight

Risks / Follow-ups

  • Python callers passing safe_mode= break (see Changes).
  • If the hosted deployment leaves AIRBYTE_CLOUD_MCP_DISABLE_DELETE_GUARD unset, any caller can disable the guard with the header. Set it to 0 in a deployment to forbid that.

Test plan

  • ruff check / ruff format --check / pyrefly check clean.
  • Targeted unit tests pass (233), covering exception rendering + URLs, the kwarg rename, all 5 delete_guard_disabled precedence cases, and MCP delete-tool default vs opt-out. The integration tests weren't run locally.

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

@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

@aaronsteers
Aaron ("AJ") Steers (aaronsteers) marked this pull request as ready for review October 16, 2026 17:45
@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/1792172572-delete-guard-consent-wording' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1792172572-delete-guard-consent-wording'

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.

@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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Can we also suggest the agent to provide the name and URL of the resource to delete as an artifact confirming that the correct resource is specified? (User can choose to click it or not.)

…lete consent

Co-Authored-By: AJ Steers <aj@airbyte.io>

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.

🟡 Changes recommended

Rejection messages must distinguish deletion confirmation from explicit consent to rename.

1 open finding
What changed in this PR

Updates agent-facing deletion guidance to allow renaming with explicit user consent, without changing the name-guard logic.

Changes:

  • Revises shared delete-tool guidance and server safety instructions.
  • Updates five safe-mode rejection messages with rename-and-retry guidance.
File Description
airbyte/​mcp/​server.py Updates deletion-guard safety instructions.
airbyte/​mcp/​cloud.py Requires explicit rename consent in shared tool guidance.
airbyte/​_util/​api_util.py Revises five deletion rejection messages.

🧠 Review effort: Balanced


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

Comment thread airbyte/_util/api_util.py Outdated
Comment thread airbyte/_util/api_util.py Outdated
devin-ai-integration Bot and others added 2 commits October 16, 2026 17:48
…lete-guard errors

Co-Authored-By: AJ Steers <aj@airbyte.io>
…tant

Co-Authored-By: AJ Steers <aj@airbyte.io>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

Can we also suggest the agent to provide the name and URL of the resource to delete as an artifact confirming that the correct resource is specified?

Done in 79100aa. DELETE_NAME_GUARD_TIP_TEXT now ends with "When asking for consent, show the user the resource's name and Airbyte URL (as returned by the describe or list tools) so they can confirm the correct resource is targeted." The server-instructions "Deletion guard" bullet has a matching line. Describe/list responses already return the URLs, so no tool output changed.

Written by Devin

Comment thread airbyte/_util/api_util.py Outdated
@github-code-quality

github-code-quality Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage overview

Languages: Python

Python / code-coverage/pytest-no-creds

release-candidate/v1 d9f652f devin/1792172572-del... e54f22a +/-
65% 79% +14%
View coverage of the 10 most impacted files.
File release-candidate/v1 d9f652f devin/1792172572-del... e54f22a +/-
airbyte/_util/api_util.py 36% 67% +31%
airbyte/mcp/cloud.py 52% 85% +33%
airbyte/cloud/connectors.py 34% 79% +45%
airbyte/mcp/_datadog.py 0% 50% +50%
airbyte/mcp/_user_identity.py 0% 93% +93%
airbyte/mcp/_telemetry.py 0% 94% +94%
airbyte/_direct...ctors/models.py 0% 95% +95%
airbyte/mcp/_sso_auth.py 0% 96% +96%
airbyte/cloud/models.py 0% 97% +97%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%

Python / code-coverage/pytest

release-candidate/v1 d9f652f devin/1792172572-del... e54f22a +/-
71% 82% +11%
View coverage of the 10 most impacted files.
File release-candidate/v1 d9f652f devin/1792172572-del... e54f22a +/-
airbyte/cloud/connectors.py 51% 83% +32%
airbyte/mcp/cloud.py 52% 85% +33%
airbyte/mcp/_datadog.py 0% 50% +50%
airbyte/mcp/int..._registry_ui.py 0% 92% +92%
airbyte/mcp/_user_identity.py 0% 93% +93%
airbyte/mcp/_telemetry.py 0% 94% +94%
airbyte/_direct...ctors/models.py 0% 95% +95%
airbyte/mcp/_sso_auth.py 0% 96% +96%
airbyte/cloud/models.py 0% 97% +97%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%

Python / code-coverage/pytest-unit

release-candidate/v1 devin/1792172572-del... e54f22a +/-
— 76% —

Line coverage data for the release-candidate/v1 branch is not yet available.

View coverage of the 10 most covered files.
File release-candidate/v1 devin/1792172572-del... e54f22a +/-
airbyte/cloud/models.py — 97% —
airbyte/mcp/_sso_auth.py — 96% —
airbyte/_direct...ctors/models.py — 95% —
airbyte/cloud/client.py — 90% —
airbyte/exceptions.py — 90% —
airbyte/mcp/cloud.py — 85% —
airbyte/progress.py — 80% —
airbyte/cloud/connectors.py — 79% —
airbyte/shared/...ql_processor.py — 68% —
airbyte/_util/api_util.py — 67% —

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


Updated October 16, 2026 18:22 UTC

devin-ai-integration Bot and others added 2 commits October 16, 2026 17:58
… URL

Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
@devin-ai-integration devin-ai-integration Bot changed the title fix(mcp): allow rename-to-delete only after explicit user consent fix(mcp)!: allow consented rename-to-delete, add AirbyteDeletionGuardError, rename safe_mode to delete_guard Oct 16, 2026
devin-ai-integration Bot and others added 2 commits October 16, 2026 18:08
…nt guidance

Co-Authored-By: AJ Steers <aj@airbyte.io>
@devin-ai-integration devin-ai-integration Bot changed the title fix(mcp)!: allow consented rename-to-delete, add AirbyteDeletionGuardError, rename safe_mode to delete_guard feat(mcp)!: consented rename-to-delete, AirbyteDeletionGuardError, safe_mode → delete_guard, opt-in disable-delete-guard setting Oct 16, 2026
@aaronsteers Aaron ("AJ") Steers (aaronsteers) changed the title feat(mcp)!: consented rename-to-delete, AirbyteDeletionGuardError, safe_mode → delete_guard, opt-in disable-delete-guard setting feat(mcp)!: consented rename-to-delete, AirbyteDeletionGuardError, safe_mode → delete_guard, opt-in disable-delete-guard setting Oct 16, 2026
@aaronsteers
Aaron ("AJ") Steers (aaronsteers) merged commit 5ffe67e into release-candidate/v1 Oct 16, 2026
32 checks passed
@aaronsteers
Aaron ("AJ") Steers (aaronsteers) deleted the devin/1792172572-delete-guard-consent-wording branch October 16, 2026 18:46
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.

3 participants