Skip to content

fix(mcp): pin platform-toolset executor through dispatch#2885

Merged
danielkov merged 3 commits into
mainfrom
daniel/fix-platform-toolset-executor-dispatch
May 20, 2026
Merged

fix(mcp): pin platform-toolset executor through dispatch#2885
danielkov merged 3 commits into
mainfrom
daniel/fix-platform-toolset-executor-dispatch

Conversation

@danielkov
Copy link
Copy Markdown
Contributor

Summary

  • Assistants calling configure_trigger on an existing trigger were getting -32603 internal error on every update. The /platform/mcp/{slug} endpoint matched the assistant-scoped executor from the toolset slice for listing/auth, but then dispatched through the runtime's URN-keyed registry, which had the default (non-assistant) variant registered under the same URN. The default variant requires target_kind/target_ref/target_display in input — fields the assistant schema strips — so the call died with target_ref is required, masked as a generic internal error by the platform call wrapper.
  • Adds PlatformDirectExecutor on PlatformToolCallPlan and pins it to the matched executor in callPlatformToolsetTool. The runtime Service prefers the override before falling back to the URN registry, so the toolset slice becomes the single source of truth for platform-toolset dispatch.
  • Side-effect fix: assistant list_triggers now applies its self-scoping filter again. Both list and configure were silently running as the non-assistant variants under the same wiring bug; list "worked" only because the default variant has no required input and returned every trigger in the project, including ones owned by sibling assistants.
  • Unit tests cover both the override hit path and error propagation through it.

✻ Clauded...

The /platform/mcp/{slug} endpoint matched a toolset entry by name for
listing and feature gating, then dispatched via the URN-keyed registry
on the runtime Service. When a toolset advertises a scoped variant of
a tool that shares its URN with a registry default — assistant-self
configure_trigger vs the non-assistant configure_trigger — the
dispatcher silently swapped to the default, whose input schema demands
fields the scoped tool strips. Result: the assistant's configure call
shipped a valid payload but landed on an executor that rejected it as
"target_ref is required", surfaced as -32603 internal error.

Add a PlatformDirectExecutor hook on PlatformToolCallPlan and have the
platform-toolset endpoint pin it to the already-matched executor. The
runtime prefers the override before falling back to the URN registry,
so the toolset slice becomes the single source of truth for which
executor backs a platform-toolset call.

As a side effect, the assistant list_triggers path now actually
applies its self-scoping filter, since both list and configure were
running as the non-assistant variants under the same wiring bug.
@danielkov danielkov requested a review from a team as a code owner May 16, 2026 19:50
@vercel
Copy link
Copy Markdown

vercel Bot commented May 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gram-docs-redirect Ready Ready Preview, Comment May 20, 2026 1:03pm

Request Review

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 16, 2026

🦋 Changeset detected

Latest commit: 78be5a0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
server Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the preview Spawn a preview environment label May 16, 2026
@speakeasybot
Copy link
Copy Markdown
Collaborator

speakeasybot commented May 16, 2026

🚀 Preview Environment (PR #2885)

Preview URL: https://pr-2885.dev.getgram.ai

Component Status Details Updated (UTC)
⏳ Database Pending Waiting for db-init job 2026-05-20 13:12:44.
✅ Images Available Container images ready 2026-05-20 13:12:42.

Gram Preview Bot

Comments on PlatformDirectExecutor, the runtime override, and the
serve_platform pin were narrating the trigger bug rather than the
mechanism. Reduced to one short rationale each.

Override tests built full AuthContext/ToolDescriptor/ToolCallPlan
literals — existing tests in this file use partial literals. Trimmed
to match, and pulled the shared plan plumbing into overridePlan.
Comment thread server/internal/platformtools/runtime/service.go Outdated
Collapse the two-level `plan.Platform != nil && plan.Platform.Executor != nil`
override check by making non-nil Platform part of the ExecuteTool invariant
alongside Descriptor.
@danielkov danielkov added this pull request to the merge queue May 20, 2026
Merged via the queue into main with commit 5746c4e May 20, 2026
56 of 58 checks passed
@danielkov danielkov deleted the daniel/fix-platform-toolset-executor-dispatch branch May 20, 2026 13:29
@github-actions github-actions Bot locked and limited conversation to collaborators May 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

preview Spawn a preview environment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants