Skip to content

ci: cut review workflow latency - #114

Merged
theoneand33 merged 5 commits into
masterfrom
t3/speed-up-review-workflows
Oct 29, 2026
Merged

theoneand33 merged 5 commits into
masterfrom
t3/speed-up-review-workflows

Conversation

@theoneand33

@theoneand33 theoneand33 commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

User description

Speeds up the two PR review workflows.

  • Concurrency: one run per PR, cancel-in-progress kills stale runs on new pushes (both workflows).
  • Fewer triggers: skip docs/asset-only PRs (paths-ignore), skip draft PRs, ignore non-command PR Agent comments, and drop review_requested (intentional behavior change: requesting a review no longer re-triggers PR Agent).
  • Fail fast: ai_timeout 600s -> 180s, completion cap 16k tokens via max_output_tokens, no same-model retry on timeout, job timeout-minutes: 15.
  • Draft handling: opencode-review2 now also triggers on ready_for_review/reopened, so draft PRs still get reviewed once promoted.

Kept synchronize on both: dropping it would make cancel-in-progress pointless and stop follow-up commits from being reviewed.

Verified: both files parse as YAML and pass prettier --check.


PR Type

Enhancement, Other


Description

  • Add job-level per-PR concurrency with cancel-in-progress to both review workflows

  • Skip docs/asset-only PRs, draft PRs, and non-command comments

  • Fail fast: ai_timeout 180s, max_output_tokens 16384, job timeouts 15/30 min

  • Trigger opencode-review on ready_for_review/reopened; drop review_requested


Diagram Walkthrough

flowchart TD
  EV["PR event: opened, synchronize, ready_for_review, reopened"]
  SKIP["Skip run: docs / images / flash paths"]
  CONC["Job-level concurrency group per PR"]
  CANCELLED["Cancelled stale run on new push"]
  DRAFT["Skip draft PRs"]
  JOB["PR Agent / opencode-review job"]
  CAPS["ai_timeout 180s, max_output_tokens 16384, job timeout 15/30 min"]
  REVIEW["Review posted or fail fast"]
  EV -- "paths-ignore match" --> SKIP
  EV -- "code changed" --> CONC
  CONC -- "new push, cancel-in-progress" --> CANCELLED
  CONC -- "active run" --> DRAFT
  DRAFT -- "not a draft" --> JOB
  JOB -- "bounded model calls" --> CAPS
  CAPS --> REVIEW
Loading

File Walkthrough

Relevant files
Configuration changes
opencode-review2.yaml
Speed up opencode-review with concurrency, filters, and timeout

.github/workflows/opencode-review2.yaml

  • Add ready_for_review and reopened to pull_request trigger types
  • Add paths-ignore for **.md, public/images/**, public/flash/**
  • Move concurrency to job level with cancel-in-progress: true, keyed by
    PR number
  • Skip draft PRs via if guard and add timeout-minutes: 30
+11/-1   
pr-agent.yml
Tighten PR Agent triggers, concurrency, and token limits 

.github/workflows/pr-agent.yml

  • Drop review_requested trigger and add paths-ignore for docs/asset
    paths
  • Add job-level concurrency that cancels only on pull_request_target
    pushes
  • Extend if to skip bot senders, draft PRs, and comments not starting
    with / (excluding /oc, /opencode)
  • Replace custom_model_max_tokens 131072 with max_output_tokens 16384,
    lower ai_timeout to 180s, disable same-model retry, add
    timeout-minutes: 15
+16/-5   

Add per-PR concurrency with cancel-in-progress, skip docs/asset-only
PRs and drafts, and ignore non-command comments. Cap ai_timeout and
max output tokens so stuck runs fail fast.
@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
superfun-games Ready Ready Preview Oct 29, 2026 10:25pm UTC

@opencode-agent

Copy link
Copy Markdown
Contributor

Review: PR #114 — ci: cut review workflow latency

Overall the changes are reasonable and the YAML is valid. One functional regression and a couple of config mislabels worth addressing.

Blocking

1. Draft PRs will never be reviewed by opencode-review2
.github/workflows/opencode-review2.yaml:5,17

The workflow only triggers on opened and synchronize, but now skips when draft == true. A PR opened as a draft is skipped on opened, skipped on every synchronize while it stays a draft, and there is no ready_for_review trigger — so marking it ready runs nothing. Add ready_for_review (and probably reopened for parity) to the types list:

types: [opened, synchronize, ready_for_review, reopened]

pr-agent.yml already handles this correctly with ready_for_review in its types.

Should fix

2. custom_model_max_tokens: 16384 is not just an output cap
.github/workflows/pr-agent.yml:35

In PR-Agent, custom_model_max_tokens overrides the model's total token budget (prompt + output); the output-only knob is config.max_output_tokens (or [openrouter] max_tokens). Combined with the default max_model_tokens = 32000, this change drops the effective budget from 32000 to 16384, roughly halving the diff the agent can see and causing more clipping on large PRs. If the intent is only to cap completion length, use config.max_output_tokens: "16384" and leave custom_model_max_tokens alone.

3. contains(github.event.comment.body, '/') is too broad
.github/workflows/pr-agent.yml:20

Any comment containing a slash (URLs, src/foo.ts, "and/or") starts the full PR Agent container, and comments like /oc intended for opencode.yml will also wake PR Agent. Use startsWith(...) against the real command prefixes, e.g. startsWith(github.event.comment.body, '/review') || startsWith(..., '/describe') || startsWith(..., '/improve') (or trim first).

Minor / notes

  • timeout-minutes: 15 vs. ai_timeout: 180 (pr-agent.yml:22,36): PR-Agent defaults to num_retries = 4 with retry_same_model_on_timeout = true, so a single timed-out call can consume 5 × 180s = 15 min, and auto_review + auto_describe are two calls. The job timeout can kill otherwise-valid runs. Consider a lower num_retries/ai_timeout or a higher job timeout.
  • Removing review_requested is a behavior change, not a de-dupe (pr-agent.yml:5,43): it's the only event fired when someone requests a review, so re-requesting a review no longer re-triggers the bot. Fine if intentional, but the PR description calls it "duplicate," which isn't accurate.
  • paths-ignore and required checks (opencode-review2.yaml:6-9): if opencode-review is a required status check, docs/asset-only PRs will leave it pending/absent and block merge. Verify branch protection before merging.
  • paths-ignore is ignored for the issue_comment trigger; harmless, just noting it doesn't apply there.

The concurrency groups are correct (PR number is always present for pull_request/pull_request_target, and issue.number covers comments), and null != true correctly lets issue_comment events past the draft guard.

github run

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Speeds up both review workflows with per-PR concurrency, draft and path filters, and shorter model limits.

  • OpenCode reviews skip asset-only changes and cancel stale runs.
  • PR Agent runs selectively and stop under tighter time and output caps.

Reviews (5) · Last reviewed commit: "ci: keep explicit PR Agent commands from..." · Reviewed by Greptile

Comment thread .github/workflows/pr-agent.yml Resolved
Comment thread .github/workflows/opencode-review2.yaml Resolved
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit e0c8e78)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Command Cancellation

The concurrency group is shared by pull_request_target and issue_comment runs with cancel-in-progress: true. A push to the PR while a user-initiated /review or /describe run is in progress cancels that command run, and two commands posted back-to-back cancel each other. If command runs must always complete, give issue_comment runs a distinct group or disable cancellation for them.

concurrency:
  group: pr-agent-${{ github.event.pull_request.number || github.event.issue.number }}
  cancel-in-progress: ${{ github.event_name == 'pull_request_target' }}
✅ Resolved findings

.github/workflows/pr-agent.yml:20

Comment Filter

contains(github.event.comment.body, '/') matches almost any comment containing a URL (https://...), a file path (src/foo.ts), a date (10/29), or and/or. Such comments are common, so the guard does not achieve the stated goal of ignoring non-command comments and still starts runs on them. Match the command position instead, e.g. startsWith(github.event.comment.body, '/') after trimming, or check against the known command list.

.github/workflows/opencode-review2.yaml:5-17

Draft PR Gap

The workflow only triggers on opened and synchronize, and the new job guard skips runs while github.event.pull_request.draft is true. A PR opened as a draft is skipped, and marking it ready for review fires ready_for_review, which is not in the types list, so no review runs until another commit is pushed. The pr-agent workflow adds ready_for_review for exactly this case; add it here too or remove the draft guard.

Trigger opencode-review on ready_for_review/reopened so draft PRs are
reviewed once promoted. Use max_output_tokens (completion cap) instead
of custom_model_max_tokens (total budget), skip same-model retries on
timeout, and only treat comments starting with / as commands.
@opencode-agent

Copy link
Copy Markdown
Contributor

Reviewed the two workflow files at HEAD (b97ea62). The follow-up commit fixed the earlier draft-PR gap, the custom_model_max_tokens mislabel, and the over-broad contains(..., '/') filter. One real regression remains.

Blocking

Ordinary comments can cancel an in-flight PR Agent review
.github/workflows/pr-agent.yml:13-20

concurrency is at the workflow level with cancel-in-progress: true, while the command filter is a job-level if. Every issue_comment run enters the pr-agent-<number> group before the job is skipped. So a comment like "thanks" (or any bot-excluded/non-/ comment) cancels the currently running review, then its own job is skipped and nothing replaces it. This is a new failure mode introduced by this PR, since before there was no concurrency.

Move concurrency under pr_agent_job (job-level concurrency isn't acquired by skipped jobs), or split the groups, e.g.:

concurrency:
  group: pr-agent-${{ github.event.pull_request.number || github.event.issue.number }}-${{ github.event_name }}
  cancel-in-progress: ${{ github.event_name == 'pull_request_target' }}

The second form also prevents a push from cancelling a user-requested /review, and two back-to-back commands from cancelling each other — both arguably undesirable for explicit commands.

Minor

  • Job timeout vs. retries (pr-agent.yml:22,36): retry_same_model_on_timeout: "false" helps, but num_retries is still at its default and auto_review + auto_describe are two calls. timeout-minutes: 15 can still truncate legitimate runs; consider lowering ai_timeout or num_retries, or raising the job timeout.
  • startsWith(..., '/') still routes opencode's /oc comments to PR Agent. Fine if acceptable, but an explicit allowlist (/review, /describe, /improve) is tighter.
  • paths-ignore + required checks (opencode-review2.yaml:6-9): if opencode-review is a required status check, docs/asset-only PRs will have no run and can block merge. Confirm branch protection.
  • paths-ignore doesn't apply to issue_comment; harmless, just note it only filters pull_request_target.

Everything else checks out: ready_for_review/reopened parity is correct, github.event.pull_request.number || github.event.issue.number resolves correctly for both events, and null != true lets comment events past the draft guard.

github run

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit b97ea62

A skipped workflow run (non-command comment, draft PR) acquired the
workflow-level group and cancelled an in-flight review. Skipped jobs do
not acquire job-level concurrency groups.
@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit ca51a46

greptile-apps[bot]
greptile-apps Bot previously approved these changes Oct 29, 2026
The 15-minute cap cancelled a real review at the limit.
@greptile-apps
greptile-apps Bot dismissed their stale review October 29, 2026 22:15

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

@opencode-agent

Copy link
Copy Markdown
Contributor

Reviewed HEAD (b1fa9bb) against the base. The earlier draft-PR gap, the custom_model_max_tokens mislabel, and the broad contains(..., '/') filter are all fixed. YAML structure is valid and the config keys used exist in PR-Agent (max_output_tokens, retry_same_model_on_timeout, ai_timeout). No blocking issues, but a few worth addressing.

Should fix

1. Job-level concurrency still cancels explicit commands — .github/workflows/pr-agent.yml:16-18

Now that concurrency is job-level, a non-command comment no longer cancels a review (good). But all issue_comment runs share the pr-agent-<n> group with cancel-in-progress: true, so:

  • a synchronize push cancels an in-flight /review or /describe, and
  • two commands posted back-to-back cancel each other (e.g. /review then /describe).

For user-requested commands that's probably not desired. Scope cancellation to push events:

concurrency:
  group: pr-agent-${{ github.event.pull_request.number || github.event.issue.number }}
  cancel-in-progress: ${{ github.event_name == 'pull_request_target' }}

(or append ${{ github.event_name }} to the group). This keeps the stale-run cancellation for pushes while letting explicit commands finish.

2. /oc and /opencode now wake PR Agent too — .github/workflows/pr-agent.yml:20

startsWith(github.event.comment.body, '/') routes opencode's own commands into PR Agent, since opencode.yml:12-15 handles /oc//opencode. Every /oc comment now starts an extra PR-Agent container that has nothing to do. Use an allowlist of PR-Agent commands instead:

startsWith(github.event.comment.body, '/review') ||
startsWith(github.event.comment.body, '/describe') ||
startsWith(github.event.comment.body, '/improve') ||
startsWith(github.event.comment.body, '/ask')

Notes / verify before merge

  • paths-ignore vs. required checks (opencode-review2.yaml:6-9, pr-agent.yml:6-9): if opencode-review or pr-agent is a required status check, docs/asset-only PRs will have no run and can block merge. Confirm branch protection settings. (Also note paths-ignore only filters pull_request_target, not issue_comment — harmless.)
  • timeout-minutes: 15 (pr-agent.yml:22) vs ai_timeout: 180: disabling same-model retry on timeout avoids the 5×180s case, but num_retries (default 4) still applies to provider-reject retries and auto_describe can make several calls. Likely fine, but it's the tightest bound here.
  • Dropping custom_model_max_tokens is safe: max_model_tokens (default 32000) still caps the prompt budget, and max_output_tokens: 16384 is the separate completion cap, so this is not a prompt-budget regression.
  • review_requested removal is now documented as intentional, so no issue.

Looks correct

  • ready_for_review/reopened on opencode-review2 closes the draft gap; draft == false works for ready_for_review.
  • null != true correctly lets issue_comment events past the draft guard (so /review still works on draft PRs).
  • github.event.pull_request.number || github.event.issue.number resolves for both event types.
  • Job-level concurrency for opencode-review prevents skipped draft runs from cancelling active reviews.

Verdict: non-blocking; items 1–2 are the ones I'd change before merge.

github run

greptile-apps[bot]
greptile-apps Bot previously approved these changes Oct 29, 2026
@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit b1fa9bb

Only push events cancel in-flight work, and /oc comments stay with the
opencode workflow.
@greptile-apps
greptile-apps Bot dismissed their stale review October 29, 2026 22:24

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit e0c8e78

@theoneand33
theoneand33 merged commit 93bed74 into master Oct 29, 2026
5 of 6 checks passed
@theoneand33
theoneand33 deleted the t3/speed-up-review-workflows branch October 29, 2026 23:15

This branch was successfully deployed

1 active deployment
Preview — e0c8e783 Deployed Oct 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant