Skip to content

Improve typed httpx error mapping and adapter guidance#820

Open
jottakka wants to merge 7 commits intomainfrom
feat/error-adapter-httpx-coverage
Open

Improve typed httpx error mapping and adapter guidance#820
jottakka wants to merge 7 commits intomainfrom
feat/error-adapter-httpx-coverage

Conversation

@jottakka
Copy link
Copy Markdown
Contributor

@jottakka jottakka commented Apr 14, 2026

Summary

  • Expand HTTPErrorAdapter to handle typed httpx request/transport exceptions (timeouts, protocol errors, decoding failures, redirect-limit failures) with deterministic UpstreamError mapping instead of falling through to unhandled runtime failures.
  • Strengthen libs/tests/sdk/test_httpx_adapter.py with typed httpx exception coverage and ErrorKind assertions to lock retryability/classification behavior.
  • Add a new .claude skill for building error adapters from project patterns and bump arcade-tdk version to 3.6.2.

Test plan

  • uv run pytest libs/tests/sdk/test_httpx_adapter.py -q
  • uv run pytest libs/tests/sdk/test_graphql_adapter.py libs/tests/sdk/test_graphql_tooling.py libs/tests/sdk/test_google_adapter.py libs/tests/sdk/test_microsoft_adapter.py libs/tests/sdk/test_slack_adapter.py -q
  • make check (ruff/pre-commit pass; mypy reports pre-existing unrelated issues in libs/arcade-cli/arcade_cli/authn.py, libs/arcade-cli/arcade_cli/main.py, and libs/arcade-mcp-server/arcade_mcp_server/convert.py)

Made with Cursor


Note

Medium Risk
Changes how HTTPErrorAdapter and several provider adapters map exceptions to UpstreamError/UpstreamRateLimitError, which can affect retry behavior and surfaced error messaging. Risk is moderated by broad test updates covering new typed exception paths and message/developer_message splits.

Overview
Improves upstream error adaptation to be more deterministic and privacy-safe across providers.

HTTPErrorAdapter now maps typed httpx and requests exceptions (timeouts, transport/protocol/decoding errors, redirect limits, invalid URL/protocol) into consistent UpstreamError statuses/kinds, and HTTP status errors now emit a safe agent-facing message with the raw exception moved to developer_message.

GraphQL, Google, Microsoft Graph, and Slack adapters update their unhandled/fallback paths to avoid leaking str(exc) in message, instead using an “unhandled ” template and storing details in developer_message. Tests are expanded/updated accordingly, the stdio E2E test increases the initialize read timeout for CI, a new .claude skill doc is added for building adapters, and arcade-tdk is bumped to 3.6.2.

Reviewed by Cursor Bugbot for commit 2e445f9. Bugbot is set up for automated code reviews on this repo. Configure here.

Handle typed httpx request and transport exceptions so timeout/protocol/redirect failures map to deterministic upstream errors instead of falling through as unhandled runtime failures. Add focused adapter coverage tests and a new Claude skill that documents how to build error adapters from existing project patterns.

Made-with: Cursor
@jottakka jottakka marked this pull request as draft April 14, 2026 14:30
@jottakka jottakka self-assigned this Apr 14, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
...e-tdk/arcade_tdk/providers/google/error_adapter.py 100.00% <ø> (ø)
...-tdk/arcade_tdk/providers/graphql/error_adapter.py 98.80% <ø> (ø)
...ade-tdk/arcade_tdk/providers/http/error_adapter.py 96.20% <100.00%> (+1.41%) ⬆️
...dk/arcade_tdk/providers/microsoft/error_adapter.py 97.77% <ø> (ø)
...de-tdk/arcade_tdk/providers/slack/error_adapter.py 89.10% <ø> (+6.93%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Remove monorepo-specific file references from the build-error-adapter skill, add the official Arcade error-adapter documentation link, and fold in guidance from the public docs for explicit adapter usage and error-type selection.

Made-with: Cursor
Extend the requests handler to map timeout, transport, protocol, redirect, and generic request exceptions into deterministic UpstreamError classifications with retry semantics, mirroring the typed httpx coverage. Add real requests exception tests to verify status, retryability, kind, and metadata mapping.

Made-with: Cursor
Replace raw HTTP exception text in status-based adapter paths with safe generic user messages and move technical exception detail to developer_message. Update HTTP adapter tests to validate the new privacy split explicitly.

Made-with: Cursor
Limit agent-facing fallback messages to safe, typed summaries for Google, Microsoft, Slack, and GraphQL adapters while preserving raw exception details in developer_message.

Made-with: Cursor
Clarify how to avoid leaking sensitive vendor error details when exception content is uncertain by defaulting to safe agent-facing templates and reserving raw diagnostics for developer_message.

Made-with: Cursor
@jottakka jottakka requested a review from EricGustin April 14, 2026 15:28
@jottakka jottakka marked this pull request as ready for review April 14, 2026 16:34
@EricGustin
Copy link
Copy Markdown
Member

EricGustin commented Apr 14, 2026

@jottakka Could you make this easier to review by providing two side-by-side sets of examples in the PR summary by running an experiment: first, a list of real upstream errors as they appear before these changes, and second, the same errors as they appear after these changes? I'm having difficulty understanding what parts of errors are no longer in the message

Increase the initial stdio initialize-response timeout for integration tests to absorb cold uv environment setup on fresh CI runners and prevent intermittent macOS 3.12 timeouts.

Made-with: Cursor
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2e445f9. Configure here.

**mapper._build_extra_metadata(request_url, request_method),
"error_type": type(exc).__name__,
},
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Identical helper method duplicated across two handler classes

Low Severity

_build_upstream_error is copy-pasted identically between _HTTPXExceptionHandler and _RequestsExceptionHandler. Both have the same signature, same body, and same construction of the UpstreamError. This duplicated logic increases the risk of the two drifting apart if the error construction logic changes later. It could be extracted into a standalone function or placed on BaseHTTPErrorMapper.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2e445f9. Configure here.

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.

2 participants