Skip to content

fix(mcp): surface swallowed workflow error in _workflow_response#1173

Merged
silversurfer562 merged 2 commits into
mainfrom
fix/mcp-surface-swallowed-workflow-error
Jun 30, 2026
Merged

fix(mcp): surface swallowed workflow error in _workflow_response#1173
silversurfer562 merged 2 commits into
mainfrom
fix/mcp-surface-swallowed-workflow-error

Conversation

@silversurfer562

Copy link
Copy Markdown
Member

Problem

When an MCP workflow run errored, _workflow_response returned
{success: false, findings: [], cost: 0} with no error field
indistinguishable from a clean, empty result. SDK-native failures
(e.g. an auth 401) leave result.error as None and carry the
message in result.metadata (is_error + raw_result_text), which
_workflow_response never read. The real reason was swallowed (the
removing-dead-code
"fake-success signature").

Found during a QA/dogfood session: every SDK workflow came back
success:false / cost:0 and the actual cause (Invalid API key) was
only visible via a direct repro.

Fix

Surface the real failure reason as an error field (plus error_type)
whenever a run errored — gated on result.success is False or
metadata["is_error"]. Only str messages are accepted, so a mocked
result never injects a spurious key. The success-path response shape
is unchanged
(strict-equality tests still pass).

Verification

  • 5 new regression tests in test_workflow_response.py
  • Full tests/unit/mcp/ suite green (367 passed; the one failure was a
    live network test unrelated to this change)
  • Non-mocked round-trip: a real failing workflow now returns
    error: "Failed to authenticate. API Error: 401 …" instead of a
    silent empty result

Out of scope (flagged separately)

The SDK adapter can report success: True while is_error: True
(subtype-based logic in agent_sdk_adapter). This PR surfaces the
error regardless of that flag; fixing the mislabel itself is a deeper,
separate change.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
attune-ai.dev Ready Ready Preview, Comment Jun 30, 2026 11:30pm
website Ready Ready Preview, Comment Jun 30, 2026 11:30pm

silversurfer562 and others added 2 commits June 30, 2026 19:27
An errored workflow run returned {success:false, findings:[], cost:0}
with no error field — indistinguishable from a clean empty result.
SDK-native failures (e.g. an auth 401) leave result.error None and
carry the message in metadata (is_error + raw_result_text), which
_workflow_response never read.

Surface result.error / metadata.raw_result_text as an `error` field
(plus error_type) whenever a run errored; only str messages are
accepted so a mocked result never injects a spurious key. Adds 5
regression tests; the success-path response shape is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-29)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@silversurfer562 silversurfer562 merged commit d46e906 into main Jun 30, 2026
50 of 51 checks passed
@silversurfer562 silversurfer562 deleted the fix/mcp-surface-swallowed-workflow-error branch June 30, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant