fix(mcp): platform token requests send Org-Id/Workspace-Id tenancy headers#328
Merged
Merged
Conversation
…aders A deployed agent's auth.type=platform read failed at startup with 'platform token endpoint returned 401: missing org-id header'. The platform verifies a PER-ORG HS256 token, so it needs Org-Id to select the signing secret BEFORE it can validate the bearer — and Workspace-Id to authorize the request against the registry entry (entitlement). The token request sent only the bearer. Now sends both from the standard FORGE_ORG_ID / FORGE_WORKSPACE_ID env the platform injects (omitted when empty), exactly as the admission and remote-session-store clients already do. Test asserts the resolver receives them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Follow-up to #326 (merged). Found live on the FanDuel testbed — a deployed agent's
auth.type=platformread fails at startup:Cause
The platform token endpoint verifies a per-org HS256 token (the workspace
FORGE_PLATFORM_TOKEN), so it needsOrg-Idto select the signing secret before it can validate the bearer — andWorkspace-Idto authorize the request against the registry entry (the entitlement check).platform_token.gosent onlyAuthorization: Bearer, so the request 401s before verification, and the required read server backs off in a degraded loop.Fix
Send
Org-Id+Workspace-Idfrom the standardFORGE_ORG_ID/FORGE_WORKSPACE_IDenv the platform always injects (omitted when empty for standalone/dev) — exactly as the admission client (admission_loader.go) and the remote session-store client (remote_session_store.go) already do. This is the established Forge→platform tenancy-header convention; the platform token client just wasn't following it.Test updated: the fake resolver now rejects a request missing the tenancy headers, so the regression is covered.
Rollout
The fix is in the agent runtime, so a deployed agent picks it up on its next rebuild with a forge runtime that includes this (e.g.
AGENT_FORGE_VERSION=vnextonce the edge build publishes from main). No agent-builder platform-side change needed — its token endpoint was correct (requiringorg-idis right for per-org HS256 verification).🤖 Generated with Claude Code