Skip to content

feat(plugin): add explicit review workflow plugins - #1764

Closed
Qiyuanqiii wants to merge 21 commits into
alibaba:mainfrom
Qiyuanqiii:Qiyuanqiii/workflow-plugin
Closed

Qiyuanqiii wants to merge 21 commits into
alibaba:mainfrom
Qiyuanqiii:Qiyuanqiii/workflow-plugin

Conversation

@Qiyuanqiii

@Qiyuanqiii Qiyuanqiii commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Custom review stages

ocr review --review-plugin ID runs an explicitly selected package's review workflow. A workflow can inspect a change, verify candidate findings in a later stage, and require a structured completion report before publishing results. The package supplies stages, instructions and validation; OCR supplies diffs, rules, model/tool execution, budgets and saved results.

Without the flag, OCR uses its existing review flow. Installing or enabling a package does not select its workflow.

Draft; depends on #1738. That PR provides installation, rules/MCP and project locks. This PR targets upstream main, so Files changed includes that unmerged dependency. Review the Workflow-only changes. After #1738 merges, this branch will be rebased to remove the dependency from the diff and consolidate its history.

Try it

From this checkout, with Python 3 available as python, a configured model provider and working-tree changes to review:

ocr plugin install ./examples/ocr-plugins/single-pass
ocr review --review-plugin single-pass --preview
ocr review --review-plugin single-pass --format json --output review.json

Preview inspects the selected package without starting its executable or contacting the model. The final command runs the bundled one-stage example. Inspect review_plugin in review.json for completion and the saved report.

Repositories declaring project plugins must select from their locked, installed and locally authorized packages. See the workflow guide for project setup and the full protocol.

Execution and review order

sequenceDiagram
    participant OCR as OCR agent
    participant Plugin as Workflow process
    participant Runner as Model/tool loop
    participant Output as Session/output
    OCR->>Plugin: Start for one file group
    loop Each declared stage
        OCR->>Plugin: begin(stage, paths, classifications)
        Plugin-->>OCR: Instructions, input and completion schema
        OCR->>Runner: Run with diff, rules, tools and budget
        Runner->>Plugin: submit(completion)
        Plugin-->>Runner: Accepted result or repair feedback
        Runner-->>OCR: Completion, stop or failure
        OCR->>Output: Save report and process accepted findings
    end
    OCR->>Plugin: Close process
Loading
Read first Main files Review question
Selection and authorization internal/config/rules/plugin_rules.go, manifest and project-plugin code Is only the explicitly selected workflow run, within the project lock and trust rules?
Process contract internal/plugin/review.go, examples/ocr-plugins/single-pass/review.py Are requests, validation feedback, cancellation and process cleanup handled correctly?
Execution and publication internal/agent/review_plugin.go, internal/llmloop/task_options.go, loop/compression changes Do stages share budgets, preserve task context and publish accepted findings correctly?
Results Session, coverage and CLI changes Are incomplete stages visible in reports and the exit status?

Boundaries

  • The stdio-v1 protocol is experimental. Workflows require a fresh invocation; --resume does not restore process state.
  • Every declared stage is required. An unfinished stage produces an unsuccessful review, while reports and already accepted findings remain inspectable.
  • The selected executable runs with the user's or CI runner's permissions. Package selection authorizes execution; this release provides no runtime sandbox.

Update a plugin from a replacement source

ocr plugin update my-plugin --source "https://plugins.example.com/download.php?token=NEW_TOKEN"

--source accepts the same HTTPS/GitHub URLs and local directory/ZIP/tar.gz sources as install. It selects the installed plugin ID, including from multi-plugin archives. A successful update records the new source for later update ID calls and preserves the enabled state. Download, validation and unaccepted execution-declaration failures preserve the previous package and source. The full URL is stored locally; management output hides query parameters. Project dependencies continue to use plugin add and plugin lock.

The native-plugin guide and CLI reference cover this behavior in English, Simplified Chinese, Japanese, Korean and Russian.

Follow-up fixes and validation

Latest source-replacement follow-up (Windows, Go 1.26.9):

  • make check and race-enabled make test for internal/plugin and cmd/opencodereview passed. CLI package tests used an isolated user home.
  • Regression tests cover URL token rotation, failed downloads, saved-source reuse, plugin-ID matching, multi-plugin selection, execution-change acceptance and enabled/disabled state preservation.
  • On the feat(plugin): add local rule package foundations #1738 dependency, a built-CLI check installed version 1, replaced its source to obtain version 2, then fetched version 3 without passing --source again.
  • OCR reviewed the three changed production files with zero findings. Documentation links, JSON examples and LF line endings were checked.

Earlier branch validation:

The earlier Workflow follow-ups are addressed:

  • Filters only reconsider findings from the current stage; accepted line ranges survive synchronous and asynchronous publication.
  • Begin instructions/input are independently validated. The Python example returns repair feedback for malformed finding objects, then accepts a corrected submission in the same process.
  • Retired workflows are marked as requiring an update. Selection ignores unrelated disabled snapshots while still checking enabled/selected contents and project locks.
  • Budget exhaustion records one warning across stage and dispatch gates. Tests preserve four task-input messages across two context compressions.

Verified on Windows with Go 1.26.9:

  • make check, CLI build and race-enabled make test for internal/plugin, internal/config/rules, internal/agent, internal/llmloop, internal/tool and cmd/opencodereview passed. The final dispatch-warning adjustment also passed focused Workflow and ordinary-budget tests.
  • Regressions for filtering, anchors, budget warnings, selection, begin validation, example recovery and retired metadata were checked against the preceding behavior and repaired behavior. Valid-operation controls also passed.
  • Built-CLI installation, inspection and preview of the documented single-pass example passed. Protocol tests execute its real Python process; model/tool integration tests use controlled model responses.
  • Mermaid rendering passed. Nine bot review threads have evidence-backed replies and are resolved.
  • Independent OCR Delegate review by GPT-6.1 Sol (xhigh) covered 10/10 reviewable files, with no remaining actionable findings. The 11 excluded tests/documentation files were also read as context.

The additional OCR/DeepSeek run hit its configured aggregate token budget before completing any of its nine selected files. It is recorded as incomplete, not as a clean review. The independent Delegate review covers the final patch, including the later dispatch adjustment.

The native-plugin and Workflow guides are available in English, Simplified Chinese, Japanese, Korean and Russian, including source formats, URL input, CLI commands and protocol behavior.

Credits and AI assistance

The dependency retains its original credits, including @wu21-web for tar.gz packaging and replacement-source updates. Workflow work credits @acoliver for compatibility and project-policy proposals, @MeiSiristhebest for execution/identity and platform feedback, and @chaojixinren for management-output integration.

OpenAI Codex was used for implementation, tests and documentation, with GPT-6 Astra and delegated GPT-6.1 Sol agents at xhigh. Reviews used OCR Delegate and OCR with DeepSeek.

  • Contributor self-review is complete before requesting maintainer review.

Follow-up commit: 1ee2f033.

Qiyuanqiii and others added 11 commits October 16, 2026 06:56
Support reusable rules, MCP servers, explicit review workflows, and
local, catalog, and URL installation with confined package snapshots.
Include protocol diagnostics and upstream completion integration.
Prefer tar.gz for plugin distribution and GitHub downloads while
retaining ZIP compatibility. Preserve executable bits during installation.

Co-authored-by: wu21-web <[email protected]>
Require acceptance for execution declaration changes, pin GitHub sources,
check host requirements, and distinguish archive and content digests.

Co-authored-by: Andrew C. Oliver <[email protected]>
Co-authored-by: Andrew C. Oliver <[email protected]>
Co-authored-by: MeiSiristhebest <[email protected]>
Co-authored-by: chaojixinren <[email protected]>
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🔍 OpenCodeReview found 9 issue(s) in this PR.

  • ✅ Successfully posted inline: 9 comment(s)

Comment thread cmd/opencodereview/mcp_cmd.go Resolved
Comment thread cmd/opencodereview/plugin_cmd.go Resolved
Comment thread internal/agent/review_plugin.go Resolved
Comment thread internal/agent/review_plugin.go Resolved
Comment thread internal/config/rules/plugin_rules.go Resolved
Comment thread internal/plugin/install_source.go Resolved
@Qiyuanqiii

Copy link
Copy Markdown
Contributor Author

pr过大,我目前的计划是拆分,所以暂时关闭

@Qiyuanqiii Qiyuanqiii closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant