Skip to content

fix(cloudflare): Add diagnostic logging for empty grantedSkills errors - #758

Merged
dcramer merged 1 commit into
mainfrom
test-issue-756
Jan 31, 2026
Merged

dcramer merged 1 commit into
mainfrom
test-issue-756

Conversation

@dcramer

@dcramer dcramer commented Jan 31, 2026

Copy link
Copy Markdown
Member

Summary

Addresses investigation from #756. When a user's token has an empty or invalid grantedSkills array, the server returns a 400 error but previously had no logging, making it impossible to diagnose root causes.

Changes

  • Add logWarn when grantedSkills validation fails with 400 response
  • Log raw grantedSkills value, type, and array status for diagnosis
  • Add test coverage for empty and invalid grantedSkills scenarios

Investigation Findings

During investigation of #756, we found:

  1. Tests pass with SDK 1.25.3 - No obvious breaking changes when upgrading MCP SDK
  2. Silent 400 error - The empty skills path had no logging, making diagnosis impossible
  3. Version mismatch potential - [email protected] was designed for SDK 1.22.0, could cause subtle issues when pnpm hoists 1.25.x

The logging added here will capture the actual grantedSkills value when this error occurs, helping diagnose whether the issue is:

  • Empty array []
  • Invalid skill names
  • Malformed data (not an array)
  • Type coercion issues

Test plan

  • pnpm run tsc passes
  • pnpm run lint passes
  • pnpm run test passes (new tests verify logging is triggered)
  • CI passes

Refs: #756

🤖 Generated with Claude Code

Addresses investigation from #756. When a user's token has an empty or
invalid grantedSkills array, the server returns a 400 error but
previously had no logging, making it impossible to diagnose root causes.

Changes:
- Add logWarn when grantedSkills validation fails with 400 response
- Log raw grantedSkills value, type, and array status for diagnosis
- Add test coverage for empty and invalid grantedSkills scenarios

This will help diagnose future occurrences of the issue seen after
the MCP SDK upgrade attempt in #752.

Refs: #756

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@dcramer
dcramer merged commit 38355b6 into main Jan 31, 2026
13 checks passed
@dcramer
dcramer deleted the test-issue-756 branch January 31, 2026 01:58
dcramer added a commit that referenced this pull request Jan 31, 2026
This upgrades the MCP SDK from ^1.21.0 to ^1.25.3, bringing in the
latest spec compliance fixes and improvements.

Part of investigation into #756 - the diagnostic logging from PR #758
will help identify if any issues arise from this upgrade.

Note: The agents package remains at 0.2.23 to avoid requiring the
AI SDK v6 upgrade that agents 0.3.x requires.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
dcramer added a commit that referenced this pull request Jan 31, 2026
## Summary
- Upgrades `@modelcontextprotocol/sdk` from `^1.21.0` to `^1.25.3`
- Part of investigation into #756 - retrying the SDK upgrade with
diagnostic logging in place from #758
- All 628 tests pass locally

## Changes
This is a minimal upgrade that only bumps the MCP SDK version. The
`agents` package remains at `0.2.23` to avoid requiring the AI SDK v6
upgrade that `agents` 0.3.x requires.

## Key SDK changes (1.21.0 → 1.25.3)
Notable changes from the
[changelog](https://github.com/modelcontextprotocol/typescript-sdk/blob/main/CHANGELOG.md):
- **v1.25.0**: SPEC COMPLIANCE - Remove loose/passthrough types not
allowed/defined by MCP spec
- Various bug fixes and improvements

## Risk Assessment
- **Low risk** - Tests pass, no API changes affecting our usage
- Diagnostic logging from #758 will capture any runtime issues with
`grantedSkills`

## Test plan
- [x] All unit tests pass (628 tests)
- [x] Type checking passes
- [ ] Deploy to staging and verify MCP connections work
- [ ] Monitor Sentry logs for any 400 errors with empty grantedSkills

Closes #756

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <[email protected]>
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