Skip to content

feat(server): default exposeErrorDetails to true outside NODE_ENV=production#735

Merged
bokelley merged 1 commit into
mainfrom
bokelley/expose-handler-errors-in-dev
Apr 21, 2026
Merged

feat(server): default exposeErrorDetails to true outside NODE_ENV=production#735
bokelley merged 1 commit into
mainfrom
bokelley/expose-handler-errors-in-dev

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Handler throws now emit the actual cause + handler name in dev/test/CI, so matrix runs and local dev stop losing hours on opaque 'encountered an internal error'. Production behavior unchanged — set NODE_ENV=production (or pass exposeErrorDetails: false) to get the old redacted behavior.

What changes

createAdcpServer({ exposeErrorDetails }) default:

  • Before: false (always redact).
  • After: process.env.NODE_ENV !== 'production' (redact only in prod).

logger.error('Handler failed', ...) now includes err.stack and handler key.

When exposeErrorDetails is on, the SERVICE_UNAVAILABLE message text is also upgraded from Tool X encountered an internal error to Tool X handler threw: <cause message> so the failure is readable at the call site — not just in server logs.

Why now

Matrix v6/v7 had 20–26 SERVICE_UNAVAILABLE rows per run with zero diagnostic. Each one was a handler throw, opaque. Validation default-on (#732) can't help — it only fires when the handler returns successfully. The fix has to be at the catch site.

Before (v7)

SERVICE_UNAVAILABLE: Tool acquire_rights encountered an internal error

After

SERVICE_UNAVAILABLE: Tool acquire_rights handler threw: Cannot find module '@adcp/client/foo'
details: { reason: "Cannot find module ...", handler: "acquireRights" }

Test plan

  • Existing test returns SERVICE_UNAVAILABLE without leaking internals updated to pass exposeErrorDetails: false explicitly (documents the production-prod path).
  • Full suite: 4968 pass / 0 fail.
  • Typecheck clean.
  • Matrix v8 after merge — expect opaque SU lines to gain specific causes, unlocking the next round of skill fixes.

🤖 Generated with Claude Code

@bokelley bokelley force-pushed the bokelley/expose-handler-errors-in-dev branch from 3cff53c to a60aa70 Compare April 21, 2026 21:11
@bokelley bokelley merged commit 0cc20df into main Apr 21, 2026
14 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 21, 2026
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.

1 participant