Skip to content

feat: add external draft reviews with human handoff - #28

Merged
ccsert merged 4 commits into
mainfrom
feat/27-draft-review
Oct 24, 2026
Merged

ccsert merged 4 commits into
mainfrom
feat/27-draft-review

Conversation

@ccsert

@ccsert ccsert commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Merged as 0d3fd4fbaba36e32df0cffdb9917a4b6864c50a8. Main CI and release passed, including published-image testing. latest and the merge-SHA tag were verified to share digest sha256:5eb1ba123d1fe20caf26f613fb2fc52c54ad2d7196d5eae9eaf2d9143cd0da3c (amd64/arm64).

A reviewer can run Docker externally for a selected Gitea/Forgejo repository and PR, let AI prepare pending line comments under their own account, then edit and submit the review through the native UI. The target repository needs no workflow or checkout. Default submit behavior remains available.

Fixes #27.

Behavior and safeguards

  • REVIEW_MODE=draft forces native PENDING, regardless of the model's recommendation.
  • Require a persistent REVIEW_OUTPUT_DIR for the Markdown summary, structured analysis and recovery state.
  • Keep the AI summary local: tested servers can expose a PENDING review's body through the issue timeline API. Only a non-sensitive handoff placeholder is sent in that field.
  • Reuse untouched drafts; stop on existing human drafts, manual edits, stale PR snapshots or concurrent runs. Reconcile ambiguous writes without another POST.
  • Recognize manual submission without creating another review or advancing the automated incremental baseline. Automatic submit mode refuses to absorb an existing pending review.

Try it

This change is now merged and available in ghcr.io/ccsert/opencode-review:latest. Use the published-image instructions to try it directly. The commands below build a local development image.

docker build --build-arg OPENCODE_VERSION=1.19.4 -t opencode-review:draft .
mkdir -p review-output
# Export GITEA_TOKEN (the human reviewer's token), GITEA_SERVER_URL
# and DEEPSEEK_API_KEY in this shell first.
# Token scopes: read:user, write:repository, write:issue.
docker run --rm \
  -v "$(pwd)/review-output:/review-output" \
  -e GITEA_TOKEN -e GITEA_SERVER_URL -e DEEPSEEK_API_KEY \
  -e REPO_OWNER=your-org -e REPO_NAME=your-repo -e PR_NUMBER=123 \
  -e REVIEW_MODE=draft -e REVIEW_OUTPUT_DIR=/review-output \
  opencode-review:draft

Sign in as the token's account, open the returned Files page, edit pending comments, copy the exported Markdown summary into the review form, and manually choose Comment/Approve/Request Changes. The summary form is not prefilled.

The usage guide includes custom OpenAI-compatible gateway configuration, persistent-state recovery and concurrency limits. Both READMEs now introduce the external workflow.

Local validation

  • 142 unit tests / 353 assertions; 48 real two-server API integration tests / 250 assertions. Regression cases include owners/repositories named pulls.
  • Type checking, shell syntax, documentation links, provider JSON and command syntax passed. Scoped tokens with read:user, write:repository and write:issue completed production draft runs on both servers.
  • Docker + real OpenCode tool dispatch passed in submit/draft modes on Gitea 1.24.6 and Forgejo 17.0.0 with the deterministic protocol fixture. Linux smoke checks read 0600 exports through the container, preserving file privacy.
  • One real custom MiniMax model run per server, followed by native browser editing/submission and two-account visibility checks. Repeat invocations reused the review; edited drafts stopped; submitted drafts were recognized.
  • The acceptance record separates model inference, lifecycle replays and local build evidence. The local acceptance image reused a validated OpenCode 1.19.4 runtime; a fresh local dependency build stalled. The final commit's remote CI also passed the clean Dockerfile build, both review-mode protocol checks on both servers and the amd64/arm64 image build.

Screenshots and compatibility

Pending comments belong to the human reviewer's account:

Native pending line comments

After manual submission, another ordinary collaborator can read the result:

Manually submitted review visible to a collaborator

Gitea 1.24.6 can remove the exact placeholder timeline entry. Forgejo 17.0.0 retains it and reports PENDING_TIMELINE_RETAINED; the native conversation can display the same review twice after manual submission, with one review ID. AI findings are withheld from ordinary collaborators on the tested endpoints, but server administrators and metadata/notification side effects remain platform concerns.

CI: Run 40070077028 passed for 003c3d9498560520077aaf4572df8434163a633c. The PR workflow validates builds without publishing an image.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T06:15:17.744910Z 0255b59 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0255b594bb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .opencode-review/lib/draft-review.ts Resolved
@ccsert
ccsert merged commit 0d3fd4f into main Oct 24, 2026
3 checks passed
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.

[Q] Can this be set up in "draft" mode?

1 participant