ci: resolve issue creation, tighten functional /oc body gate, and add concurrency for OC agent#256
Conversation
- Add GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} to opencode workflow env so
agent can use gh CLI (e.g. gh issue create) with proper auth (#251)
- Remove pull_request_review trigger: /oc in review bodies is not supported
by the opencode action; conversation and line comments still work (#252)
- Expand AGENTS.md commit conventions with explicit Conventional Commits
rules so agent applies them without loading the maintenance skill (#253)
Closes #251
Closes #253
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@coderabbitai review |
✅ Action performedReview finished.
|
📝 WalkthroughWalkthroughThe OpenCode workflow now handles created issue and review comments, uses author-association checks, and provides ChangesOpenCode maintenance
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/opencode.yml:
- Around line 3-18: Add the documented issues, pull_request, schedule, and
workflow_dispatch event declarations to the workflow’s on block alongside
issue_comment and pull_request_review_comment, preserving the required event
types and schedule/manual configuration expected by the existing workflow.
- Around line 20-24: Add a concurrency configuration to the opencode job, using
a group key based on the current issue or pull-request number so runs for the
same discussion are serialized. Set an explicit cancellation policy that
preserves an active run rather than canceling it when a newer comment triggers
another run.
- Around line 22-24: Update the workflow job’s if condition to require the
comment body to contain the supported /oc or /opencode command, in addition to
the existing OWNER or COLLABORATOR author association checks. Ensure ordinary
comments cannot reach anomalyco/opencode/github@latest.
In `@AGENTS.md`:
- Around line 18-21: Update the commit-message guidance in AGENTS.md to match
what lint-pr-title.yml actually validates: narrow the documented scope to PR
titles and remove claims about lowercase wording, imperative mood, length,
trailing periods, and all generated commits unless corresponding enforcement is
added.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ae06abd1-e2bb-44ed-ab0a-17660caf4999
📒 Files selected for processing (2)
.github/workflows/opencode.ymlAGENTS.md
📜 Review details
⚠️ CI failures not shown inline (2)
GitHub Actions: Check Base Branch / 0_Validate Base Branch.txt: ci: add GH_TOKEN and enforce commit conventions for OC agent
Conclusion: failure
##[group]Run BASE="main"
�[36;1mBASE="main"�[0m
�[36;1mHEAD="ci/oc-agent-gh-auth-and-conventions"�[0m
�[36;1m�[0m
�[36;1m# Allow temp-to-temp branch flows (neither base nor head are main/develop)�[0m
�[36;1mif [ "$BASE" != "main" ] && [ "$BASE" != "develop" ] && [ "$HEAD" != "main" ] && [ "$HEAD" != "develop" ]; then�[0m
�[36;1m echo "Base branch check passed: allowing temporary branch flow from '$HEAD' to '$BASE'."�[0m
�[36;1m exit 0�[0m
�[36;1mfi�[0m
�[36;1m�[0m
�[36;1mif [ "$BASE" = "develop" ]; then�[0m
�[36;1m echo "Base branch check passed: targeting 'develop'."�[0m
�[36;1m exit 0�[0m
�[36;1mfi�[0m
�[36;1m�[0m
�[36;1mif [ "$BASE" = "main" ] && [ "$HEAD" = "develop" ]; then�[0m
�[36;1m echo "Base branch check passed: allowing release PR from 'develop' to 'main'."�[0m
�[36;1m exit 0�[0m
�[36;1mfi�[0m
�[36;1m�[0m
�[36;1mif [ "$BASE" = "main" ] && [[ "$HEAD" == docs/whats-new-* ]]; then�[0m
�[36;1m echo "Base branch check passed: allowing automated What's New PR from '$HEAD' to 'main'."�[0m
�[36;1m exit 0�[0m
�[36;1mfi�[0m
�[36;1m�[0m
�[36;1mif [ "$BASE" = "main" ]; then�[0m
�[36;1m echo "Error: Pull requests targeting 'main' must come from the 'develop' branch, not '$HEAD'."�[0m
�[36;1m exit 1�[0m
�[36;1mfi�[0m
�[36;1m�[0m
�[36;1mecho "Error: Pull requests must target 'develop' (or target 'main' only from 'develop'), not '$BASE'."�[0m
�[36;1mexit 1�[0m
shell: /usr/bin/bash -e {0}
##[endgroup]
Error: Pull requests targeting 'main' must come from the 'develop' branch, not 'ci/oc-agent-gh-auth-and-conventions'.
##[error]Process completed with exit code 1.
GitHub Actions: Check Base Branch / Validate Base Branch: ci: add GH_TOKEN and enforce commit conventions for OC agent
Conclusion: failure
##[group]Run BASE="main"
�[36;1mBASE="main"�[0m
�[36;1mHEAD="ci/oc-agent-gh-auth-and-conventions"�[0m
�[36;1m�[0m
�[36;1m# Allow temp-to-temp branch flows (neither base nor head are main/develop)�[0m
�[36;1mif [ "$BASE" != "main" ] && [ "$BASE" != "develop" ] && [ "$HEAD" != "main" ] && [ "$HEAD" != "develop" ]; then�[0m
�[36;1m echo "Base branch check passed: allowing temporary branch flow from '$HEAD' to '$BASE'."�[0m
�[36;1m exit 0�[0m
�[36;1mfi�[0m
�[36;1m�[0m
�[36;1mif [ "$BASE" = "develop" ]; then�[0m
�[36;1m echo "Base branch check passed: targeting 'develop'."�[0m
�[36;1m exit 0�[0m
�[36;1mfi�[0m
�[36;1m�[0m
�[36;1mif [ "$BASE" = "main" ] && [ "$HEAD" = "develop" ]; then�[0m
�[36;1m echo "Base branch check passed: allowing release PR from 'develop' to 'main'."�[0m
�[36;1m exit 0�[0m
�[36;1mfi�[0m
�[36;1m�[0m
�[36;1mif [ "$BASE" = "main" ] && [[ "$HEAD" == docs/whats-new-* ]]; then�[0m
�[36;1m echo "Base branch check passed: allowing automated What's New PR from '$HEAD' to 'main'."�[0m
�[36;1m exit 0�[0m
�[36;1mfi�[0m
�[36;1m�[0m
�[36;1mif [ "$BASE" = "main" ]; then�[0m
�[36;1m echo "Error: Pull requests targeting 'main' must come from the 'develop' branch, not '$HEAD'."�[0m
�[36;1m exit 1�[0m
�[36;1mfi�[0m
�[36;1m�[0m
�[36;1mecho "Error: Pull requests must target 'develop' (or target 'main' only from 'develop'), not '$BASE'."�[0m
�[36;1mexit 1�[0m
shell: /usr/bin/bash -e {0}
##[endgroup]
Error: Pull requests targeting 'main' must come from the 'develop' branch, not 'ci/oc-agent-gh-auth-and-conventions'.
##[error]Process completed with exit code 1.
🧰 Additional context used
📓 Path-based instructions (2)
**/*
📄 CodeRabbit inference engine (AGENTS.md)
**/*: Before making code changes, commits, or pull requests, load themaintenanceandpytrendyskills; loadtest,cicd,debug, orpr-plotsonly when relevant.
Pull requests must target thedevelopbranch, notmain.
Use Conventional Commits with lowercase, imperative, under-72-character messages and no trailing period, using permitted prefixes such asfix:,feat:,chore:,ci:,docs:,refactor:,perf:,test:,build:, orrevert:.
Deprecating a public parameter must use afeat:commit because it is a minor API change, notrefactor:.
Files:
AGENTS.md
**/AGENTS.md
⚙️ CodeRabbit configuration file
General overview about pytrendy
Files:
AGENTS.md
🪛 zizmor (1.26.1)
.github/workflows/opencode.yml
[info] 21-21: workflow or action definition without a name (anonymous-definition): this job
(anonymous-definition)
[warning] 14-18: insufficient job-level concurrency limits (concurrency-limits): workflow is missing concurrency setting
(concurrency-limits)
🔇 Additional comments (1)
.github/workflows/opencode.yml (1)
82-82: LGTM!
RussellSB
left a comment
There was a problem hiding this comment.
Addressed all 4 CodeRabbit findings: (1) issues/pull_request/schedule/workflow_dispatch are action-level supported events, not triggers for this /oc user-interaction workflow — documented in comment block; (2) added concurrency group serialised per issue/PR; (3) restored /oc + /opencode body gate in if condition; (4) narrowed lint-pr-title.yml claim to PR title prefix + allowed types only.
|
All 4 CodeRabbit findings are addressed in the current code. Let me verify each: Finding 1 — "Restore documented workflow triggers" (line 18): Finding 2 — Concurrency group: Finding 3 — Body gate: Finding 4 — AGENTS.md alignment with lint-pr-title.yml: The PR looks clean. One issue: |
5979673 to
410c27f
Compare

Changes
opencode.ymlGH_TOKENforghCLI auth (#251): AddedGH_TOKEN: ${{ secrets.GITHUB_TOKEN }}to the opencode workflow env. The action uses Octokit for its own GitHub operations, but when the agent shells out toghCLI via the bash tool, it needsGH_TOKENin the environment. The workflow'spermissions:block already grantsissues: write.Remove unsupported
pull_request_reviewtrigger (#252): The opencode action runtime (github.handler.ts:148) only supportsissue_comment,pull_request_review_comment,issues,pull_request,schedule,workflow_dispatch./ocin a review body (pull_request_review) throwsUnsupported event type. Removed the trigger and added a comment block documenting the supported events. Conversation comments and line comments still work.Restore
/ocbody gate: Theifcondition now checksgithub.event.comment.bodyfor/ocor/opencode, so ordinary discussion comments don't reach the agent.Concurrency group: Added
concurrencykeyed by issue/PR number withcancel-in-progress: falseto serialise agent runs per discussion and avoid race conditions on rapid comments.AGENTS.mdConventional Commits enforcement (#253): Expanded the Critical rules section with explicit commit conventions so the agent applies them without needing to load the maintenance skill first. Narrowed the
lint-pr-title.ymlclaim to what it actually enforces: thetype: descriptionprefix and allowed types on PR titles.Supported events
issue_comment/ocor/opencodein PR/issue conversationpull_request_review_comment/ocor/opencodeon a code line (Files tab)pull_request_review/ocor/opencodein review body (Submit review)Closes #251
Closes #252
Closes #253