Repository navigation
feat(acp): support ACP service for OpenCodeReview - #1218
Conversation
|
🔍 OpenCodeReview found 10 issue(s) in this PR.
|
Qiyuanqiii
left a comment
There was a problem hiding this comment.
The overall Phase 4 direction looks solid, and the amount of validation and test coverage here is good. CI, ACP CI, and CodeQL are green.
I’m requesting changes for two clarification-state issues before merge:
-
I confirmed the existing finding in
finalizeReview: a commit review with a missing commit is stored back asreviewRange, andreviewClarifyQuestion(["commit"])consequently asks for--toinstead of--commit. This should preservereviewCommit, use a commit-specific question, and have regression coverage for both the pending state and the question text. -
In the natural-language path, the pending slots are included in the next model prompt but are not deterministically merged with the next tool-call result. A valid follow-up response containing only the newly supplied field can therefore discard fields already known from the previous turn. I left an inline comment on the fresh
pendingSlotsconstruction with a concrete example.
I also agree that protecting structural ExtraBody fields and the managed anthropic-version header would be worthwhile hardening, but I would not make the lower-severity URL/error-snippet/Makefile findings blockers by themselves.
Once the two state-machine issues above are addressed and covered by multi-turn tests, I think this will be much closer to approval.
|
Please explicitly complete the AI/LLM disclosure required by the current PR template: either state that no AI/LLM was used, or, if it was used, disclose the tool(s) and specific model(s). |
|
@Qiyuanqiii Thanks for the detailed review. I addressed the two clarification-state issues you identified.
I also added coverage for clearing clarification state when the model returns no partial intent, and for preventing stale slash-command selectors from leaking across review types. The fixes are included in commits
I agree that protecting structural I have also updated the AI/LLM disclosure to explicitly identify the tools and models used during development. |
|
@PrayWithYou Thanks for the follow-up review. Commit 42d84af addresses the remaining clarification and cancellation issues.
|
c3a8672 to
be13c62
Compare
|
Follow-up: the tool-call details added by While re-verifying the structured progress work on Windows, I found that the client used for the VS Code side of the manual acceptance does not render tool-call Client behaviour
The I filed the gap upstream with the code references, a generic payload example and a minimal repro: What this means for the adapter Nothing needs to change here. With an |
Add an independent stdio adapter with validated slash commands and optional natural-language parsing, managed review/scan subprocesses, bounded log progress, readable findings and safe file navigation. Support Unix process groups and Windows Job Objects with cancellable stdio. Include protocol and lifecycle tests, platform builds, release packaging and five-language guides. Constraint: Keep OCR CLI source and prompts unchanged Constraint: Windows CI performs compile checks only Rejected: Custom CLI stage-progress instrumentation | Couples the adapter to changes in the review engine Confidence: high Scope-risk: moderate Tested: Local root and ACP checks, race tests, ACP coverage 91.1%, Python SDK smoke, real CLI contract tests, Windows amd64/arm64 builds, documentation build Tested: Squashed commit tree identical to the previous branch head Not-tested: Final native Windows and graphical-client acceptance; published-artifact installation Not-tested: OCR review not rerun at user request Directive: Preserve CLI independence and validate Windows process cleanup on native Windows Related: alibaba#1218
210f52b to
7895e95
Compare
Provide an independent stdio adapter with validated slash commands, optional natural-language parsing, managed review subprocesses, bounded progress and safe file navigation. Include cross-platform process management, protocol and lifecycle tests, release packaging and five-language setup guides. Document experimental RISC-V source builds and historical validation limits. Keep local OMX runtime state out of the repository ignore rules. Constraint: Keep OCR CLI source and prompts unchanged Constraint: Windows CI performs compile checks only Confidence: high Scope-risk: moderate Reversibility: clean Tested: Pre-commit OCR review completed with zero findings across one selected item Tested: Squashed index tree matches the previous branch head exactly; LF normalization Not-tested: Runtime tests not rerun for this history-only squash Directive: Preserve CLI independence and validate Windows process cleanup on native Windows Related: alibaba#1218
f815af2 to
c4cc07c
Compare
Provide an independent stdio ACP adapter with validated slash commands, optional natural-language parsing, managed review subprocesses, bounded progress, safe file navigation, release packaging, and multilingual guides. Preserve scan targets and parser URL queries, redact credentials, bound version capture, retain timeout metadata, and safely drain and cancel Windows I/O. Handle Darwin zombie-group cleanup races and clean shared test artifacts. Consolidate the ACP implementation and verified follow-up fixes into one commit while preserving the previous branch tip tree exactly. Constraint: Keep OCR CLI source and prompts unchanged; add no new dependencies Confidence: high Scope-risk: moderate Reversibility: clean Tested: Squashed tree is identical to f815af2 Tested: ACP make check and make coverage passed before squash; 91.2% coverage Tested: Prior six-platform builds and official Python ACP client smoke test Not-tested: Native Windows execution; Windows tests were cross-compiled Not-tested: No runtime tests rerun for this history-only squash Not-tested: Pre-squash OCR command skipped the clean worktree; previous model review hit network errors and independent source review found no blockers Directive: Keep copier cancellation synchronized with OS thread retirement Related: alibaba#1218
613fd89 to
c17a53a
Compare
|
One thing I want to clarify before treating the current ACP interface as stable is that both the command coverage and the natural-language intent contract are still expected to evolve. The current ACP adapter starts with This also applies to future OCR features. For example, #1510 proposes a new The natural-language parsing layer is also still an initial version. It currently maps free-form requests into the structured review/scan intent schema, but the conventions around intent selection, clarification, rejection, argument inheritance, unsupported capabilities, and how newly added OCR features should be described to the parser LLM still need further refinement and testing. The current prompt and tool schema should therefore not be treated as a finalized long-term contract yet. My intention for this PR is primarily to establish the ACP foundation: the protocol boundary, session lifecycle, OCR process orchestration, cancellation and timeout handling, progress/result mapping, and an initial working interface for review and scan. Once the ACP integration is in use and the expected command coverage becomes clearer, I plan to follow up on the higher-level command surface and natural-language parser contract separately, including how new OCR capabilities such as #1510 should be represented. |
cf55607 to
f4a8ffe
Compare
|
The CI failures were caused by the Go toolchain vulnerability scan, not by the ACP implementation. The ACP workflow was using Go 1.26.6, which contains standard-library vulnerabilities fixed in Go 1.26.9. I have updated the ACP CI workflow separately to use Go 1.26.9. The same issue also affects the root project CI, together with vulnerabilities in the root module's The ACP code and tests were not the cause of the CI failures. |
1a8ea77 to
787e949
Compare
Add an independent stdio ACP adapter with slash commands, optional natural-language parsing, managed review/scan processes, CI, and multilingual setup docs. Keep the OCR CLI source and prompts unchanged. * refactor(acp): add ACP adapter and supporting services * ci(acp): use patched Go toolchain * docs(acp): trim support caveats and sync CI notes Drop dated verification claims and the prebuilt-binary disclaimer so the adapter docs match the current local-build story and acp-ci.yml.
787e949 to
73f651a
Compare




ACP Module Architecture
The module keeps the ACP protocol boundary independent from OCR's core review engine. The adapter owns client-facing sessions and orchestration, while the existing
ocrbinary remains responsible for review execution and its review LLM.flowchart LR C["ACP clients<br/>Paseo / Zed / JetBrains"] T["JSON-RPC 2.0 transport<br/>stdio"] S["ocr-acp<br/>ACP Server"] SE["Session and command layer<br/>available_commands_update<br/>session/prompt / session/cancel"] IP["Intent parser<br/>slash commands / natural language<br/>clarification state"] O["OCR process orchestrator<br/>timeouts / cancellation / cleanup<br/>stdout-stderr isolation"] CLI["Existing ocr CLI<br/>review / scan"] R["Existing CLI output<br/>stderr logs / stdout JSON"] C <--> T T <--> S S --> SE SE --> IP SE --> O O --> CLI CLI --> R R --> O O --> SE SE --> S S --> TThe client sends prompts and commands through the transport.
ocr-acpparses them into a review or scan intent, asks for clarification when required, launches the existing OCR CLI as a child process, and streams progress and structured results back through the same ACP session. Cancellation and timeout signals flow into the process orchestrator, which is responsible for terminating and cleaning up the managed process tree before delivering the final outcome.The implemented transport is stdio and the exposed OCR operations are review and scan. Streamable HTTP and OCR session-command integration are outside this PR's scope.
Why ACP Support
OpenCodeReview (OCR) is Alibaba's open-source AI code review CLI, implemented in Go under the Apache-2.0 license. It has been used by tens of thousands of developers inside Alibaba and has found millions of code defects. OCR uses a hybrid architecture of deterministic engineering and agents: file selection, file-level context isolation, rule matching, comment locations, and reflection are protected by deterministic engineering logic, while agents handle dynamic decisions and context retrieval. This improves accuracy and reduces token consumption under the same model.
Today, OCR maintains a separate plugin or skill for each host, such as Claude Code, Codex, Cursor, and OpenCode. This makes integration work grow with every new host and makes behavior and documentation harder to keep consistent. OCR also cannot currently be discovered or consumed by ACP clients such as Paseo, Zed, and JetBrains ACP Agent Registry, so it has no standard entry point for multi-agent workflows where a general coding agent writes code and OCR acts as a dedicated review agent.
Agent Client Protocol (ACP) is an open protocol for connecting editors/clients with AI agents, with a role similar to LSP. A client implements ACP once and can then use any compatible agent. The client communicates with the agent through a JSON-RPC 2.0 session, sends prompts and commands, receives streaming progress and tool-call updates, gets structured results with file/line locations, and can cancel an in-flight session. The agent only needs to provide an ACP server. This lets OCR replace “one host, one integration” with “one server, every compatible client” and enables standard multi-agent collaboration.
Existing Work and Motivation
OCR already provides:
ocr review,ocr scan,ocr session, andocr delegate;Issue #674 requested registering OCR as an independent provider through ACP for tools such as Paseo. PR #679 added an “ACP server adapter” to the H2 2026 roadmap, with the explicit direction to expose OCR as a dedicated review agent while keeping it decoupled from the core review engine. That roadmap PR is a planning placeholder and contains no implementation.
Design and Scope of This PR
This work follows the roadmap boundary: an independent ACP adapter process wraps the existing
ocrbinary instead of embedding protocol code into OCR's internal review engine.ocr reviewandocr scanas child processes and consumes their structured JSON output; OCR session-command integration remains outside the implemented scope.available_commands_updatenow exposes/review,/scan, and parameter hints so clients can discover the supported entry points.Final Project Goal
Deliver a usable, tested, and documented standalone ACP Server for OCR. A user should be able to configure one command in Paseo or another compatible ACP client, use natural language or slash commands to start a review or scan, see streaming progress and structured line-level findings in the client UI, and cancel the operation at any time. The completed work will land the ACP roadmap item in the upstream
alibaba/open-code-reviewrepository and close issue #674.Type of Change
How Has This Been Tested?
make check,make testandmake buildpassed after restoring CLI source to the PR baseline.make check,make testandmake buildpassed, including the two stderr regression fixes.git diff --checkand LF checks passed.Checklist
Related Issues
AI / LLM Disclosure
This PR was developed with assistance from OpenAI Codex gpt-6-astra. The implementation and tests were reviewed locally and with the repository's OpenCodeReview automation. No external LLM API or API key is required for the test suite; parser LLM integration is covered by deterministic fakes, with real-endpoint coverage remaining opt-in.