Repository navigation
Conversation
go-sdk's AddResource panics when the resource URI fails url.Parse. Since syncSessionResources can run on the live session goroutine, a bad URI in a per-session overlay would crash the session. Register each resource via addSessionResource, which recovers, logs and skips the offending resource, mirroring addSessionTool and addSessionResourceTemplate. Also correct the sibling comments that claimed AddResource cannot panic. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…vering go-sdk's AddResource only panics when url.Parse fails, so run the same check first and skip the resource, avoiding the recover/defer helper. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
reyortiz3
enabled auto-merge (squash)
October 16, 2026 20:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AddResourcepanics when the resource URI failsurl.Parse.syncSessionResourcescan run on the live session goroutine, so a malformed URI in a per-session overlay could crash the session.url.Parsecheck first and log/skip the offending resource, so norecoveris needed.AddResourcedoesn't panic (the likely cause of this gap).Follow-up requested in review of stacklok/toolhive-GHSA-r928-c58c-5ppq#1.
Test plan
TestSyncSessionResources_UnparseableURIDoesNotPanicgo test -race ./mcpcompat/server/task lintNot covered:
registerGlobalFeaturesstill callssrv.AddResourcewithout a check.🤖 Generated with Claude Code