Skip to content

docs(rfc): propose Source plugins with central collection targets pulled by runners - #2617

Merged
hidb4ai merged 9 commits into
oceanbase:masterfrom
jasper-yl:rfc/source-plugins
Nov 17, 2026
Merged

hidb4ai merged 9 commits into
oceanbase:masterfrom
jasper-yl:rfc/source-plugins

Conversation

@jasper-yl

@jasper-yl jasper-yl commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

This PR proposes a follow-up RFC to RFC #2549 (plugin interfaces), which leaves standalone Source plugins and collection to a separate proposal. It replaces the contracts and management mechanisms of the Source plugin framework RFC #2012; the implementation of RFC #2549 is in #2616. It builds on the plugin host processes of RFC #2549 and the plugin routes of RFC #2579.

Rationale for this change

The old Source plugin framework runs a separate management service with its own SQLite, one Runtime process per plugin instance, and poll / reply reverse channels between the service and Server. Embodied and edge deployments still need what it offers: operators configure collection for a fleet of devices from the central Server, and devices behind NAT only connect out. This proposal keeps that capability with less machinery: targets live in two central tables, and runners pull them.

What changes are included in this PR?

New RFC docs/{en,zh}/rfcs/2617-source-plugins.md (Chinese first, English translation in sync):

  • Source plugins: a SourcePlugin declaration with definitions, and for collection collect, a TargetSpec (parameter model plus a declarative identity expression), and setup. The plugin name is the capability name.
  • Runners: the Server's built-in server runner and powercontext source-agent on devices, named after the credential's subject. Runners sync on a schedule: they report their plugins with parameter schemas and identity expressions, and fetch every target assigned to them across Scopes. The Server never connects to devices.
  • Central targets: pc_source_collect_targets (Scope, runner, capability, normalized key, parameters, enabled, and runner-written status columns) and pc_source_runners (capabilities and last_seen_at). Adding a target validates its parameters and deduplicates by the identity expression immediately. User writes and runner writes touch separate columns.
  • Results: Sources go through POST /v1/source-observations, then the checkpoint through POST /v1/connector-checkpoints/commit against its old value, carrying the target's status. Failures repeat the same Sources, which the Server deduplicates.
  • Large content: inline, the plugin's object storage, or the same Source plugin on the central Server receiving files through plugin routes and reading them in its Projections; devices call their central routes through ctx.center.
  • Migration and mapping: one new migration revision adds the two tables and drops pc_source_write_plugins only when it is empty; the management service, instance registration, reverse channels, and source load are removed, with a table mapping each old mechanism to its replacement.

A design demo on the author's fork (https://github.com/jasper-yl/powercontext/tree/feat/source-plugins-demo, not for merging) runs a simulated robot camera through a real Server: a device runner reports its plugin and parameter schema on sync; targets added centrally are validated and deduplicated by the identity expression (same parameters return the existing target, a normalized duplicate with other parameters conflicts, invalid parameters and unknown runners return 422); the runner collects, submits Sources, and advances the checkpoint; a lost connection before the checkpoint commit leaves it unchanged and the retry repeats the same Sources without duplicates; status and failures are reported per target; disabled targets leave the sync; a target in a new Scope is collected on the next sync without a restart. The demo keeps its tables in a separate SQLite file and does not cover the Server runner, large files through a central plugin, the migration, or the Dashboard form.

Are there any user-facing changes?

This PR changes documentation only. The proposed design replaces the /v1/source-management/* instance, configuration, channel, and write-plugin APIs with runner and target APIs, keeps the MCP tools pc_source_add, pc_source_status, and pc_source_target_set_enabled, and adds pc_source_runners, pc_source_target_delete, and powercontext source-agent.

How was this change tested?

  • uv run prek run --files docs/en/rfcs/2617-source-plugins.md docs/zh/rfcs/2617-source-plugins.md
  • Checked that both locales have matching sections, tables, and code blocks.
  • Ran the design demo's acceptance scenario tests/e2e/test_source_collection_demo.py on the fork branch against a real Server process.

AI usage statement

Drafted with Claude Code (Claude Opus 5.5) under the author's direction and review; the design decisions were made in discussion with the author.

🤖 Generated with Claude Code

…led by runners

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jasper-yl added a commit to jasper-yl/powercontext that referenced this pull request Nov 13, 2026
RFC oceanbase#2549 renamed the factory to setup and requires render_artifact; standalone
Source plugins moved to RFC oceanbase#2617, so the examples declare routes and pages on
an Artifact plugin that brings its own Source type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Zxf-xufeng Zxf-xufeng left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Design review at d00cbb05. This PR contains an RFC, so the findings below concern the proposed contract rather than a merged collector implementation. I have not run the fork demo.

[P1] Fence collection commits against target configuration changes and deletion

The RFC allows target parameters to change, but remote result submission only compares the previous checkpoint. That checkpoint need not change when the parameters change. A runner can therefore collect using the old parameters and subsequently advance the checkpoint after the target has been edited, causing the new configuration to resume at an incompatible position and potentially skip data.

Deletion has a related gap. The existing checkpoint repository permits insertion when the checkpoint is missing and the expected value is None. A delayed first collection can therefore recreate a checkpoint after its target has been deleted unless the target is checked as part of the commit.

Please specify that a checkpoint/status commit validates the target's existence, runner ownership, enabled state, and configuration revision or digest in the same transaction as the update. Define what happens to the checkpoint when parameters change the collection identity: reject the in-place change and require a new target, or explicitly reset it with stale-attempt protection. Also state the allowed behavior for Sources already accepted by the separate observations request; checkpoint validation alone cannot undo those writes.

Acceptance should cover parameter edits, disable/delete, and delayed commits, including a first attempt with an expected None checkpoint. This can use the proposed target table rather than introducing another table.

[P2] Persist the authenticated owner of a custom runner name

The runner section permits --name, including multiple devices sharing a credential. The API section defines ownership as either a matching authenticated subject or the subject recorded when the runner was registered. However, the proposed pc_source_runners schema contains no owner-principal field or equivalent binding.

Please define and persist the authenticated owner for custom runner names, including name uniqueness/conflicts and the rule that an ordinary sync cannot replace that owner. Otherwise the specified authorization cannot reliably distinguish the owner from another principal attempting to sync under the same name and overwrite capabilities or retrieve assigned targets. Alternatively, restrict the initial implementation to names derived from the authenticated principal.

Acceptance should verify that another principal cannot claim or sync an existing custom runner name, while the original owner can reconnect.

Reference: RFC: runners, result submission, persistence, and API authorization.

…rsion

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed a7c1224b (RFC only). The two contract gaps in the existing review remain: checkpoint/status commits are not fenced against target edits or deletion, and custom runner names have no persisted authenticated owner. The version-compatibility update does not address either.

I checked the reused checkpoint store with SQLite: removing a checkpoint and then submitting a delayed first commit with expected=None recreates it. Please specify transactional target/configuration validation and durable runner ownership in both locales before accepting the design. This verifies the existing persistence behavior; I have not run the fork demo or a proposed runner implementation.

…per-target collection failures

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread docs/en/rfcs/2617-source-plugins.md Outdated
| `POST /v1/source-observations` | Existing | Requests from a runner gain the plugin name and version, checked against the compatible range |
| `POST /v1/connector-checkpoints/commit` | Existing | The request gains an optional `status`: latest attempt, success, error category, and message; requests from a runner gain the plugin name and version, checked against the compatible range |

"The runner itself" means the authenticated subject equals the runner name, or the subject recorded when the runner first

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Authorize registered runners only through their bound subject

If subject fleet-service first registers runner robot-7 using --name, this OR rule also authorizes the distinct subject robot-7 to retrieve its targets and checkpoints, violating section 3's first-sync ownership binding. Require the persisted bound subject for subsequent syncs, document that binding in runner persistence, and correct both locales.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 37a2838. The "subject equals the runner name" alternative is gone in both locales: "the runner itself" now means the authenticated subject is the runner record's registering subject, with the same type and ID. Registration is its own step (POST /v1/source-runners), a sync never creates a runner record, and pc_source_runners persists the registering subject (principal_type, principal_id).

hidb4ai pushed a commit that referenced this pull request Nov 14, 2026
* docs(rfc): propose plugin hot reload and plugin-defined APIs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(rfc): number plugin hot reload RFC as 2579

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(rfc): import plugins from version snapshots and mount routes as a group

Pin every call to a read-only snapshot named by the content digest so a
draining host never mixes versions and a failed update keeps the old one,
detect changes by content instead of size and mtime, mount plugin routes
under their own group with per-route Scope authorization, let plugins
create Scopes with core's existing permission, and state page isolation
as session isolation, stopping forwarding once the iframe navigates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(rfc): keep the plugin reload RFC at the contract level

Move scan, host replacement, and hosting page flows and the literal CSP header to the implementation design.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(rfc): let plugin routes opt in as MCP tools

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(rfc): let plugins upgrade their own data through a load hook

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(rfc): confirm write access in handlers, declare route body limits, and record API changes as Sources

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(rfc): name the factory setup and show routes on an Artifact plugin

RFC #2549 renamed the factory to setup and requires render_artifact; standalone
Source plugins moved to RFC #2617, so the examples declare routes and pages on
an Artifact plugin that brings its own Source type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(rfc): run upgrade on every role, keep it small, and name MCP tools without collisions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
jasper-yl added a commit to jasper-yl/powercontext that referenced this pull request Nov 14, 2026
…r and device runners

Implements RFC oceanbase#2617 and replaces the previous Source plugin framework.

- `SourcePlugin` (version, min_compatible_version, definitions, collect, target, setup,
  api, pages, upgrade) loads from the plugin directory alongside Artifact plugins. A
  plugin with only definitions extends the Source write API; one with collect runs
  through runners.
- Revision v1_5_0_006 adds pc_source_runners and pc_source_collect_targets and drops
  pc_source_write_plugins, refusing the upgrade while it still lists plugins. Portable
  bundles carry runners (name and bound subject) and targets without runner status.
- Target API and MCP tools: pc_source_runners, pc_source_add, pc_source_status,
  pc_source_target_set_enabled, pc_source_target_delete; runners sync through
  POST /v1/source-runners/{runner}/sync. Targets of the server runner need
  server.admin; identity parameters are declared, normalized, and immutable.
- The server runner collects in Supervisor Workers and commits Sources, checkpoints,
  and target status in one transaction; CollectResult.fail reports one target.
- `powercontext source-agent` collects on devices: it submits Sources and then
  checkpoints with status. Runner requests carry the plugin version, accepted within
  the Server plugin's compatible range; the Server's plugin resolves and projects them.
- Removed: /v1/source-management/*, `powercontext source load`, the source management
  settings, and the old examples, which are rewritten as Source plugins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jasper-yl added a commit to jasper-yl/powercontext that referenced this pull request Nov 14, 2026
…r and device runners

Implements RFC oceanbase#2617 and replaces the previous Source plugin framework.

- `SourcePlugin` (version, min_compatible_version, definitions, collect, target, setup,
  api, pages, upgrade) loads from the plugin directory alongside Artifact plugins. A
  plugin with only definitions extends the Source write API; one with collect runs
  through runners.
- Revision v1_5_0_006 adds pc_source_runners and pc_source_collect_targets and drops
  pc_source_write_plugins, refusing the upgrade while it still lists plugins. Portable
  bundles carry runners (name and bound subject) and targets without runner status.
- Target API and MCP tools: pc_source_runners, pc_source_add, pc_source_status,
  pc_source_target_set_enabled, pc_source_target_delete; runners sync through
  POST /v1/source-runners/{runner}/sync. Targets of the server runner need
  server.admin; identity parameters are declared, normalized, and immutable.
- The server runner collects in Supervisor Workers and commits Sources, checkpoints,
  and target status in one transaction; CollectResult.fail reports one target.
- `powercontext source-agent` collects on devices: it submits Sources and then
  checkpoints with status. Runner requests carry the plugin version, accepted within
  the Server plugin's compatible range; the Server's plugin resolves and projects them.
- Removed: /v1/source-management/*, `powercontext source load`, the source management
  settings, and the old examples, which are rewritten as Source plugins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ides

- A runner's name is unique across the deployment and decided by the central Server:
  a suggested name with a registration ID kept in a local state file, or a fixed name for
  stateless deployments; syncs accept only registered names of the same credential subject.
- Runners gain an editable display name; targets go only to registered runners and can be
  transferred, with the same permission checks as creating them on the destination.
- Deleting a runner that still has targets is a conflict; known limits of credential-based
  identity are listed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 02d940a7 (RFC only). Making identity fields immutable addresses the external-object switch, but two existing issues remain:

  • The runner ownership thread still applies: the API's subject-equals-name alternative contradicts the new first-sync binding rule. Subsequent syncs must use the persisted owner, and that binding must be included in the persistence contract in both locales.
  • The deletion case in the checkpoint review remains unaddressed. A first collection can start with expected=None, have its target deleted, then recreate the missing checkpoint through the reused commit path. Immutable identity fields do not prevent this. Require target existence, ownership, and applicable target state to be checked atomically with the checkpoint/status commit, and define the treatment of Sources already accepted by the separate request.

The checkpoint implementation is unchanged from the prior SQLite probe. These are remaining RFC contract issues; I have not run the fork demo or a proposed runner implementation.

…t owners delete their runners

- Targets carry a configuration version; a checkpoint and status commit is validated in its own
  transaction against the target's existence, enabled state, owning runner, and configuration
  version, whichever optional fields the request carries. Sources accepted before a refused
  commit are kept and deduplicated.
- The subject that registered a runner can delete its own records.
- Operations notes cover a device moving to another credential subject and upgrading
  deployments that used the previous Source plugin framework.

Co-Authored-By: Claude <noreply@anthropic.com>
@jasper-yl

Copy link
Copy Markdown
Contributor Author

Thanks for the re-review. Both remaining contract gaps are addressed in 37a283894 and 661abe583, in both locales.

Runner ownership. Runners now register before they sync (POST /v1/source-runners), and the central Server decides the name, which is unique across the deployment. pc_source_runners persists the registering subject as principal_type and principal_id; every later sync and commit is authorized against that persisted subject, and the "subject equals the runner name" alternative is removed. Targets can be assigned only to registered runners.

Fencing checkpoint commits. Guide section 5 and the interface table now specify:

  • Each target has a configuration version (config_version), increased when its parameters change, when it is enabled or disabled, when it is transferred, and when its checkpoint is cleared. A sync delivers it, and a runner commits with the version it collected under.
  • The checkpoint and the target status are written in one transaction, which first validates that the target exists, is enabled, belongs to the submitting runner, and has the given configuration version. Any mismatch refuses the whole commit. This covers the deletion case from the SQLite probe: a late first commit with expected=None finds no target and is refused, so the checkpoint is not recreated.
  • Whether a commit belongs to a collection target is decided by the central Server from (scope_id, target_id), whichever optional fields the request carries; only the owning runner can commit such a checkpoint.
  • Sources already accepted by the separate request are kept when the commit is refused: they are real observations with plugin-defined identity, and collecting the same object again deduplicates them.

Also new in this revision: targets can be transferred to another registered runner under the same permission checks as creating them there; the subject that registered a runner can delete its own records; and reference section 6 states how deployments that used the previous Source plugin framework upgrade, including that a database with pc_source_write_plugins records has no supported in-place path.

The implementation in #2639 does not follow this revision yet; I will update it next and reply on the three threads there.

…s reserved connector version

Co-Authored-By: Claude <noreply@anthropic.com>
jasper-yl added a commit to jasper-yl/powercontext that referenced this pull request Nov 16, 2026
…r and registered device runners

Implements RFC oceanbase#2617.

- SourcePlugin loads from the plugin directory like Artifact plugins. A plugin with only
  definitions extends the Source write API; target declares a parameter model and identity
  parameters; collect runs on the Server's own runner or on device runners.
- Revision v1_5_0_006 adds pc_source_runners and pc_source_collect_targets and drops the
  empty pc_source_write_plugins. A database that still lists write plugins is refused and
  has no supported in-place upgrade path.
- Runners register before they sync. The Server decides the name, unique across the
  deployment: a suggested name with a registration ID that makes the request repeatable for
  its principal, or a fixed name for deployments without persistent state. A runner is bound
  to the type and identifier of the principal that registered it; only that principal syncs
  and commits under its name, and may delete the record once it has no targets.
- Targets go only to registered runners, carry a configuration version, and can be
  transferred to another runner with or without their checkpoint.
- A checkpoint commit for a collection target is decided from what is stored, whichever
  optional fields the request carries: the target's existence, enabled state, runner, and
  configuration version are checked in the transaction that writes the checkpoint and the
  status. A late commit for a deleted target is refused instead of recreating its checkpoint.
- powercontext source-agent registers, keeps its name in a state directory unless --name is
  given, sends the configuration version it collected under, and keeps collecting when one
  plugin or target fails. It reports only error codes and exception type names.
- The Server's runner records a collection that failed as a whole on every target of the
  call and still raises the original error.
- A plugin's declared scopes also bound what runners submit for it and where its targets go.
- The previous Source plugin framework is removed: /v1/source-management/*, source load, its
  settings, and powercontext.source_management.

Co-Authored-By: Claude <noreply@anthropic.com>

@frf12 frf12 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked the current English and Chinese RFCs at b5f82df. The runner ownership and checkpoint/target-state contracts address the previous concerns. I have no remaining blocking contract finding; the two inline notes are wording consistency updates in both locales.

Comment thread docs/en/rfcs/2617-source-plugins.md Outdated
provides only `definitions` extends the Source types; a plugin that declares `collect` reads from external systems per
collection target.
- **Collection runtimes (runners)**: the processes that run `collect`. The central Server has a built-in runner named
`server`; a process started on a device with `powercontext source-agent` is also a runner, named after the subject of its

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking wording consistency: this overview still says the device runner is named after the credential subject, while section 3 now defines Server-assigned registration names or an explicitly registered fixed name, with ownership stored separately as the principal type and ID. Could the overview in both locales describe that current registration rule as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 60a5552, in both locales: the overview now says a device runner registers before it syncs, that the Server assigns its name from a suggestion or registers the fixed name it asks for, and that the registering principal (type and identifier) is recorded as the owner.

Comment thread docs/en/rfcs/2617-source-plugins.md Outdated
keeps declaring the old definitions (RFC #2579). The only thing a device reads from the central Server is target
parameters. They are filled in under the central version's format and may carry fields an older device does not know, so
device-side parameter models must ignore unknown fields (Pydantic's default; do not set `extra="forbid"`). When a new
parameter must take effect on every device, raise `min_compatible_version`. Checkpoints are written and read by the same

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking wording consistency: the statement that a checkpoint is always read by the same device and never crosses devices is stronger than the new target-transfer contract, which preserves the checkpoint by default and can transfer between device and Server runners. Could both locales explain that the assigned runner normally reads it, and a transfer can retain it when the destination can interpret it (otherwise reset_checkpoint is available)? No change to the transfer design is requested.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 60a5552, in both locales: a checkpoint is normally written and read by the runner its target is assigned to; a transfer keeps it by default, also between a device runner and the server runner, when the destination's plugin version can read it, and reset_checkpoint is there for when it cannot. The transfer design is unchanged.

…ts across a target transfer

Co-Authored-By: Claude <noreply@anthropic.com>
@AlexStocks AlexStocks added the 1.6.0 v1.6.0 release tracking label Nov 17, 2026

@frf12 frf12 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked the English and Chinese RFCs at 60a55521e8cafa15929bba23b299af976cabb92a. The runner registration/ownership wording and checkpoint transfer guidance now agree with the detailed contract in both locales. The previously discussed target-state validation and late-commit behavior are specified. No remaining blocking RFC findings from my review.

Comment thread docs/en/rfcs/2617-source-plugins.md Outdated
already on the destination runner is a conflict.
- **Permissions**:
- Adding, changing, and removing targets of a device runner needs Source write permission on the Scope; a device can
submit results only to Scopes where its credential has `scope.contribute`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 任何持有某 Scope 写权限的主体都可以把采集 target 指派到任意已注册 runner,该授权面未在设计中声明

第 4 节权限矩阵只要求"Source write permission on the Scope",没有要求对 runner 的任何所有权或关联;而 pc_source_runners 对所有已认证用户可见(第 8 节 Unresolved questions 只讨论了"列表可见性是否按 Scope 限制",未讨论指派)。组合起来的可复现路径:

  1. 主体 A(普通用户)凭自己的凭据注册 runner robot-A,部署采集插件(例如读取设备本机文件/内网 URL 的 capability)。
  2. 主体 B 只对某 Scope X 有写权限(无需认识 A、无需任何 runner 权限)。B 通过 pc_source_add 把 target 指到 robot-A,capability/parameters 任意填写。
  3. 下一次 sync,robot-A 就会按 B 的参数开始采集——用 A 的凭据、A 的网络位置(设备可能在内网/专线)和 A 的计算资源;A 的凭据若恰好对 X 有 scope.contribute,数据还会提交进 X。

影响:借他人 runner 的网络位置做探测(SSRF-in-your-runner 形态)、消耗他人设备资源、以及 B 可以让 A 的设备持续向 B 选定的 Scope 采集。这与第 3 节"Any authenticated subject can register, with no limit"叠加后,恶意主体还可以先注册大量 runner 再让别人指派。

建议三选一(或组合):把创建/修改 device runner 的 target 限定为 runner 的注册主体或 server.admin;或要求 runner 在 sync 时按 Scope 确认/授权指派(返回未确认 target 直到 runner 侧 accept);或至少把该滥用路径写进 Drawbacks 并在 Unresolved questions 中与列表可见性一起决策。若有意保持现状(例如默认部署里 Scope 写权限与设备管理同域),也请明确说明该信任假设。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is a real gap, and with the example plugins it is concrete: the tickets plugin takes a file path on the runner, so a user with write permission on a Scope could point another user's device at a path of their choosing, and either read the content through the Scope or learn from the target's error code whether the path exists.

Adopted your first option in aee105947, in both locales:

  • Creating a target on a device runner, changing its parameters, and enabling it again need Source write permission on the Scope and a caller that is the principal that registered the runner, or server.admin.
  • Transferring a target is creating it on the destination, so the caller must be the destination runner's registering principal or have server.admin.
  • Disabling and deleting a target still need only Source write permission on the Scope: they only make a runner collect less, and whoever manages a Scope can stop a collection into it.
  • The server runner's rules are unchanged (server.admin for all of these).

The permission section, the interface table, and Drawbacks are updated; Drawbacks now says that on a runner shared by a team only the account that runs it or an administrator assigns targets, and that acceptance on the runner side (your second option) would be more flexible and is left out of this RFC.

The implementation is in #2639 at 90b1641a4, with e2e coverage. @frf12 this changes the permission rule of an RFC you approved; could you take a look at this commit?

…n targets to it

Co-Authored-By: Claude <noreply@anthropic.com>

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed aee10594 in both locales. The persisted runner ownership, target-assignment permissions, and atomic target-state/configuration checks now address the previous findings, including late commits after deletion and requests omitting optional metadata. The latest permission change also covers enabling and transferring targets. No remaining blocking RFC findings.

This approval covers the documentation-only RFC. Runtime implementation and device acceptance, including the work in #2639, require their own validation.

@hidb4ai
hidb4ai merged commit 4e67427 into oceanbase:master Nov 17, 2026
41 checks passed
jasper-yl added a commit to jasper-yl/powercontext that referenced this pull request Nov 17, 2026
…r and registered device runners

Implements RFC oceanbase#2617.

- SourcePlugin loads from the plugin directory like Artifact plugins. A plugin with only
  definitions extends the Source write API; target declares a parameter model and identity
  parameters; collect runs on the Server's own runner or on device runners.
- Revision v1_5_0_006 adds pc_source_runners and pc_source_collect_targets and drops the
  empty pc_source_write_plugins. A database that still lists write plugins is refused and
  has no supported in-place upgrade path.
- Runners register before they sync. The Server decides the name, unique across the
  deployment: a suggested name with a registration ID that makes the request repeatable for
  its principal, or a fixed name for deployments without persistent state. A runner is bound
  to the type and identifier of the principal that registered it; only that principal syncs
  and commits under its name, and may delete the record once it has no targets.
- Targets go only to registered runners, carry a configuration version, and can be
  transferred to another runner with or without their checkpoint.
- A checkpoint commit for a collection target is decided from what is stored, whichever
  optional fields the request carries: the target's existence, enabled state, runner, and
  configuration version are checked in the transaction that writes the checkpoint and the
  status. A late commit for a deleted target is refused instead of recreating its checkpoint.
- powercontext source-agent registers, keeps its name in a state directory unless --name is
  given, sends the configuration version it collected under, and keeps collecting when one
  plugin or target fails. It reports only error codes and exception type names.
- The Server's runner records a collection that failed as a whole on every target of the
  call and still raises the original error.
- A plugin's declared scopes also bound what runners submit for it and where its targets go.
- The previous Source plugin framework is removed: /v1/source-management/*, source load, its
  settings, and powercontext.source_management.

Co-Authored-By: Claude <noreply@anthropic.com>
jasper-yl added a commit to jasper-yl/powercontext that referenced this pull request Nov 18, 2026
…r and registered device runners

Implements RFC oceanbase#2617.

- SourcePlugin loads from the plugin directory like Artifact plugins. A plugin with only
  definitions extends the Source write API; target declares a parameter model and identity
  parameters; collect runs on the Server's own runner or on device runners.
- Revision v1_5_0_006 adds pc_source_runners and pc_source_collect_targets and drops the
  empty pc_source_write_plugins. A database that still lists write plugins is refused and
  has no supported in-place upgrade path.
- Runners register before they sync. The Server decides the name, unique across the
  deployment: a suggested name with a registration ID that makes the request repeatable for
  its principal, or a fixed name for deployments without persistent state. A runner is bound
  to the type and identifier of the principal that registered it; only that principal syncs
  and commits under its name, and may delete the record once it has no targets.
- Targets go only to registered runners, carry a configuration version, and can be
  transferred to another runner with or without their checkpoint.
- A checkpoint commit for a collection target is decided from what is stored, whichever
  optional fields the request carries: the target's existence, enabled state, runner, and
  configuration version are checked in the transaction that writes the checkpoint and the
  status. A late commit for a deleted target is refused instead of recreating its checkpoint.
- powercontext source-agent registers, keeps its name in a state directory unless --name is
  given, sends the configuration version it collected under, and keeps collecting when one
  plugin or target fails. It reports only error codes and exception type names.
- The Server's runner records a collection that failed as a whole on every target of the
  call and still raises the original error.
- A plugin's declared scopes also bound what runners submit for it and where its targets go.
- The previous Source plugin framework is removed: /v1/source-management/*, source load, its
  settings, and powercontext.source_management.

Co-Authored-By: Claude <noreply@anthropic.com>
hidb4ai pushed a commit that referenced this pull request Nov 18, 2026
…r and device runners (#2639)

* feat(sources): collect with Source plugins through the Server's runner and registered device runners

Implements RFC #2617.

- SourcePlugin loads from the plugin directory like Artifact plugins. A plugin with only
  definitions extends the Source write API; target declares a parameter model and identity
  parameters; collect runs on the Server's own runner or on device runners.
- Revision v1_5_0_006 adds pc_source_runners and pc_source_collect_targets and drops the
  empty pc_source_write_plugins. A database that still lists write plugins is refused and
  has no supported in-place upgrade path.
- Runners register before they sync. The Server decides the name, unique across the
  deployment: a suggested name with a registration ID that makes the request repeatable for
  its principal, or a fixed name for deployments without persistent state. A runner is bound
  to the type and identifier of the principal that registered it; only that principal syncs
  and commits under its name, and may delete the record once it has no targets.
- Targets go only to registered runners, carry a configuration version, and can be
  transferred to another runner with or without their checkpoint.
- A checkpoint commit for a collection target is decided from what is stored, whichever
  optional fields the request carries: the target's existence, enabled state, runner, and
  configuration version are checked in the transaction that writes the checkpoint and the
  status. A late commit for a deleted target is refused instead of recreating its checkpoint.
- powercontext source-agent registers, keeps its name in a state directory unless --name is
  given, sends the configuration version it collected under, and keeps collecting when one
  plugin or target fails. It reports only error codes and exception type names.
- The Server's runner records a collection that failed as a whole on every target of the
  call and still raises the original error.
- A plugin's declared scopes also bound what runners submit for it and where its targets go.
- The previous Source plugin framework is removed: /v1/source-management/*, source load, its
  settings, and powercontext.source_management.

Co-Authored-By: Claude <noreply@anthropic.com>

* build: regenerate operation tables and the Desktop contract identity for Source collection

Co-Authored-By: Claude <noreply@anthropic.com>

* build(integrations): rebuild plugin bundles from the Source collection operation tables

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(integrations): declare pc_source_target_transfer in the capability manifest

Co-Authored-By: Claude <noreply@anthropic.com>

* test: follow the Source collection tools and revision in the Skill eval fixtures and native suites

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(sources): keep collection commits atomic, guard concurrent target changes, and trigger plugins from collected Sources

- Write the target status before the checkpoint, so a target's first checkpoint
  is inserted inside the open transaction and rolls back with a failed status.
- Apply a target change, transfer, or deletion only to the runner and
  configuration version the request read; a concurrent change returns 409.
- Give collection Workers the loaded Artifact plugins' Source inputs, so
  Sources the Server's runner collects start the same plugin work.
- Accept a commit's plugin version only for the target's own plugin.
- Collect targets that returned has_more first in the next call, on the
  Server's runner (new status column) and on device runners.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(sources): hold a checked target or runner until the checking transaction ends

SQLite ignores FOR UPDATE and starts its transaction at the first write, so a
target could be changed or deleted between a commit's check and its checkpoint
write, and a runner could be deleted while a target was being assigned to it.
Such transactions now first write the row they check, without changing it.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(sources): let only a device runner's owner or an administrator assign targets to it

Creating a target, changing its parameters, enabling it, and transferring a
target to a runner now need the principal that registered the runner, or
server.admin, besides write permission on the Scope. Disabling and deleting a
target still need only the Scope permission.

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor(migrations): name the Source collection revision v1_5_2_pr2639

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(sources): keep accepted target parameters exportable and follow the Codex binding tests

Target parameters are exported with their Scope: paths on the runner are
allowed in a bundle, and credential-shaped parameters are refused when the
target is created or changed. The Codex binding tests that used the removed
pc_source_instances tool now use the Source collection tools.

Co-Authored-By: Claude <noreply@anthropic.com>

* build(integrations): rebuild the DSH bundle on current master

Co-Authored-By: Claude <noreply@anthropic.com>

* style: format the Source collection changes

Co-Authored-By: Claude <noreply@anthropic.com>

* test(desktop): qualify the Source plugins contract

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.6.0 v1.6.0 release tracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants