-
Notifications
You must be signed in to change notification settings - Fork 457
feat: add Volcengine Ark Agent Plan provider #615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,7 @@ const PROVIDER_ICON_ALIASES: Record<string, string> = { | |
| alibaba: "alibaba-color.svg", | ||
| "alibaba-token-plan": "alibaba-color.svg", | ||
| "alibaba-token-plan-intl": "alibaba-color.svg", | ||
| "volcengine-ark-agent-plan": "https://portal.volccdn.com/obj/volcfe/misc/favicon.png", | ||
| "qwen-cloud": "qwen-portal-color.svg", | ||
| "vercel-ai-gateway": "vercel-ai-gateway-color.svg", | ||
| vllm: "vllm-color.svg", | ||
|
|
@@ -77,6 +78,7 @@ const PROVIDER_DISPLAY_NAMES: Record<string, string> = { | |
| alibaba: "Alibaba Coding Plan", | ||
| "alibaba-token-plan": "Alibaba Token Plan", | ||
| "alibaba-token-plan-intl": "Alibaba Token Plan (Intl)", | ||
| "volcengine-ark-agent-plan": "Volcengine Ark Agent Plan", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Localize the provider display name. Line 81 adds a user-visible provider label directly to the source map, so it cannot be translated. Add a locale key and resolve the label through the dashboard i18n layer. As per path instructions, “user-visible strings go through the i18n locale files rather than hardcoded text.” 🤖 Prompt for AI AgentsSource: Path instructions |
||
| kimi: "Kimi", | ||
| "kimi-code": "Kimi", | ||
| moonshot: "Moonshot", | ||
|
|
@@ -105,6 +107,7 @@ function providerIconAlias(provider: string): string | undefined { | |
| export function providerIconSrc(provider: string, _hints?: ProviderIconHints): string | undefined { | ||
| void _hints; | ||
| const icon = providerIconAlias(provider); | ||
| if (icon?.startsWith("http://") || icon?.startsWith("https://")) return icon; | ||
| return icon ? `/provider-icons/${icon}` : undefined; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 302
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 7064
🌐 Web query:
GitHub Actions permissions issues write pull-requests write labels on pull request number Resource not accessible by integration x-accepted-github-permissions💡 Result:
The error "Resource not accessible by integration" in GitHub Actions indicates that the
GITHUB_TOKENused by your workflow lacks the necessary permissions to perform the requested API operation [1][2][3]. To resolve this when managing labels or pull requests, ensure your workflow explicitly defines the required permissions in the YAML file [4][5][6]. ### 1. Required Permissions GitHub processes labels via the Issues API [5]. To add or manage labels, you typically need bothpull-requestsandissuespermissions [7][5][8]:yaml permissions: contents: read pull-requests: write issues: write*pull-requests: write: Necessary for actions that modify the pull request itself [7][8]. *issues: write: Necessary specifically for creating new labels or when the action interacts with the labels resource [7][5][8]. ### 2. Common Causes * Forked Repositories: When a workflow is triggered by a pull request from a fork, theGITHUB_TOKENis granted read-only access by default for security reasons [3][7][8]. * Solution: Switch the event trigger frompull_requesttopull_request_target[7][5][8]. This runs the workflow in the context of the base repository, granting it higher permissions [7][8]. Note: Ensure your workflow is secure, as this grants access to repository secrets [8]. * Missing Explicit Permissions: Depending on your repository settings, the defaultGITHUB_TOKENmight be restricted. Explicitly declaring thepermissionsblock (as shown above) overrides these defaults [4][5]. ### 3. Understanding x-accepted-github-permissions Thex-accepted-github-permissionsheader is a diagnostic tool provided by the GitHub API [9][10]. If you are troubleshooting an API call directly (or through a custom script), this header will be present in the API response [9][11]. It explicitly lists the permissions required to successfully call that specific endpoint [9][12]. You can use this to verify exactly which scope is missing [9]. ### Summary of Best Practices * Grant Least Privilege: Only add the specific permissions needed (e.g.,pull-requests: write,issues: write) rather than granting full repository read/write access [6]. * Verify Syntax: Always use the hyphenated formpull-requestsin your YAMLpermissionsblock;pull_requests(with an underscore) is invalid syntax [13]. * Check Token Source: If using a custom GitHub App or PAT, verify that the token itself has been granted the necessary permissions in its configuration settings [9][10][11].Citations:
pull_requests:writepermission, but should bepull-requests:writegithub/docs#32167🌐 Web query:
site:docs.github.com REST API add labels to an issue required permissions pull_requests issues GitHub Apps💡 Result:
To add labels to an issue or pull request via the GitHub REST API (using the POST /repos/{owner}/{repo}/issues/{issue_number}/labels endpoint), a GitHub App requires write-level repository permissions [1][2]. Specifically, the GitHub App must be granted either of the following repository permissions [2]: 1. Issues: Write [2] 2. Pull requests: Write [2] If the GitHub App is granted write access for either "Issues" or "Pull requests," it will have the necessary authorization to add labels to an issue or pull request [2]. If these permissions are not present, any attempt to add labels will be silently dropped or rejected [3][2].
Citations:
🌐 Web query:
docs.github.com add labels to an issue pull request permissions issues write pull requests write💡 Result:
To add or manage labels on GitHub issues and pull requests, the required permissions depend on the action being performed and the context (UI interaction versus automation via API/GitHub Actions). For manual operations in the GitHub web interface: - Applying or dismissing existing labels requires triage access to the repository [1]. - Creating, editing, or deleting labels requires write access to the repository [1]. For automation using GitHub Actions or the REST API: - GitHub internally treats pull requests as issues [2][3]. Consequently, API endpoints for managing labels are grouped under the Issues API [2]. - To modify labels in a GitHub Actions workflow, the GITHUB_TOKEN must have explicit write permissions [3]. It is recommended to include the following in your workflow file [3]: permissions: issues: write pull-requests: write Note that while pull-requests: write is often sufficient for applying existing labels to pull requests, adding labels that do not already exist in the repository may require issues: write permissions [3]. When defining these permissions in YAML, ensure you use a hyphen (pull-requests) rather than an underscore, as the latter is a common syntax error [4].
Citations:
pull_requests:writepermission, but should bepull-requests:writegithub/docs#32167🌐 Web query:
site:docs.github.com/en/rest/issues/labels "Add labels to an issue" permissions "Issues: write" "Pull requests: write"💡 Result:
To add labels to a GitHub issue, you must have write access to the repository [1]. While specific permission levels can vary based on repository settings, the write access level generally encompasses the ability to manage issue metadata, such as labels [1]. Users with write access can utilize the GitHub REST API to add labels to an issue using the following endpoint: POST /repos/{owner}/{repo}/issues/{issue_number}/labels When using this endpoint, you can provide the labels as an array in the request body [1]. If you have write permissions, you may also replace existing labels or manage them directly through the GitHub web interface, provided your account and repository settings allow for such modifications [1].
Citations:
🌐 Web query:
site:docs.github.com/en/rest/issues/labels "required permissions" "pull requests" "issues"💡 Result:
On GitHub, pull requests are treated as a type of issue, meaning that shared actions for both features, such as managing assignees, labels, and milestones, are handled through common endpoints [1]. To perform actions on issues and pull requests, users typically require write access to the repository [1]. Specific API requests for these features require identifying the repository owner, the repository name, and the specific issue or pull request number [1]. Information regarding specific permission levels for GitLab was not retrieved.
Citations:
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 157
🌐 Web query:
"POST /repos/{owner}/{repo}/issues/{issue_number}/labels" "pull-requests: write" issues write GitHub App permissions💡 Result:
To use the GitHub REST API endpoint POST /repos/{owner}/{repo}/issues/{issue_number}/labels, a GitHub App must be granted the "Issues" repository permission with "write" access [1][2][3]. While this endpoint is used to manage labels on both issues and pull requests, the "Issues: write" permission is the mandatory requirement for this specific API call [4]. In the context of GitHub Apps, pull requests are considered a subset of issues, and the "Issues: write" permission covers label management for both [4]. Even if you are performing this operation on a pull request, "Pull requests: write" alone is insufficient; you must explicitly grant "Issues: write" [4]. Summary of requirements: - Permission name: Issues - Access level: Write - Scope: Repository If your GitHub App lacks the "Issues: write" permission, attempts to add labels via this endpoint will result in a 403 Forbidden error [4].
Citations:
🌐 Web query:
site:docs.github.com/en/rest/issues/labels "GitHub App" "write" "issues" "pull requests"💡 Result:
To enable a GitHub App to create or manage issues and pull requests, you must configure the appropriate repository permissions in the app settings. For issues, GitHub Apps require the Issues permission, which should be set to Read and write access [1]. This allows the app to perform actions such as creating issues, managing labels, and updating issue details via the REST API [1]. For pull requests, GitHub Apps require the Pull requests permission, also set to Read and write access. Note that GitHub treats pull requests as a type of issue, so shared actions like managing labels, assignees, and milestones for pull requests are handled through the Issues endpoints of the REST API [1]. When performing these actions, you use the REST API endpoints associated with the repository. For example, to add labels to an issue or pull request, you would use the following request [1]: POST /repos/{owner}/{repo}/issues/{issue_number}/labels Ensure your GitHub App has been granted these specific permissions during installation on the target repository.
Citations:
Drop the extra PR write scope
.github/workflows/pr-labeler.yml#L20-L27only needspulls.getplusissues.*label calls, sopull-requests: writeis broader than necessary here. Keepissues: write, downgradepull-requeststoread, and update.github/scripts/pr-labeler.test.cjs#L169-L177to assert the read-only scope.🧰 Tools
🪛 zizmor (1.26.1)
[error] 27-27: overly broad permissions (excessive-permissions): pull-requests: write is overly broad at the workflow level
(excessive-permissions)
[warning] 27-27: permissions without explanatory comments (undocumented-permissions): needs an explanatory comment
(undocumented-permissions)
📍 Affects 2 files
.github/workflows/pr-labeler.yml#L20-L27(this comment).github/scripts/pr-labeler.test.cjs#L169-L177🤖 Prompt for AI Agents
Sources: Path instructions, Linters/SAST tools