Skip to content

feat(plugin): add local rule package foundations - #1738

Open
Qiyuanqiii wants to merge 3 commits into
alibaba:mainfrom
Qiyuanqiii:codex/native-plugins-marketplace
Open

Qiyuanqiii wants to merge 3 commits into
alibaba:mainfrom
Qiyuanqiii:codex/native-plugins-marketplace

Conversation

@Qiyuanqiii

@Qiyuanqiii Qiyuanqiii commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What users can do with this PR alone

The idea behind the plugin feature was to make it easier for people with specific needs, whose changes are hard to merge into main to accomplish their own goals.

This PR is narrowed to local rule plugin foundations. A team can keep its review checklist in one package; each developer installs it from a local directory and enables it for reviews across their repositories. Matching plugin instructions are appended to the existing resolved rule, so project rules and file exclusions continue to work.

For example, a Go checklist can ask reviewers to check returned errors and resource ownership. Once enabled, ocr review, ocr scan and ocr delegate rule receive those instructions for matching Go files. The package contributes prompt instructions; whether a model identifies a particular issue still depends on that model's review.

Capability Behavior in this PR
Install Copy a local package directory into a private snapshot; disabled by default, or enabled with --enable
Inspect and manage list, show, enable, disable, remove; every plugin command accepts --json
Reuse rules Apply enabled packages across repositories for the current user, with package-relative Markdown and file-pattern matching
Preserve existing behavior Append plugin rules to the resolved base rule and preserve project exclusions
Replace a package Remove and reinstall; edits to the original source directory do not modify an installed snapshot
Resume reviews Identical reinstalls preserve rule identity; changed package contents invalidate incompatible reuse
ocr plugin install ./examples/ocr-plugins/review-checklist --enable
ocr plugin list
ocr plugin show review-checklist
ocr rules check src/main.go
ocr review
ocr plugin disable review-checklist
ocr plugin remove review-checklist

Every plugin command accepts --json. Installation defaults to disabled unless --enable is supplied. Replacement uses remove followed by install.

image image image image

Split from the earlier version

The three initial PRs target upstream main independently:

PR Scope
This PR Local directory installation, package/state validation, host compatibility, plugin management, additive rules and resume identity
#1912 Repository interfaces and the Git adapter, adapted from the earlier fork implementation to current main
#1910 HTTPS-by-default remote MCP connections with controlled loopback HTTP and same-origin redirects

The local rules foundation has no dependency on the VCS or MCP PR. The VCS abstraction was in the earlier fork, not in the previous #1738 diff.

Remote URL/GitHub and ZIP/tar.gz installation, updates, MCP plugin contributions/inventory, project declarations/locks/authorization and GitHub Actions integration are reserved for follow-up PRs. Workflow Plugin #1764 is temporarily closed pending review of this foundation; its dependency branch will need to be adapted to the agreed split before reopening. TUI remains separate in #1739. Marketplace remains removed.

The pre-split #1738 implementation and its complete attribution history are preserved in Qiyuanqiii/backup-pr1738-full-20261112.

Architecture and review order

flowchart LR
    source["Local directory"] --> package["Manifest + compatibility + bounded snapshot"]
    package --> store["User plugin state and snapshots"]
    store --> enabled["Enabled rule packs"]
    base["Existing rule priority and file filters"] --> resolver["Append matching plugin rules"]
    enabled --> resolver
    resolver --> review["Existing review / scan"]
    resolver --> identity["Rule and content identity for resume"]
Loading
  1. internal/plugin: strict manifest, host requirements, bounded local copying, atomic state and management.
  2. cmd/opencodereview/plugin_cmd.go: install/list/show/enable/disable/remove.
  3. internal/config/rules/plugin_rules.go: append rules after the existing priority chain, preserving file filters.
  4. internal/agent/plugin_identity_test.go: identical reinstalls preserve resume identity; changed package contents invalidate reuse.
  5. Five-language native-plugin guides, CLI references and the runnable Markdown-rule example.

Plugin rules are data included in the review prompt. Packages cannot declare MCP processes or workflow stages in this foundation. Unknown manifest fields fail explicitly. The source must be a local directory; URL and archive inputs are not accepted in this PR.

Validation

Standalone functional validation on 2026-11-12, Windows, Go 1.26.10, at 25adf8149e0bddedfe59c53845c83ab635cf2c9d:

  • Built this PR's CLI directly, without adding fix(mcp): require HTTPS for remote connections #1910 or refactor(vcs): isolate repository operations behind providers #1912. Used isolated user storage and two temporary Git repositories.
  • The built executable passed installation from C:\Windows\system32, default-disabled state, JSON inspection, enable/disable/remove, package-relative Markdown loading, cross-repository application and replacement by remove/reinstall.
  • Verified that project rules and exclusions survive, nonmatching files do not receive plugin rules, and changes to the original package directory leave the installed snapshot unchanged.
  • Completed actual review and scan CLI invocations against a local recording OpenAI-compatible test endpoint. Both requests contained the project and enabled-plugin instructions; a subsequent review after disabling the plugin contained only the project instructions. This checks runtime request integration using deterministic model responses, not AI finding quality. delegate rule also included the enabled rules.
  • Verified explicit rejection of URL/ZIP/tar.gz installation, deferred update/market commands and unsupported execution fields in manifests. All 21 functional assertions passed.
  • Race-enabled make test passed for the full internal/plugin package and focused plugin tests in internal/config/rules, internal/agent and cmd/opencodereview, including resume after identical reinstall and rejection of changed rule identity.

Real-provider follow-up (same host commit, 2026-11-12): a temporary rules-only package extracted general principles from ocr-behavior-review's policy. The original 0.2.0 package declares a Workflow process and is correctly rejected by this foundation. With the rule adaptation enabled, DeepSeek deepseek-v4-flash completed a review of a small inventory fixture and found the independently reproduced failed-reservation state mutation (1 finding). After correcting the fixture, all three behavior tests passed and a fresh review completed with 0 findings. Saved request records contain the plugin rules in both runs. This exercises real model review with a rule package; the original three-stage Workflow remains outside this PR.

Earlier validation of the same split implementation:

  • make license-add, make check and CLI build passed.
  • Race-enabled make test passed for plugin, rules, session, agent and CLI packages.
  • Full make coverage passed: 90.9% overall.
  • Ran the built executable from C:\Windows\system32 in an isolated user home: install, enable, inspect applied rules, disable, remove and empty listing passed.
  • Installed the documented example and verified its package-relative Markdown rules load.
  • Five-language snippets, links, navigation registrations and LF checks passed.
  • OCR reviewed 14 selected implementation files. Its missing-home compatibility and terminal-metadata findings were fixed with regression tests. Four low-priority observations remain around retained snapshot reclamation, power-loss durability and reporting staging/lock cleanup failures. Snapshot retention is documented; these operational lifecycle improvements remain follow-up work.

Contributor credits

Credits follow the retained contributions:

  • @acoliver (Andrew C. Oliver): host compatibility requirements and manifest contract, co-author on the package-foundation commit.
  • @MeiSiristhebest: stable rules identity across reinstall and resume regression coverage, co-author on the rules-integration commit.
  • @irvallensar: HTTPS policy credit is retained in fix(mcp): require HTTPS for remote connections #1910; trusted-policy integration tests stay with the deferred CI work.
  • @wu21-web: tar.gz packaging/executable permissions and replacement-source updates remain credited in the preserved distribution work for later extraction.
  • @chaojixinren: manual MCP compatibility and unified inventory remain credited in the preserved MCP work for later extraction.

AI assistance and contributor review

OpenAI Codex (GPT-6) assisted with implementation, tests and documentation. GPT-6.1 Sol agents at xhigh assisted with VCS adaptation and documentation; OCR used the configured DeepSeek provider for precommit review. Earlier increments also used OCR Delegate.

  • Contributor self-review of the rewritten PR is complete.

Related: #1736, #1739, #1764.

Comment thread internal/plugin/package.go Fixed
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

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

  • ✅ Successfully posted inline: 6 comment(s)

Comment thread cmd/opencodereview/scan_cmd.go Resolved
Comment thread internal/agent/review_plugin.go Resolved
Comment thread internal/agent/review_plugin.go Resolved
Comment thread internal/llm/completion_budget.go Resolved
Comment thread internal/plugin/review.go Resolved
Comment thread internal/plugin/marketplace.go Fixed
Comment thread internal/plugin/marketplace.go Fixed
Comment thread internal/plugin/package.go Fixed
Comment thread internal/plugin/package.go Fixed
Comment thread internal/plugin/package.go Fixed
Comment thread internal/plugin/package.go Fixed
Comment thread internal/plugin/package.go Fixed
Comment thread internal/plugin/package.go Fixed
@Qiyuanqiii

Copy link
Copy Markdown
Contributor Author

Validation evidence for the four remaining CodeQL path alerts

AI-assisted analysis performed with Codex against 135138a4ed409bf696018dc28a79d3c6a53d9b75.

The reproduced dataflows support classifying alerts 17, 18, 20 and 24 as false positives at this revision. This conclusion is limited to these four reported paths.

Reproduction: CodeQL run and downloadable pr1738-codeql-sarif artifact. The fork workflow checks out the exact PR head and uses CodeQL 2.27.2, the same CodeQL action revision, Go autobuild and the default suite as the upstream run. It reproduces all four go/path-injection sinks. The workflow succeeds because analysis completed; the SARIF still contains the alerts. The artifact has a seven-day retention period. The analysis below uses that SARIF because the upstream Security alert details are not accessible with the contributor account.

All four flows start at response.Request.URL, marketplace.go:179. The decisive control-flow constraints are:

Alert / reported sink Why the reported remote-to-local path is infeasible
17: canonicalSource → os.Stat, marketplace.go:130 The flow enters loadMarket's download branch with remote=true, then reaches parseMarket's local-only branch, which requires that same flag to be false. One alternative also combines the remote-only ResolveReference with that local-only branch. Independently, the reported call at line 255 passes defaultFilename="", while the reported Stat is guarded by defaultFilename != "".
18: readFileBounded → os.Open, package.go:38 The SARIF flows pass through parseMarket error returns and continue to the local ZIP read at marketplace.go:443. prepareCatalog actually returns immediately on those errors. On successful parsing, remote entries must pass HTTPS validation, and preparePackage returns from its HTTPS branch before reaching the local ZIP read.
20: preparePackage → os.Lstat, marketplace.go:406 The same parse-error check and HTTPS early return prevent the remote catalog entry from reaching this local-source sink.
24: openPackageRoot → os.Lstat, package.go:47 The reported caller is the local-directory branch at marketplace.go:430. The same controls prevent a remote catalog entry from reaching that branch.

Relevant source checks:

Runtime corroboration: focused make test runs with the race detector on Windows/Go 1.26.9 exercised the actual Store APIs using temporary overlay tests. Direct catalog installation and registered-market installation were tested with absolute local paths, file: URLs, encoded paths and non-HTTPS redirects. A real, valid local sentinel package was present; none of these remote inputs installed it. Positive controls for relative HTTPS package URLs and explicitly selected local directory/ZIP sources passed.

Existing source-replacement and destination-directory-link regressions also passed. The existing ZIP symlink test skipped because Windows lacked symlink privileges; an additional Windows junction test executed and passed. These runtime checks were local; the linked Linux workflow ran CodeQL analysis.

The earlier directory-copy defects were separately reproduced and fixed in 135138a4. This comment does not classify the older, removed alerts or request that any security check be disabled.

@Qiyuanqiii

Qiyuanqiii commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author
image

like this

@Qiyuanqiii
Qiyuanqiii force-pushed the codex/native-plugins-marketplace branch 2 times, most recently from 816dfc7 to e712a4e Compare October 15, 2026 23:11
@Qiyuanqiii

Copy link
Copy Markdown
Contributor Author

@hyy321 @chaojixinren @Moon-Wrecker @MeiSiristhebest
@irvallensar @AyushDubey23 @basil-k-aji-dev

Hi everyone, I’d like to hear your thoughts on the plugin feature. It’s clearly a fairly large feature, and it would be difficult for me to fully develop and refine it on my own. I’ve already talked with wu21 and acoliver and incorporated some of their suggestions. If you have any suggestions or feedback, feel free to leave a comment—whether positive or negative. I’ve @-mentioned a few of you who left a strong impression on me.

@Qiyuanqiii

Qiyuanqiii commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

The idea behind the plugin feature was to make it easier for people with specific needs, whose changes are hard to merge into main to accomplish their own goals

@Qiyuanqiii

Copy link
Copy Markdown
Contributor Author

@OUAO-FRANK Likewise, I’d also like to ask for your thoughts on the plugin feature

@OUAO-FRANK

Copy link
Copy Markdown
Contributor

The plugin marketplace direction looks useful, especially the frozen/offline installation and trust model. I’ll review the CLI workflow and compatibility details more carefully and share any concrete feedback.

@Qiyuanqiii

Copy link
Copy Markdown
Contributor Author

Hi @Qiyuanqiii,

Thanks for reaching out and inviting me to review this PR!

I reviewed the implementation at e979bc1, comparing it with the existing repository architecture and conventions. I focused on correctness, cross-platform behavior, deterministic execution, integration with existing abstractions, and maintainability.

Overall, I think this is a meaningful extension of OCR rather than a disconnected plugin subsystem. In particular, the integration with the existing rule resolver, MCP runtime, LLM runner, comment pipeline, session persistence, and GitHub Action is a strong direction.

I also appreciate that installation and execution authorization are treated as separate operations, and that the implementation uses directory-relative filesystem APIs for package extraction and copying.

That said, I found several areas worth addressing or discussing.

Actionable findings

1. [P2] GitHub Action policy fingerprint is not stable across LF/CRLF conversions

Location: scripts/github-actions/project-plugins.js:60–83

The policy verification correctly accounts for Git's checkout filters:

const object = checked(
  git(["hash-object", `--path=${relative}`, "--stdin"], data),
  "verify policy contents"
).toString().trim();

if (object !== blob[1]) {
  throw new Error(`policy file differs from the trusted commit: ${relative}`);
}

However, after verifying the normalized Git object, the fingerprint incorporates the raw working-tree bytes:

policyFiles.push([relative, digest(data)]);

This introduces a mismatch between the definition of a valid policy checkout and the definition of its identity.

I independently checked the underlying Git behavior with LF and CRLF versions of the same file: both produce the same Git object ID through git hash-object --path=... --stdin, while their raw SHA-256 digests differ.

Impact: Two runners can successfully verify the same trusted policy commit and plugin lock but produce different fingerprints solely because of line-ending conversion. This can unnecessarily invalidate incremental review checkpoints and trigger a full review.

The existing CRLF test checks that a fingerprint is produced, but does not assert that it equals the fingerprint obtained before conversion.

Suggestion:

  • Use the already-verified Git blob ID, or another normalized representation, when constructing policyFiles.
  • Add a regression test asserting fingerprint equality before and after LF/CRLF conversion.
  • Keep the existing fail-closed behavior for genuine policy changes.

This would better preserve the deterministic, cross-runner identity model the Action is designed to provide.

2. [P2] Local resume identity depends on randomly generated plugin installation paths

Locations:

  • internal/config/rules/plugin_rules.go:201–219
  • internal/agent/agent.go:1068
  • internal/plugin/store.go:278–325

The rule configuration identity currently includes the absolute installation directory:

fields = append(fields,
    "plugin", p.Manifest.ID,
    "manifest", string(manifest),
    "directory", p.Dir,
    "content", p.ContentSHA256,
)

Meanwhile, plugin installation and updates create new snapshot directories with randomized suffixes.

Consequently, updating an enabled plugin can change its installation path even if the manifest and package contents remain identical.

Because the plugin directory participates in RuleConfigSHA256, an otherwise compatible local review session may no longer pass resume identity validation.

An important distinction here is that this is not limited to explicitly selected Review Workflow plugins. The regular rule resolver includes enabled plugin identities, so ordinary reviews using rule plugins can encounter the same issue.

I recognize that Review Workflow plugins currently do not support restoring arbitrary process state through --resume. This finding concerns the existing resume mechanism for ordinary reviews with enabled plugins.

Suggestion: Consider separating:

  1. Content identity: Manifest, resolved rules, package digest, and relevant contribution configuration.
  2. Execution identity: Configuration that can affect actual runtime behavior.
  3. Deployment state: Machine-local snapshot paths and cache locations.

For data-only rule plugins, changing the snapshot directory should not invalidate a session when the effective contents are unchanged.

For executable contributions, additional execution-environment validation may still be justified.

A focused regression test would be useful: create a review session with a rule plugin, reinstall or update it with identical contents, then verify that resume identity remains compatible.

3. [P2/P3] Windows Action helper introduces an unnecessary Bash dependency

Location: scripts/github-actions/project-plugins.js:40

The Windows-specific invocation is:

spawnSync(
  "bash",
  ["--noprofile", "--norc", "-c", 'ocr "$@"', "ocr", ...args],
  options
);

Using "$@" preserves the supplied arguments without interpolating them directly into the Bash program, which is a good property.

However, the implementation assumes that bash is installed and discoverable through PATH.

That assumption may hold on common GitHub-hosted Windows runners, but it is not guaranteed for minimal Windows environments or custom self-hosted runners. Without Bash, the invocation fails before OCR starts.

Simply replacing it with { shell: true } is not a safe universal solution because Windows batch files have different argument-escaping semantics.

Suggestion: Consider reusing the repository's existing native executable resolution strategy, already present in scripts/platform.js and bin/ocr.js, or introducing a small shared launcher abstraction.

The preferred solution should:

  • Avoid a Bash dependency when launching the native OCR binary on Windows.
  • Preserve argument boundaries without unnecessary shell interpretation.
  • Handle spaces and shell metacharacters in paths and arguments.
  • Be covered by platform-specific launcher tests.

This would improve consistency with the existing OCR distribution model instead of maintaining a separate Windows execution strategy inside the Action.

4. [P3] Plugin management JSON can expose Review Workflow command arguments

Location: cmd/opencodereview/plugin_cmd.go

The management output deliberately omits MCP server arguments, environment variables, and authentication headers.

However, pluginInfo contains:

Review *plugin.ReviewContribution `json:"review,omitempty"`

And pluginManagementInfo() assigns the original contribution directly:

Review: m.Review

ReviewContribution includes the workflow command and argument list.

As a result, ocr plugin show ID --json and ocr plugin list --json may serialize those arguments verbatim.

This is not necessarily a privilege-escalation vulnerability: the manifest itself is locally readable, and credentials should not be embedded in plugin definitions. Nevertheless, it is inconsistent with the management API's existing redaction approach and can expose sensitive values if command arguments are copied into CI logs or support diagnostics.

Suggestion: Use a dedicated, redacted management representation for Review contributions, similar to the treatment of MCP configuration.

For example, expose the protocol and declared stage names while omitting raw command arguments unless there is an explicit need to inspect them.

The existing credential-redaction tests cover MCP arguments but could be extended to Review Workflow contributions.

5. [P3] Selecting a Review Workflow reloads the entire rule configuration

Locations:

  • cmd/opencodereview/shared.go
  • cmd/opencodereview/review_cmd.go:139–151

loadCommonContext() already constructs the rule resolver through rules.NewResolver().

When --review-plugin is supplied, executeReviewContext() constructs another resolver and replaces the original:

if opts.reviewPlugin != "" {
    cc.Resolver, cc.FileFilter, err = rules.NewResolver(
        cc.RepoDir,
        opts.rulePath,
        rules.ResolverOptions{
            Ref: contentRef,
            Runner: cc.GitRunner,
            ReviewPlugin: opts.reviewPlugin,
        },
    )
}

With the new plugin integration, resolver construction also involves plugin loading, compatibility checks, digest computation, and rule-pack parsing.

This means the initialization path can perform the same work twice.

I do not see evidence that this produces incorrect review results, but it introduces redundant initialization and another path that future changes must keep consistent.

Suggestion: Pass ResolverOptions into the existing common-context initialization path so the resolver is constructed once with the correct plugin selection.

This would be more consistent with the repository's existing shared initialization design.

API and architecture consistency

6. Review and MCP contributions support different macro expansion contracts

Locations:

  • internal/plugin/review.go:63–72
  • cmd/opencodereview/plugin_runtime.go:51–69

ReviewCommand() expands:

  • ${plugin_dir}
  • ${os}
  • ${arch}
  • ${exe}

By contrast, pluginMCPConfig() expands only ${plugin_dir}.

For example, a cross-platform MCP executable declared as:

${plugin_dir}/bin/${os}-${arch}/server${exe}

would not receive the same substitution behavior as an equivalent Review Workflow executable.

This is a confirmed API asymmetry, although it may be intentional: the MCP documentation currently describes ${plugin_dir} as the supported placeholder.

Suggestion: Decide whether these contribution types should share a macro vocabulary.

If so, a small shared expansion helper in internal/plugin would reduce duplicated behavior and prevent future divergence. Tests should cover command and argument expansion on each supported platform.

If the difference is intentional, explicitly documenting the distinct contracts would also be reasonable.

7. Preserve the existing CLI conventions without forcing identical implementation patterns

Locations:

  • cmd/opencodereview/plugin_cmd.go
  • cmd/opencodereview/plugin_project_cmd.go
  • cmd/opencodereview/shared_flags.go

The original CLI generally uses shared flag registration helpers and statically declared Cobra commands. The plugin subsystem instead uses command factories, closures, and a separate --repo flag definition for project operations.

I would not treat command factories or closures as defects. They can improve state isolation and testability, especially for a command group with many related operations.

However, it would be useful to review whether the plugin commands can reuse existing conventions for repository-path resolution, common flag behavior, output handling, and error reporting.

For example, addRepoFlag() uses an empty default with established repository resolution semantics, whereas project plugin commands register a separate --repo flag defaulting to ".".

These may currently be equivalent for documented use from a project root, but sharing the relevant abstraction would reduce opportunities for behavioral divergence.

Suggestion: Prefer reuse of the existing semantics and helpers where appropriate, without requiring a wholesale rewrite into global Cobra command variables.

Non-blocking operational follow-ups

8. Consider lifecycle management for retained plugin snapshots

Location: internal/plugin/store.go

The installer intentionally retains previous package snapshots so in-flight reviews can continue using the directories they originally selected.

I agree with this behavior. Deleting old snapshots immediately after an update could break active reviews.

Over time, however, repeated updates can accumulate unused snapshots.

A future cleanup mechanism could identify snapshots that are no longer referenced by the current registry or active sessions, ideally with an explicit maintenance command or conservative retention policy.

I would treat this as an operational enhancement, not a blocker for the initial plugin release.

9. Consider a safer stale-lock recovery workflow

Location: internal/plugin/store.go:131–162

The store uses a directory lock with a bounded wait and reports the lock location when acquisition fails.

This is a conservative design, and the existing error message already instructs the user to verify that no plugin command is active before manually removing a stale lock.

The remaining usability concern is that recovery currently requires manual filesystem intervention.

An eventual diagnostic or explicit unlock command could improve recovery, provided it does not automatically delete locks merely because their age exceeds a threshold.

PID reuse, concurrent processes, and crash recovery need to be considered before making stale-lock cleanup automatic.

Again, I would not consider this a release blocker.

Integration with the existing OCR architecture

Beyond the individual findings, I specifically checked whether the plugin implementation extends the existing architecture or introduces parallel systems.

Several integration decisions look appropriate:

  • Rules: pluginResolver decorates the existing composedResolver and appends plugin rules without replacing the established custom/project/global/system priority chain.
  • MCP: Plugin servers are converted into the existing MCP configuration and initialized through the existing MCP client and tool-registration pipeline.
  • Agent execution: Review Workflow plugins reuse the existing LLM runner, file groups, token accounting, and comment-publication mechanism rather than implementing an independent review engine.
  • Persistence: Plugin stage reports are recorded through the existing session persistence infrastructure.
  • CI: Frozen project locks, explicit execution authorization, and policy verification are integrated into the existing GitHub Action workflow.

These choices are consistent with OCR's core design principle of combining deterministic engineering constraints with agent execution.

I would preserve those architectural boundaries while addressing the inconsistencies above.

One security-model distinction is also worth maintaining in documentation: installation without execution, explicit trust, and content verification are valuable safeguards, but executing a trusted plugin is not equivalent to sandboxing it. As the current documentation correctly notes, executable contributions can inherit the host process environment and its permissions.

Repository conventions and validation

For this PR, I would use the repository's existing development requirements as the baseline rather than applying generic Go or JavaScript style preferences.

In particular:

  • Target the declared Go toolchain (go 1.26.9) and the Node.js runtime used by the Action.
  • Preserve existing interfaces and behavior unless the new feature requires an explicit change.
  • Follow AGENTS.md for formatting, license headers, English source text, and test conventions.
  • Add targeted regression tests for changes to fingerprints, session identity, cross-platform launching, and serialized output.
  • Run the project's prescribed make check, make test, and coverage checks before merging.

Verification scope: I reviewed the source and relevant test implementations at e979bc1 and independently reproduced the Git line-ending normalization mismatch with a minimal Git fixture. I have not executed the entire Go 1.26.9 test suite or a Windows-specific end-to-end Action run. Findings requiring those environments should be verified with focused regression tests before being classified as confirmed runtime failures.

Summary

My highest-priority recommendations are:

  1. Make Action policy fingerprints invariant under accepted Git line-ending normalization.
  2. Decouple plugin content identity from incidental installation paths, particularly for ordinary review resumption.
  3. Reuse the existing OCR launcher strategy for portable Windows execution.
  4. Align management-output redaction with the existing credential-handling approach.
  5. Avoid rebuilding the full rule resolver when selecting a Review Workflow.

The remaining points concern API consistency and long-term maintainability rather than immediate correctness.

I think the overall plugin architecture fits OCR's existing design well. Addressing these integration details would make it more deterministic, portable, and easier to maintain without introducing a second set of conventions alongside the original codebase.

Thanks again for opening the implementation to review and discussion!

Thank you for your feedback. I've addressed it and added you as a co-author of this commit.

@irvallensar

Copy link
Copy Markdown

As I understand it, the main goal is to make review rules, MCP tools, and custom workflows easier to package, discover, and reuse, instead of requiring teams to coordinate configuration files manually or maintain their own forks. I think the project-level declarations and lockfiles are particularly useful for making plugin setups reproducible across a team and in CI.

One thing I'd be interested in is how the recommended workflow will be presented to first-time users. Since installation, enabling plugins, and authorizing executable contributions are separate steps, a simple end-to-end example showing how a user discovers a plugin, installs it, reviews its permissions, and uses it in a project would make the workflow easier to understand. I haven't reviewed every implementation detail yet, so this is initial design-level feedback. Overall, I think the proposal addresses a useful extensibility problem.

@Qiyuanqiii Qiyuanqiii changed the title feat: add native plugins and CLI marketplace feat: add native plugins with direct package installation Oct 16, 2026
@wu21-web

Copy link
Copy Markdown
Contributor

This pull is too huge.

@wu21-web

wu21-web commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

If you support git repo cloning instead of fetching a raw api,1. check your ssh auth status 2. Maybe support platforms more than github vcs, you should accept any .git repo
We can have a further dicussions on this, this is not mandatory.

@Qiyuanqiii

Copy link
Copy Markdown
Contributor Author

This pull is too huge.

I considered splitting it into 2–3 medium-sized PRs, but I remembered that during the last “Avengers” assembly, the maintainer said keeping it as one large PR might make testing easier for him. So I’ve kept the large PR design for now, and I may continue to streamline it later.

@Qiyuanqiii

Copy link
Copy Markdown
Contributor Author

If you support git repo cloning instead of fetching a raw api,1. check your ssh auth status 2. Maybe support platforms more than github vcs, you should accept any .git repo We can have a further dicussions on this, this is not mandatory.

It’s worth considering,I’ll give it a try later

@wu21-web

Copy link
Copy Markdown
Contributor

This pull is too huge.

I considered splitting it into 2–3 medium-sized PRs, but I remembered that during the last “Avengers” assembly, the maintainer said keeping it as one large PR might make testing easier for him. So I’ve kept the large PR design for now, and I may continue to streamline it later.

no i am not opposing this design it is just that i have trouble reading your changes, github collasped them

@Qiyuanqiii

Copy link
Copy Markdown
Contributor Author

This pull is too huge.

I considered splitting it into 2–3 medium-sized PRs, but I remembered that during the last “Avengers” assembly, the maintainer said keeping it as one large PR might make testing easier for him. So I’ve kept the large PR design for now, and I may continue to streamline it later.

no i am not opposing this design it is just that i have trouble reading your changes, github collasped them

Oh, I see. I’ll try to make the PR description more detailed later and elaborate on the architecture

@irvallensar

Copy link
Copy Markdown

Hi @Qiyuanqiii, I looked through the native plugin architecture and the latest changes. The separation between package preparation, project locks, authorization, and the existing rules/MCP runtime makes sense to me.

Two possible improvements I'd be interested in:

  1. Would it be worth adding an end-to-end GitHub Actions test for forked PRs and comment-triggered workflows, verifying that the plugin declaration and lock are always loaded from the trusted policy commit rather than the PR head? The current policy-SHA unit tests are a good start, but an integration test could protect the complete trust boundary.

  2. For remote MCP configurations, would you consider requiring HTTPS by default, with a controlled exception for local development? The manifest currently permits plain HTTP, and remote configurations can include headers, so this could help prevent accidental exposure of credentials.

@Qiyuanqiii

Copy link
Copy Markdown
Contributor Author

Hi @Qiyuanqiii, I looked through the native plugin architecture and the latest changes. The separation between package preparation, project locks, authorization, and the existing rules/MCP runtime makes sense to me.

Two possible improvements I'd be interested in:

  1. Would it be worth adding an end-to-end GitHub Actions test for forked PRs and comment-triggered workflows, verifying that the plugin declaration and lock are always loaded from the trusted policy commit rather than the PR head? The current policy-SHA unit tests are a good start, but an integration test could protect the complete trust boundary.
  2. For remote MCP configurations, would you consider requiring HTTPS by default, with a controlled exception for local development? The manifest currently permits plain HTTP, and remote configurations can include headers, so this could help prevent accidental exposure of credentials.

Thanks @irvallensar! Both suggestions are implemented in commit 669a8cb.

  1. Added integration tests that execute the Action’s policy-resolution and plugin-preparation steps using real Git commits and a freshly built OCR binary. GitHub events/API responses are simulated. The tests verify trusted-base installation and reject PR-head checkouts or substituted declarations/locks. They are wired into Linux and Windows CI.
  2. Remote MCP connections now require HTTPS, with HTTP allowed only for localhost or loopback IPs. Redirects must preserve the original scheme, host, and port.
    Local regression tests passed. Documentation is updated in all five languages, and I’ve included your co-author credit. Thanks for the suggestions!

@Qiyuanqiii
Qiyuanqiii force-pushed the codex/native-plugins-marketplace branch from 669a8cb to 25adf81 Compare November 12, 2026 09:09
@Qiyuanqiii Qiyuanqiii changed the title feat: add native plugins with direct package installation feat(plugin): add local rule package foundations Nov 12, 2026
@Qiyuanqiii
Qiyuanqiii marked this pull request as draft November 12, 2026 09:09
@Qiyuanqiii
Qiyuanqiii marked this pull request as ready for review November 12, 2026 09:59

This branch has not been deployed

No deployments
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.

5 participants