alibaba / alibaba/open-code-review
OpenCode review tool fails with long background context
- Dominant language
- Go
- Stars
- 24.4k
- Forks
- 1.8k
- Avg merge
- 2d 4m
- Merged PRs (30d)
- 102
Description
### OpenCodeReview Version
```text
open-code-review v1.9.7 (f269d0ce0) darwin/arm64
```
### Operating System
macOS (Apple Silicon)
### Installation Method
npm (global)
### LLM Provider
Other OpenAI-compatible endpoint
### Bug Description
The official OpenCode plugin exposes only a `background` string and always passes it to OCR through `--background`.
With multi-paragraph review context:
- `ocr_review` preview succeeds.
- The full `ocr_review` call exits immediately without creating an OCR session.
- OpenCode reports only `OpenCodeReview exited with code 1.`
- Running the same review and context directly with `--background-file` creates the OCR session and proceeds normally.
The adapter also discards the child process termination signal. Its `close` handler converts a null exit code to `1`, so the caller cannot distinguish a signal termination from a normal exit and receives no useful diagnostic when stdout and stderr are empty.
### Steps to Reproduce
1. Install the official OpenCode plugin from this repository.
2. Invoke `ocr_review` in preview mode for a branch range and confirm the file selection succeeds.
3. Invoke the full review with a multi-paragraph `background` value.
4. Observe the generic exit-code error and confirm that `ocr session list` contains no new session.
5. Save the same background text to a Markdown file and run:
```shell
ocr review --from main --to feature --background-file context.md
```
6. Observe that OCR creates a session and starts reviewing normally.
### Expected Behavior
The OpenCode adapter should support large review context without silently losing the OCR process.
Suggested options:
- Expose a `backgroundFile` tool argument.
- Transparently write long background text to a private temporary file and pass `--background-file`.
- Remove the temporary file on success, failure, or cancellation.
- Preserve and report the child process exit signal alongside stdout and stderr.
### Logs / Error Output
```shell
OpenCodeReview exited with code 1.
```
No OCR session is created for the failed tool call and no stdout or stderr is returned.
### Additional Context
The failure was reproduced twice through the OpenCode tool. LLM connectivity and OCR preview both passed immediately before the full calls. The direct `--background-file` run used the same provider, refs, and review context.
OpenCode version: `1.18.18`.
Contributor guide
Research direction
Start at the OpenCode adapter handling the ocr_review tool and its child-process close handler. Compare the existing --background path with the working --background-file invocation, then reproduce the multi-paragraph case. Done means large context completes without losing the OCR session and failures report the termination signal plus available output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100