Repository navigation
Serve staff and public skills through one Recoup connection - #1298
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c3a022654
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const auth = extra.authInfo as McpAuthInfo | undefined; | ||
| if (!auth?.extra.accountId || auth.extra.oauth?.selectedContext) return unavailable; |
There was a problem hiding this comment.
Resolve the account through the MCP auth helper
Whenever recoup_skills is called, this manually trusts extra.authInfo.extra.accountId instead of passing the authentication context through resolveAccountId(), bypassing the repository's centralized MCP account validation and access-control path. Use the required resolver before selecting the authorized skill catalog.
AGENTS.md reference: AGENTS.md:L288-L290
Useful? React with 👍 / 👎.
| file: z | ||
| .string() | ||
| .min(1) | ||
| .max(1024) | ||
| .optional() |
There was a problem hiding this comment.
Reject file requests that omit a skill
When a caller supplies file without skill, the schema accepts the request but the handler enters the catalog-listing branch and silently ignores file; similarly, search-only fields can be supplied alongside skill and are discarded. Model clients can therefore receive a successful but unrelated response instead of a validation error, so encode the listing-versus-loading alternatives and their mutual exclusions in the input schema.
AGENTS.md reference: AGENTS.md:L153-L158
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
All reported issues were addressed across 11 files
Architecture diagram
sequenceDiagram
participant Client as MCP Client (Claude/ChatGPT)
participant Route as /mcp Route
participant Handler as createModernRecoupHandler
participant Skills as getRecoupSkills
participant Tool as recoup_skills Tool
participant Auth as hasRecoupStaffSkills
participant Privy as Privy API
participant Admin as isRecoupAdmin
Client->>Handler: skills/list, skills/get, resources/read
Handler->>Auth: hasRecoupStaffSkills(auth)
alt Signed-in account with accountId and no selectedContext
alt Account in RECOUP_STAFF_SKILL_ACCOUNT_IDS
Auth-->>Handler: true
else Not in explicit grant list
Auth->>Admin: isRecoupAdmin(accountId)
alt Recoup org member
Admin-->>Auth: true
else Not admin
opt OAuth subject present
Auth->>Privy: getVerifiedPrivyEmails(subject)
Privy-->>Auth: verified emails
alt Email domain is @recoupable.com
Auth-->>Handler: true
else Non-recoupable email
Auth-->>Handler: false
end
end
end
end
else Anonymous or selectedContext grant
Auth-->>Handler: false
end
alt Staff access granted
Handler->>Skills: getRecoupSkills("all")
else Public only
Handler->>Skills: getRecoupSkills("public")
end
Skills-->>Handler: Authorized skill catalog
Handler-->>Client: skills list/get/read response
Client->>Tool: recoup_skills({query, skill, file})
Tool->>Auth: hasRecoupStaffSkills(auth)
Auth-->>Tool: staff access boolean
alt Staff access granted
Tool->>Skills: getRecoupSkills("all")
else Public only
Tool->>Skills: getRecoupSkills("public")
end
alt Search mode (no skill name)
Skills-->>Tool: Catalog entries
Tool-->>Client: JSON search results with pagination
else Load skill file
Skills-->>Tool: Skill entry with resource URI
Tool->>Tool: readRecoupSkillFile(uri)
alt Text file
Tool-->>Client: Text content
else Binary file
Tool-->>Client: Base64 resource blob
end
end
Note over Route,Privy: OAuth grant records preserve Privy subject for staff email verification
Note over Tool: Selected Context grants bypass staff skills entitlement
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 9 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 4 files (changes from recent commits).
Confidence score: 3/5
- In
oauthRoute.test.ts, the rate-limit assertion preserves a generic HTTP 500 for native clients instead of an MCP error or retry signal. Update the rate-limit handling to return a client-actionable response.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/mcp/__tests__/oauthRoute.test.ts">
<violation number="1" location="app/mcp/__tests__/oauthRoute.test.ts:431">
P2: This assertion locks native skill requests to HTTP 500 when the shared rate limit rejects, so native clients receive a generic server failure instead of an MCP error or retry signal. Handle the rate-limit exception in the native handler and return the appropriate MCP error response rather than treating this 500 as the expected contract.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| checkFullOAuthRateLimit.mockRejectedValueOnce( | ||
| new Error("Tool rate limit reached; retry in 6 seconds"), | ||
| ); | ||
| expect((await POST(modernRequest("skills/list"))).status).toBe(500); |
There was a problem hiding this comment.
P2: This assertion locks native skill requests to HTTP 500 when the shared rate limit rejects, so native clients receive a generic server failure instead of an MCP error or retry signal. Handle the rate-limit exception in the native handler and return the appropriate MCP error response rather than treating this 500 as the expected contract.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/mcp/__tests__/oauthRoute.test.ts, line 431:
<comment>This assertion locks native skill requests to HTTP 500 when the shared rate limit rejects, so native clients receive a generic server failure instead of an MCP error or retry signal. Handle the rate-limit exception in the native handler and return the appropriate MCP error response rather than treating this 500 as the expected contract.</comment>
<file context>
@@ -417,6 +425,11 @@ it("uses the signed-in identity for native skills and the ChatGPT tool on the sa
+ checkFullOAuthRateLimit.mockRejectedValueOnce(
+ new Error("Tool rate limit reached; retry in 6 seconds"),
+ );
+ expect((await POST(modernRequest("skills/list"))).status).toBe(500);
+
getVerifiedPrivyEmails.mockResolvedValue([]);
</file context>
What changed
Serve the authorized Recoup skills catalog through the existing /mcp connection on sign-in. Native Skills over MCP clients get the authorized catalog. ChatGPT and other tool-based clients can use the read-only recoup_skills tool to search the catalog and load instructions or supporting files.
Customers get the public catalog. Recoup organization members, specific staff skills grantees, and OAuth users with a currently verified @recoupable.com email on the Privy subject recorded on their grant get both catalogs. This entitlement only covers skill content. Selected Context grants keep their existing workspace-only surface.
The ChatGPT plugin page shows the submitted package. Keep that package public. The editor may need to refresh the Recoup connection's tool catalog after the server release so the existing ChatGPT listing can use the new tool.
Verification
Summary by cubic
Serves the authorized Recoup skills catalog on the existing
/mcpconnection, replacing the dedicated staff endpoint. Staff skill access is now granted per signed-in account instead of per connection, and the catalog is built once per audience and shared across MCP transports.Access
RECOUP_STAFF_SKILL_ACCOUNT_IDS, and OAuth users whose recorded Privy subject currently has a verified@recoupable.comemail.skills/list,skills/get, andresources/readcalls.Tool clients
recoup_skillstool lets ChatGPT-style clients search the catalog and load skill instructions or supporting files. It enforces the shared full-OAuth rate limit and account constraints.Written for commit f3662e3. Summary will update on new commits.