You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8bdf315
Browse filesBrowse the repository at this point in the historyBrowse files
Classify transient WorkOS failures as retryable during MCP auth (#1352)
* Keep MCP sessions alive through transient WorkOS membership-check failures
The /mcp auth chain re-verifies WorkOS org membership on every request. A
transient WorkOS 429/5xx/timeout collapsed to organizationId=null, which
returned Forbidden — and a Forbidden carrying a session id schedules the
session Durable Object for destruction (in-flight executions, paused
approvals, undelivered results). A single WorkOS blip could mass-condemn
every session in a shared-API-key org.
Distinguish a failed membership lookup (retryable Unavailable -> 503 with
Retry-After, session left intact) from a lookup that succeeds with no
membership (genuine Forbidden). Session destruction now requires a positive
determination that access is gone, mirroring the existing reason system
classification on the JWKS/api-key verify paths.
No membership cache is added: a positive TTL cache would re-open the
revocation-liveness gap this check exists to close, and negative caching
would pin a blip as no access; the classification fix removes the
amplification risk without that tradeoff.
* Fail closed on definitive WorkOS denials in the MCP membership check
The previous commit classified every failed membership lookup as transient,
but WorkOS also answers with deterministic 4xx denials (401 revoked/invalid
API key, 403, 404 deleted org) that the SDK throws as typed exceptions and
the service boundary flattened into a status-less WorkOSError. Those were
being mapped to a retryable 503, preserving sessions indefinitely for a
revoked customer.
Thread the SDK exception's HTTP status onto WorkOSError at the service
boundary (same extraction as the workos-vault plugin) and split the failure
branch: 401/403/404 fail closed as Forbidden (session condemned), while
429/5xx/timeout/network stay retryable 503s.
Also: render Retry-After on the shared envelope's Unavailable branch (the
cloud agent-handler and envelope renderers had drifted), and document that
the transient 503 and terminated-session 404 intentionally share JSON-RPC
code -32001 with HTTP status as the discriminator.
0 commit comments