Repository navigation
feat: review Alex's PR submissions with OpenCode #1150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexsoyes
wants to merge
39
commits into
next
Choose a base branch
from
feat/opencode-review-after-submit
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,012
β100
Open
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
39dc995
feat(ci): prototype OpenCode reviews after submission
alexsoyes 11cc56a
refactor(ci): separate OpenCode review resources
alexsoyes 51e7649
refactor(ci): run personal reviews on the OpenCode server
alexsoyes 57e11fd
fix(ci): run review entrypoint through release link
alexsoyes 37624fa
fix(ci): include git modes in review coverage
alexsoyes 90f23ee
fix(ci): retry transient git recovery failures
alexsoyes 8a56aba
fix(ci): review each file in one session
alexsoyes 9130506
refactor(ci): simplify automatic review flow
alexsoyes 5b4535c
fix(ci): bound review context
alexsoyes c51c9d2
feat(ci): run AIDD reviews on an isolated runner
alexsoyes 7fcbd13
fix(ci): smoke-test OpenCode as the reviewer
alexsoyes adcd8be
test(ci): exercise review workflow on its branch
alexsoyes bb3ee8f
fix(ci): stop the review runner cleanly
alexsoyes 7f30b5f
test(ci): restore the scheduled review trigger
alexsoyes ea1b5b8
fix(ci): protect review runner registration
alexsoyes 9c44252
test(ci): exercise a review on the server
alexsoyes b0da005
test(ci): restore the production review trigger
alexsoyes 44cd5b2
fix(ci): retry transient runner download failures
alexsoyes 198e86f
test(ci): verify pull request comment permissions
alexsoyes 5234bec
fix(ci): grant pull request comment access
alexsoyes 337abcc
docs: record the server review test
alexsoyes 84f5a2e
fix(ci): prevent symlink access to model credentials
alexsoyes b9ff0f1
test(ci): exercise the manual OpenCode workflow
alexsoyes 0c8e630
test(ci): restore manual OpenCode triggers
alexsoyes 17c3002
docs: record manual OpenCode verification
alexsoyes a0a75d4
docs: explain isolated runner setup
alexsoyes b342e51
docs: document remote Codex authentication
alexsoyes 13d7704
fix(ci): stop repeating failed reviews
alexsoyes d19de25
feat(ci): support contextual PR conversations
alexsoyes a2bb9d1
test(ci): exercise a real review thread
alexsoyes 20da4d0
test(ci): restore normal conversation triggers
alexsoyes c7c94d3
docs(ci): plan opencode review simplification
alexsoyes b18594a
fix(ci): simplify opencode pull request reviews
alexsoyes 9683df5
test(ci): separate pull request review tests
alexsoyes bba5891
fix(cli): install project plugins despite user scope
alexsoyes 24d05bc
fix(cli): disable lifecycle scripts when fetching plugins
alexsoyes a0953a6
fix(ci): use installed project skills directly
alexsoyes 3b7071d
fix(ci): prepare isolated central review runner
alexsoyes 407a170
docs(ci): describe central listener preparation
alexsoyes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: AIDD review | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '*/5 * * * *' | ||
| workflow_dispatch: | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: aidd-opencode-review | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| review: | ||
| if: github.ref == 'refs/heads/main' | ||
| runs-on: | ||
| group: aidd-opencode-review | ||
| timeout-minutes: 60 | ||
| permissions: | ||
| contents: read | ||
| issues: read | ||
| pull-requests: read | ||
| steps: | ||
| # Scheduled runs and allowed manual runs execute trusted default-branch code. | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: ${{ github.sha }} | ||
| persist-credentials: false | ||
|
|
||
| - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 | ||
| id: app-token | ||
| with: | ||
| app-id: ${{ secrets.AIDD_BOT_APP_ID }} | ||
| private-key: ${{ secrets.AIDD_BOT_PRIVATE_KEY }} | ||
| permission-contents: read | ||
| permission-pull-requests: write | ||
|
|
||
| - name: Review new submissions | ||
| env: | ||
| GH_REPO: ${{ github.repository }} | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| GH_REVIEW_TOKEN: ${{ github.token }} | ||
| REVIEW_BOT_LOGIN: ${{ steps.app-token.outputs.app-slug }}[bot] | ||
| REVIEW_MODEL_RUNNER: /opt/aidd/run-review | ||
| AIDD_REVIEW_ENABLED_AT: ${{ vars.AIDD_REVIEW_ENABLED_AT }} | ||
| run: bash scripts/pr-review/discover.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,29 @@ permissions: | |
| contents: read | ||
|
|
||
| jobs: | ||
| opencode-review: | ||
| name: OpenCode review tests | ||
| runs-on: ubuntu-latest | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Slim? |
||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| - run: bash scripts/__tests__/pr-review/test-review.sh && bash scripts/__tests__/pr-review/test-setup-project.sh | ||
| - name: Build and smoke-test both images | ||
| run: | | ||
| docker build -t aidd-opencode:local docker/aidd-opencode | ||
| docker build -f docker/aidd-opencode/runner/Dockerfile -t aidd-review-runner:ci . | ||
| docker run --rm --user reviewer -e HOME=/home/aidd --entrypoint sh aidd-review-runner:ci -c ' | ||
| opencode --version && node --version && jq --version && test -x /opt/aidd/run-review | ||
| ' | ||
| docker run --rm --entrypoint sh aidd-review-runner:ci -c ' | ||
| cd /home/runner/actions-runner | ||
| umask 022; touch .runner .credentials .credentials_rsaparams | ||
| /opt/aidd/runner >/dev/null 2>&1 || : | ||
| for file in .runner .credentials .credentials_rsaparams; do | ||
| test "$(stat -c %a "$file")" = 600 || exit 1 | ||
| done | ||
| ' | ||
| - run: bash scripts/__tests__/pr-review/test-runner.sh | ||
|
|
||
| lefthook: | ||
| name: lefthook (framework-local checks) | ||
| runs-on: ubuntu-latest | ||
|
|
||
81 changes: 81 additions & 0 deletions
81
aidd_docs/tasks/2026_11/2026_11_05_opencode_pr_review/phase-1.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| --- | ||
| status: pending | ||
| --- | ||
|
|
||
| # Instruction: Simplify the runtime and workflows | ||
|
|
||
| ## Architecture projection | ||
|
|
||
| ```txt | ||
| . | ||
| βββ .github/ | ||
| β βββ workflows/ | ||
| β βββ opencode-review.yml βοΈ | ||
| β βββ opencode.yml βοΈ | ||
| β βββ validate.yml βοΈ | ||
| βββ docker/ | ||
| β βββ aidd-opencode/ | ||
| β βββ Dockerfile βοΈ | ||
| β βββ review-prompt.txt βοΈ | ||
| β βββ runner/ | ||
| β βββ Dockerfile βοΈ | ||
| β βββ Dockerfile.dockerignore βοΈ | ||
| β βββ dispatch.sh βοΈ | ||
| β βββ policy.json βοΈ | ||
| β βββ run-review.sh βοΈ | ||
| β βββ runner.sh βοΈ | ||
| βββ scripts/ | ||
| βββ pr-review/ | ||
| βββ discover.sh β | ||
| βββ conversation-prompt.sh β | ||
| βββ model.sh βοΈ | ||
| βββ review.sh βοΈ | ||
| βββ test-review.sh βοΈ | ||
| βββ test-conversation.sh β | ||
| βββ test-model.sh β | ||
| ``` | ||
|
|
||
| Delete an existing runtime component instead of modifying it if it becomes unnecessary; do not retain an image, wrapper, or trace check solely because it already exists. | ||
|
|
||
| ## Test Scope | ||
|
|
||
| | Scenario | Action | Observable outcome | Actor | | ||
| | --- | --- | --- | --- | | ||
| | Setup | Prepare temporary projects with and without a manifest. | The CLI and plugin choices are visible. | cli | | ||
| | Happy path | Review a PR using Git and `gh`. | OpenCode sees the diff and discussion and a response reaches the PR conversation. | cli | | ||
| | Edge case | Repeat a submission or make GitHub unavailable. | Unchanged files are skipped; a failure is reported without claiming success. | cli | | ||
| | Teardown | Remove temporary projects and local smoke scripts. | No disposable test script is committed. | system | | ||
|
|
||
| ## Tasks to do | ||
|
|
||
| ### `1)` Install the project runtime with `npx` | ||
|
|
||
| > Address [project installation](https://github.com/ai-driven-dev/framework/pull/1150#discussion_r4487456681), [OpenCode focus](https://github.com/ai-driven-dev/framework/pull/1150#discussion_r4487458728), and [skill access](https://github.com/ai-driven-dev/framework/pull/1150#discussion_r4487466671). | ||
|
|
||
| 1. Read `.aidd/manifest.json` when present and select the recorded project tool's CLI version. Use the OpenCode entry when available; do not mistake the top-level schema `version` for a CLI version. If a present manifest does not identify an unambiguous version, report that fact. When the manifest does not exist, use `@latest` as requested. | ||
| 2. Use `npx` to install the project's recorded plugins from their available sources in a temporary directory, then expose that installation to OpenCode while it reads the separate Git checkout. For the default AIDD marketplace, the verified command is `npx --yes @ai-driven-dev/cli@<version> setup --source remote --ai opencode --plugins <names> --yes`. For other marketplaces or local plugins, use their recorded sources when available; report any missing plugin rather than silently omitting it. Without an inventory, the CLI's non-interactive default installs no plugins; report that the list was unavailable. Do not treat the absence of a manifest as proof that the original project has no installation. | ||
| 3. The CLI version and remote marketplace release are distinct: `--source remote` selects the current catalog unless a release is supplied. Report any plugin version difference; do not claim an exact restoration without checking it. Provide the existing read-only GitHub token to setup as `AIDD_TOKEN` when needed, including when the unauthenticated GitHub quota is exhausted. Never expose `.aidd/auth.json` or print the token. | ||
|
|
||
| ### `2)` Review the repository and answer the PR | ||
|
|
||
| > Address [reviewer prompt](https://github.com/ai-driven-dev/framework/pull/1150#discussion_r4487478874) and [model script clarity](https://github.com/ai-driven-dev/framework/pull/1150#discussion_r4487490485). | ||
|
|
||
| 1. Give OpenCode access to the repository and the submitted commit's diff with `git diff`; fetch enough history for the correct base. Make the PR conversation available with `gh pr view --comments` and inline review comments with `gh api --paginate repos/<owner>/<repo>/pulls/<number>/comments`. | ||
| 2. Ask for a reviewer to inspect the code and answer. Use an available OpenCode subagent when the project supplies no reviewer; do not name a particular implementation in the prompt, force skill calls, or block installed skills. Use a trusted OpenCode policy to allow the needed Git and `gh` reads while preventing execution of PR-controlled scripts with credentials; do not rely on the prompt alone. | ||
| 3. Give the reviewer a repository-scoped read token for `gh`. Keep the existing write token in the trusted workflow, which publishes the answer with `gh pr comment` in the PR conversation or the review-comment reply endpoint for an inline thread. Do not run untrusted PR scripts with credentials or expose tokens in logs. | ||
| 4. Preserve review of the submitted commit and skipping previously reviewed unchanged files. Keep failure and publication behavior honest, without retaining extra batch or trace machinery unless it protects a concrete requirement. | ||
|
|
||
| ### `3)` Extract the workflow scripts | ||
|
|
||
| > Address [scheduled workflow](https://github.com/ai-driven-dev/framework/pull/1150#discussion_r4487413205) and [conversation workflow](https://github.com/ai-driven-dev/framework/pull/1150#discussion_r4487446466). | ||
|
|
||
| 1. Move the long workflow shell blocks into the scripts above. Execute the conversation script from the trusted default-branch checkout, not the PR checkout with access to `GH_TOKEN`. | ||
| 2. Add a short purpose comment at the top of each retained or new shell script. After local verification, delete the disposable [conversation test](https://github.com/ai-driven-dev/framework/pull/1150#discussion_r4487491271) and [model test](https://github.com/ai-driven-dev/framework/pull/1150#discussion_r4487493416), and remove their CI invocations. | ||
|
|
||
| ## Test acceptance criteria | ||
|
|
||
| | Task | Acceptance criteria | | ||
| | --- | --- | | ||
| | 1 | The existing manifest selects its project CLI version and listed plugins; inaccessible plugin sources are reported. A missing manifest invokes `@latest` and does not invent a plugin inventory. Setup leaves the Git checkout unchanged. | | ||
| | 2 | The reviewer can inspect the submitted diff and PR conversation and call installed skills; the trusted workflow publishes its `gh` reply without giving it the write token. Unchanged files are skipped and failures remain visible. | | ||
| | 3 | Both workflows invoke trusted external scripts, retained shell scripts state their purpose, and the two disposable tests are absent from the tree and CI. | |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Really necessary? Slim is preferable