Skip to content

fix(mcp): stop masking the agent's own arguments in tool error text - #1366

Merged
Aaron ("AJ") Steers (aaronsteers) merged 1 commit into
release-candidate/v1from
devin/1791849842-agent-error-no-arg-masking
Oct 13, 2026
Merged

Aaron ("AJ") Steers (aaronsteers) merged 1 commit into
release-candidate/v1from
devin/1791849842-agent-error-no-arg-masking

Conversation

@aaronsteers

Copy link
Copy Markdown
Member

Summary

AgentErrorTextMiddleware no longer masks tool-argument values in the error text the agent sees. The agent sent those arguments itself, so masking them protects nothing, and it broke useful output. For example, connector links in guidance came back as /source/<value of source_id>. Span/telemetry arg tracing is unchanged.

Before After
Echoed connection_id in an error <value of connection_id> raw value
Bearer tokens, URL credentials, input_value= echoes redacted redacted (unchanged)
URL query strings stripped stripped (unchanged)

Changes

  1. redact_agent_text(text, arguments, tool) becomes redact_agent_text(text), which keeps only the four pattern redactions.
  2. Removed the code that became dead: _collect_leaves, _secret_leaf, _allowed_choices, _JSON_LITERALS, _call_arguments, and the classify_tool / declared_parameters / TraceArg imports.
  3. Tests that asserted <value of ...> now assert the raw value passes through. Added a test that an error containing a connector ID and Cloud URL comes back unchanged.

Review Spotlight

The middleware still redacts text the agent did not send, such as server-side bearer tokens, URL userinfo and signed-URL query strings.

Stack

Risks / Follow-ups

  • Behavior change: agent-facing error text can now echo any argument the agent passed, secret-class args included. This is intentional, since the agent already holds those values.
  • airbyte/mcp/_error_handling.py is a private module, so no public API changes.

Link to Devin session: https://app.devin.ai/sessions/bb884d35f6d24ad993d7f494e660acbc
Open in Devin Desktop: https://app.devin.ai/desktop/session/bb884d35f6d24ad993d7f494e660acbc?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

@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/1791849842-agent-error-no-arg-masking' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1791849842-agent-error-no-arg-masking'

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.

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

The focused implementation matches the stated behavior and preserves existing non-argument redaction and telemetry protections.

0 open findings

What changed in this PR

Updates MCP agent-facing errors to preserve tool argument values while retaining credential and URL redaction.

Changes:

  • Removes argument-aware masking and related dead code.
  • Updates error middleware calls and tests for raw argument passthrough.
  • Confirms telemetry redaction remains unchanged.
File Description
airbyte/​mcp/​_error_handling.py Simplifies agent-text redaction to pattern-based safeguards.
tests/​unit_tests/​test_mcp_tool_errors.py Updates argument-passthrough coverage.
tests/​unit_tests/​test_mcp_datadog.py Verifies passthrough does not affect telemetry privacy.

🧠 Review effort: Balanced


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

@github-code-quality

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

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: Python

Python / code-coverage/pytest-no-creds

The overall line coverage in commit 5c84ee3 in the devin/1791849842-age... branch is 79%. 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/1791849842-age... 5c84ee3 +/-
airbyte/mcp/cloud.py 52% 83% +31%
airbyte/_util/api_util.py 36% 68% +32%
airbyte/cloud/connectors.py 34% 75% +41%
airbyte/mcp/_datadog.py 0% 50% +50%
airbyte/mcp/_user_identity.py 0% 93% +93%
airbyte/_direct...ctors/models.py 0% 94% +94%
airbyte/mcp/_telemetry.py 0% 94% +94%
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

The overall line coverage in commit 5c84ee3 in the devin/1791849842-age... branch is 81%. 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/1791849842-age... 5c84ee3 +/-
airbyte/cloud/connectors.py 51% 80% +29%
airbyte/mcp/cloud.py 52% 83% +31%
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/_direct...ctors/models.py 0% 94% +94%
airbyte/mcp/_telemetry.py 0% 94% +94%
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

The overall line coverage in commit 5c84ee3 in the devin/1791849842-age... branch is 76%. 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/1791849842-age... 5c84ee3 +/-
airbyte/cloud/models.py — 97% —
airbyte/mcp/_sso_auth.py — 96% —
airbyte/_direct...ctors/models.py — 94% —
airbyte/cloud/client.py — 90% —
airbyte/exceptions.py — 89% —
airbyte/mcp/cloud.py — 83% —
airbyte/progress.py — 80% —
airbyte/cloud/connectors.py — 75% —
airbyte/_util/api_util.py — 68% —
airbyte/shared/...ql_processor.py — 68% —

Updated October 13, 2026 00:21 UTC

@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 1 potential issue.

Devin Review

Comment thread airbyte/mcp/_error_handling.py
@aaronsteers
Aaron ("AJ") Steers (aaronsteers) merged commit 5577ff7 into release-candidate/v1 Oct 13, 2026
34 checks passed
@aaronsteers
Aaron ("AJ") Steers (aaronsteers) deleted the devin/1791849842-agent-error-no-arg-masking branch October 13, 2026 00:57
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