Skip to content

fix: Redact config error details in HTTP transport - #783

Merged
dcramer merged 2 commits into
mainfrom
dcramer/config-errors-transport-aware
Feb 6, 2026
Merged

dcramer merged 2 commits into
mainfrom
dcramer/config-errors-transport-aware

Conversation

@dcramer

@dcramer dcramer commented Feb 6, 2026 •

Copy link
Copy Markdown
Member

ConfigurationError, LLMProviderError, and APICallError 4xx currently show
detailed config guidance to all users and are never reported to Sentry. This is
correct for STDIO (the user can fix their own config), but wrong for the hosted
Cloudflare deployment where users can't fix server-side config and operators get
no visibility into these failures.

This adds a transport field to ServerContext ("stdio" | "http") and makes
formatErrorForUser transport-aware. In HTTP mode, config/provider errors are
now logged to Sentry via logIssue() and a generic "Feature Unavailable"
message is returned. In STDIO mode (and when transport is unset), the existing
detailed messages are preserved unchanged.

The transport branching uses a single formatServerConfigError() helper that
takes the detailed message parts and returns the correct response directly for
both transports.

UserInputError always shows details regardless of transport since the user can
fix their own input in both modes.

Fixes #781

dcramer and others added 2 commits February 6, 2026 09:27
ConfigurationError, LLMProviderError, and APICallError 4xx now route
differently based on transport. In STDIO mode, detailed messages are
preserved so users can fix their own config. In HTTP mode (Cloudflare),
errors are logged to Sentry via logIssue() and a generic "Feature
Unavailable" message is returned—users can't fix server-side config,
but operators get visibility through Sentry.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… helper

The `redactForHttpTransport() ??` pattern obscured control flow by
returning undefined to trigger fallthrough. Replace with a single
`formatServerConfigError()` helper that takes the detailed message
parts and returns the correct response directly for both transports.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dcramer
dcramer marked this pull request as ready for review February 6, 2026 18:05
@dcramer
dcramer merged commit a74b685 into main Feb 6, 2026
13 checks passed
@dcramer
dcramer deleted the dcramer/config-errors-transport-aware branch February 6, 2026 18:05
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.

Config errors should only surface details in STDIO mode

1 participant