Repository navigation
feat(mcp)!: consented rename-to-delete, AirbyteDeletionGuardError, safe_mode → delete_guard, opt-in disable-delete-guard setting - #1394
Conversation
Co-Authored-By: AJ Steers <aj@airbyte.io>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksTesting This PyAirbyte VersionYou 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 CommandsAirbyte Maintainers can execute the following slash commands on your PR:
📚 Show Repo GuidanceHelpful ResourcesCommunity SupportQuestions? Join the #pyairbyte channel in our Slack workspace. |
Aaron ("AJ") Steers (aaronsteers)
left a comment
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
🟡 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.
…lete-guard errors Co-Authored-By: AJ Steers <aj@airbyte.io>
…tant Co-Authored-By: AJ Steers <aj@airbyte.io>
Done in 79100aa. |
Code coverage overviewLanguages: Python Python / code-coverage/pytest-no-creds
View coverage of the 10 most impacted files.
Python / code-coverage/pytest
View coverage of the 10 most impacted files.
Python / code-coverage/pytest-unit
Line coverage data for the release-candidate/v1 branch is not yet available. View coverage of the 10 most covered files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
… URL Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
…nt guidance Co-Authored-By: AJ Steers <aj@airbyte.io>
AirbyteDeletionGuardError, safe_mode → delete_guard, opt-in disable-delete-guard setting
5ffe67e
into
release-candidate/v1

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
AirbyteDeletionGuardErrorcarrying the resource type, name and URL. The deletion kwargsafe_modeis renamed todelete_guard, retiring the old "safe mode" term. A new opt-inAIRBYTE_CLOUD_MCP_DISABLE_DELETE_GUARDenv var /X-MCP-Disable-Delete-Guardheader 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.AirbyteDeletionGuardError(AirbyteLibInputError)inairbyte/exceptions.pywithresource_type,resource_name,resource_urland default consentguidance. It's raised bypermanently_delete_workspace,delete_source,delete_destination,delete_connectionanddelete_custom_yaml_source_definition.CloudWorkspacenow passesworkspace_idto the source/destination deletes, so their URLs resolve.safe_mode: bool = True→delete_guard: bool = Trueon those 5api_utilfunctions,CloudWorkspace.permanently_delete_source/_destination/_connection/permanently_delete_workspace,CloudClient.permanently_delete_workspaceandCloudCustomSourceDefinition.permanently_delete. There's no alias: passingsafe_mode=now raisesTypeError.AIRBYTE_CLOUD_MCP_DISABLE_DELETE_GUARDenv var,X-MCP-Disable-Delete-Guardheader,disable_delete_guardconfig arg. It's resolved bydelete_guard_disabled()through_resolve_policywith the same env-deny-wins / header-narrows rules as theALLOW_*settings, and defaults to the guard on. The 4 MCP delete paths passdelete_guard=not delete_guard_disabled(ctx). A new "Delete Guard" docs section inairbyte/mcp/__init__.pynamesALLOW_DESTRUCTIVE_TOOLS=0as the stronger option. Agent-facing rejection guidance doesn't mention the opt-out.AIRBYTE_CLOUD_MCP_SAFE_MODE/X-MCP-Safe-Modeare unchanged.Review Spotlight
AirbyteDeletionGuardErrorinairbyte/exceptions.py, and the URL construction at the 5 raise sites inairbyte/_util/api_util.py.delete_guard_disabled()inairbyte/mcp/_tool_utils.pyand its call sites inairbyte/mcp/cloud.py.Risks / Follow-ups
safe_mode=break (see Changes).AIRBYTE_CLOUD_MCP_DISABLE_DELETE_GUARDunset, any caller can disable the guard with the header. Set it to0in a deployment to forbid that.Test plan
ruff check/ruff format --check/pyrefly checkclean.delete_guard_disabledprecedence 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)