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
feat(taskplugin): add version-pinned host foundation - #63
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 7da638d8-5e3d-43e9-963b-0dc1cad9b557
📥 Commits
Reviewing files that changed from the base of the PR and between f00fdde and 33e6a2b.
📒 Files selected for processing: 12
docs/task-plugin-host.md
model/task.go
model/task_plugin_host_test.go
pkg/taskplugin/fetch.go
pkg/taskplugin/fetch_test.go
pkg/taskplugin/host.go
pkg/taskplugin/host_test.go
pkg/taskplugin/package.go
pkg/taskplugin/registry.go
service/task_plugin_host.go
service/task_plugin_host_test.go
types/task_plugin.go
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.
📜 Recent review details
🧰 Additional context used
🪛 golangci-lint (2.14.0)
pkg/taskplugin/fetch_test.go
[error] 141-141: Error return value of left.Close is not checked
(errcheck)
[error] 142-142: Error return value of right.Close is not checked
(errcheck)
pkg/taskplugin/host_test.go
[error] 50-50: variable copy has same name as predeclared identifier
(predeclared)
service/task_plugin_host.go
[error] 43-43: variable copy has same name as predeclared identifier
(predeclared)
🔇 Additional comments: 13
docs/task-plugin-host.md: 1
1-44: LGTM!
pkg/taskplugin/package.go: 1
1-92: LGTM!
pkg/taskplugin/registry.go: 1
162-162: LGTM!
Also applies to: 210-218, 266-268
pkg/taskplugin/host_test.go: 1
1-186: LGTM!
types/task_plugin.go: 1
1-38: LGTM!
pkg/taskplugin/host.go: 1
1-118: LGTM!
Also applies to: 136-232
model/task.go: 1
143-145: LGTM!
service/task_plugin_host.go: 1
1-94: LGTM!
service/task_plugin_host_test.go: 1
1-75: LGTM!
model/task_plugin_host_test.go: 1
1-86: LGTM!
pkg/taskplugin/fetch.go: 2
1-193: LGTM!
Also applies to: 212-219
194-211: 🔒 Security & Privacy
The requested missing-range rejection is not needed.
The named ranges are already rejected by isPrivateIP. pluginDial configures AllowPrivateIp: false and calls ValidateResolvedIP for every resolved address, so these addresses do not pass the dial check. Additional test cases may improve coverage, but the implementation does not omit the listed protections.
pkg/taskplugin/fetch_test.go: 1
1-152: LGTM!
📝 Summary
Summary by CodeRabbit
New Features
Added foundational support for task plugins, including package validation, version-pinned task bindings, and usage reporting.
Added a restricted, read-only fetch capability for plugin tasks, with limits on destinations, request counts, and response size.
Bug Fixes
Improved plugin routing so requests match only plugins that declare the requested model.
Preserved usage-schema details and task-plugin bindings across persistence and reloads.
Documentation
Added bilingual documentation covering task-plugin capabilities, validation boundaries, and current limitations.
Adds an internal task-plugin host that loads and pins package documents, installs and revokes package versions, binds plugins to persisted task identity and usage contracts, resolves historical bindings, and creates validated usage envelopes. Adds a bounded HTTPS fetch scope, with tests and documentation for these paths.
Changes: Task Plugin Host
Layer / File(s)
Summary
Package loading and route selection pkg/taskplugin/package.go, pkg/taskplugin/registry.go, pkg/taskplugin/host_test.go, docs/task-plugin-host.md
Package loading checks document size, UTF-8, format, manifest, and the expected SHA-256 digest. Route matching checks declared models. Manifest cloning preserves usage schema entries.
Host installation and binding lifecycle types/task_plugin.go, pkg/taskplugin/host.go, pkg/taskplugin/host_test.go, docs/task-plugin-host.md
The host installs and revokes package versions and binds actors, models, routes, and usage contracts. Resolution checks persisted package identity, actor identity, revocation, and contract validity. Sessions validate bindings before producing usage envelopes.
Persisted task bindings and usage model/task.go, service/task_plugin_host.go, service/task_plugin_host_test.go, model/task_plugin_host_test.go, docs/task-plugin-host.md
Task private data stores the plugin binding. Service helpers validate and resolve it, then attach a validated usage envelope to task results. Tests cover persistence, usage evidence, and repeated settlement.
The fetch scope restricts requests to approved HTTPS origins and channel authorization to the channel origin. It limits calls and response size, blocks redirects, and validates resolved IPs before dialing.
sequenceDiagram
participant Host as taskplugin.Host
participant Attach as AttachTaskPluginBinding
participant TaskData as model.TaskPrivateData
participant Apply as ApplyTaskPluginUsage
participant Session as taskplugin.Session
participant Result as relaycommon.TaskInfo
Host-->>Attach: Return plugin binding
Attach->>Host: Resolve binding for task actor
Attach->>TaskData: Store binding and mark private data for update
Apply->>Host: Resolve persisted task binding
Host-->>Apply: Return task plugin session
Apply->>Session: Build validated usage envelope
Apply->>Result: Store cloned envelope and usage
Loading
sequenceDiagram
participant Session as taskplugin.Session
participant Scope as taskplugin.FetchScope
participant Resolver as DNS resolver
participant Dialer as configured dialer
participant Origin as approved HTTPS origin
Session->>Scope: Create scoped fetch capability
Scope->>Resolver: Resolve approved target host
Resolver-->>Scope: Return target addresses
Scope->>Dialer: Connect to validated literal IP
Dialer->>Origin: Send bounded GET request
Origin-->>Scope: Return response
Scope-->>Session: Return bounded response body
Loading
Merge Risk:⚪ Minimal · up to 33e6a
This change adds an internal, version-pinned task plugin host with bounded HTTPS fetching. It has no public routes or new billing logic. No concrete current-head defect remains after review, so the change appears ready to merge, subject to the Linux CI run that the description says is still required.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 11 files. (1 skipped:…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly and concisely identifies the main change: adding a version-pinned Task Plugin host foundation.
Description check
The description is directly related to the changeset and covers package pinning, task bindings, usage contracts, fetch restrictions, persistence tests, validation results, and known limits.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 11 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks the package pin, Then hops where approved routes begin. Four fetches bound, each safely small, A task keeps usage through it all. The bunny thumps: “The tests caught all!”
Comment @coderabbitai help to get the list of available commands.
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
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.
为 Task Plugin 增加内部宿主基础,使在途任务固定包版本、摘要、模型映射和宿主用量契约。升级后仍可恢复旧任务;身份或契约变化、撤销及不允许的出站请求均拒绝。
这是宿主基础切片,尚无 JS VM、公开插件路由、管理界面或自动持久化的目录/撤销服务。包格式是 MAX-API 自有封装。按 New API 固定版本的契约边界 做行为核对,未复制上游源码/运行时/依赖,保留既有版权与许可。
验证:相关 Go 定向、scoped vet、JSON wrapper、测试镜像、格式和前端构建通过。MySQL8.0.45 实库双次迁移、schema 审计、结算契约14项通过,1项SQLite专用测试按原条件跳过;开发库使用首次信任的证书固定,未经独立服务器身份认证。
草稿待验:Windows全量后端未通过(relay/service包级超时,以及一次metadata取消确认断言失败)。相同metadata与崩溃恢复场景单独通过,根因仍待验证;不据此声称整套稳定。需当前HEAD的Linux CI及完整审查。PostgreSQL、race、真实JS/渠道、多节点撤销和真实运行进程未验证。
基于已验收的 #62 / cscitech,单独提交本切片。