Skip to content

chore: add commit format enforcement and chore vs fix guidance in maintenance skill - #268

Merged
RussellSB merged 2 commits into
mainfrom
opencode/issue267-20260723060301
Jul 23, 2026
Merged

chore: add commit format enforcement and chore vs fix guidance in maintenance skill#268
RussellSB merged 2 commits into
mainfrom
opencode/issue267-20260723060301

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Add one-liner at top of maintenance skill enforcing commit format verification before every git commit. Impossible to miss during sessions.

Closes #267

@RussellSB

Copy link
Copy Markdown
Owner

/oc update PR title and description. Especially pr title following conventions, consider pre commit hook for this too

@RussellSB

Copy link
Copy Markdown
Owner

/oc remove line on This is consolidated issue ...

@github-actions github-actions Bot changed the title Fix commit format in maintenance skill fix: add commit format enforcement in maintenance skill Jul 23, 2026
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@opencode-agent

Copy link
Copy Markdown
Contributor Author

PR title updated to fix: add commit format enforcement in maintenance skill (lowercase fix:, matches regex).

Re: pre-commit hook — worth adding but out of scope for this PR. A simple commit-msg hook script:

#!/bin/bash
pattern="^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?!?: .+"
if ! head -1 "$1" | grep -qE "$pattern"; then
  echo "Commit message must match: $pattern"
  exit 1
fi

Install via git config core.hooksPath .githooks. Skipped here — suggest a separate PR if you want it in the repo.

New%20session%20-%202026-07-23T06%3A06%3A40.516Z
opencode session  |  github run

@RussellSB

Copy link
Copy Markdown
Owner

/oc add .opencode/ to exception rules of base branch check

@opencode-agent

Copy link
Copy Markdown
Contributor Author

Done. Removed the "consolidated issue" line.

New%20session%20-%202026-07-23T06%3A08%3A16.245Z
opencode session  |  github run

@RussellSB

Copy link
Copy Markdown
Owner

/oc rename title and commits. V. Important for maintenance updates to not use fix otherwise it will trigger an accidental auto release

Use either chore or fix. Also encode this into the skill to ensure agent remembers this.

@opencode-agent

Copy link
Copy Markdown
Contributor Author

Looking at the workflow, .opencode/ is already in the grep exclusion pattern on line 43:

NON_CICD_FILES=$(echo "$CHANGED_FILES" | grep -v -E "^(.github/|AGENTS\.md$|pyproject\.toml$|opencode\.json$|opencode\.yaml$|\.opencode/|\.releaserc)" || true)

The \.\opencode/ pattern already matches files under .opencode/. The PR targeting main with only .opencode/skills/maintenance/SKILL.md changes should pass the check.

Is there a specific scenario where it's failing, or were you looking for a different exception?

New%20session%20-%202026-07-23T06%3A09%3A05.578Z
opencode session  |  github run

@RussellSB

Copy link
Copy Markdown
Owner

/oc its failing on this PR? Investigate

@opencode-agent
opencode-agent Bot force-pushed the opencode/issue267-20260723060301 branch from d4386d7 to e489150 Compare July 23, 2026 06:11
@RussellSB

Copy link
Copy Markdown
Owner

/oc can you make it critical before every git commit and PR title creation ...

@github-actions github-actions Bot changed the title fix: add commit format enforcement in maintenance skill chore: add commit format enforcement and chore vs fix guidance in maintenance skill Jul 23, 2026
@opencode-agent

Copy link
Copy Markdown
Contributor Author

Done. Summary:

Both files now explicitly warn agents: using fix: on non-bugfix work causes accidental auto-releases.

New%20session%20-%202026-07-23T06%3A10%3A12.387Z
opencode session  |  github run

@RussellSB

RussellSB commented Jul 23, 2026

Copy link
Copy Markdown
Owner

/oc Specify use chore: or ci: in place of fix: for your new rule added

@opencode-agent

Copy link
Copy Markdown
Contributor Author

Done. Two changes:

  1. Maintenance skill (line 10): Added CRITICAL block for PR titles — same regex, notes lint-pr-title.yml blocks non-conforming PRs in CI.
  2. AGENTS.md (line 22): Added note that PR titles use the same pattern and are blocked in CI.

Committed as chore: — skill files only, no user-facing code impact.

New%20session%20-%202026-07-23T06%3A12%3A37.915Z
opencode session  |  github run

@RussellSB

Copy link
Copy Markdown
Owner

/oc amend the chore vs fix point to also include ci: but also make more concise

@opencode-agent

Copy link
Copy Markdown
Contributor Author

Committed as chore: — both files updated with ci: included and verbose parenthetical removed.

New%20session%20-%202026-07-23T06%3A20%3A56.775Z
opencode session  |  github run

@RussellSB

Copy link
Copy Markdown
Owner

/oc a bit better. Now amend prev commit in this pr to ensure all follow git conventions

@opencode-agent
opencode-agent Bot force-pushed the opencode/issue267-20260723060301 branch from dac171a to 93d16c0 Compare July 23, 2026 06:24
@opencode-agent

Copy link
Copy Markdown
Contributor Author

Done. Squashed 5 commits into one clean chore: commit:

93d16c0 chore: add commit format enforcement and chore/fix/CI guidance to maintenance skill

The old 327d733 Added chore vs fix rule to skill+AGENTS (which violated conventions) is gone.

New%20session%20-%202026-07-23T06%3A23%3A33.726Z
opencode session  |  github run

@RussellSB

Copy link
Copy Markdown
Owner

/oc why is base branch failing? Shouldn't it pass here?

@opencode-agent

Copy link
Copy Markdown
Contributor Author

Committed. The base branch check was failing because gh pr diff had no auth — it silently returned empty, the CI/CD exemption was skipped, and it hit the error. The fix adds permissions: pull-requests: read and GH_TOKEN. The re-run should pass now since all changed files (.opencode/, AGENTS.md, .github/) match the exclusion patterns.

New%20session%20-%202026-07-23T06%3A27%3A08.144Z
opencode session  |  github run

@RussellSB

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot added the documentation Improvements or additions to documentation label Jul 23, 2026
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d1e03d9d-c0da-405f-9e85-e05ede19896c

📥 Commits

Reviewing files that changed from the base of the PR and between 8721081 and 30a6de8.

📒 Files selected for processing (3)
  • .github/workflows/check-base-branch.yml
  • .opencode/skills/maintenance/SKILL.md
  • AGENTS.md
📜 Recent review details
⚠️ CI failures not shown inline (2)

GitHub Actions: Check Base Branch / 0_Validate Base Branch.txt: chore: add commit format enforcement and chore vs fix guidance in maintenance skill

Conclusion: failure

View job details

##[group]Run BASE="main"
 �[36;1mBASE="main"�[0m
 �[36;1mHEAD="opencode/issue267-20260723060301"�[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  # Check if all changed files are CI/CD or agentic config files�[0m
 �[36;1m  PR_NUMBER=$(jq --raw-output '.pull_request.number // empty' "$GITHUB_EVENT_PATH")�[0m
 �[36;1m  CHANGED_FILES=$(gh pr diff "$PR_NUMBER" --name-only 2>/dev/null || echo "")�[0m
 �[36;1m  if [ -n "$CHANGED_FILES" ]; then�[0m
 �[36;1m    NON_CICD_FILES=$(echo "$CHANGED_FILES" | grep -v -E "^(.github/|AGENTS\.md$|pyproject\.toml$|opencode\.json$|opencode\.yaml$|\.opencode/|\.releaserc)" || true)�[0m
 �[36;1m    if [ -z "$NON_CICD_FILES" ]; then�[0m
 �[36;1m      echo "Base branch check passed: all changed files are CI/CD or agentic config"�[0m
 �[36;1m      exit 0�[0m
 �[36;1m    fi�[0m
 �[36;1m  fi�[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
...

GitHub Actions: Check Base Branch / Validate Base Branch: chore: add commit format enforcement and chore vs fix guidance in maintenance skill

Conclusion: failure

View job details

##[group]Run BASE="main"
 �[36;1mBASE="main"�[0m
 �[36;1mHEAD="opencode/issue267-20260723060301"�[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  # Check if all changed files are CI/CD or agentic config files�[0m
 �[36;1m  PR_NUMBER=$(jq --raw-output '.pull_request.number // empty' "$GITHUB_EVENT_PATH")�[0m
 �[36;1m  CHANGED_FILES=$(gh pr diff "$PR_NUMBER" --name-only 2>/dev/null || echo "")�[0m
 �[36;1m  if [ -n "$CHANGED_FILES" ]; then�[0m
 �[36;1m    NON_CICD_FILES=$(echo "$CHANGED_FILES" | grep -v -E "^(.github/|AGENTS\.md$|pyproject\.toml$|opencode\.json$|opencode\.yaml$|\.opencode/|\.releaserc)" || true)�[0m
 �[36;1m    if [ -z "$NON_CICD_FILES" ]; then�[0m
 �[36;1m      echo "Base branch check passed: all changed files are CI/CD or agentic config"�[0m
 �[36;1m      exit 0�[0m
 �[36;1m    fi�[0m
 �[36;1m  fi�[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
...
🧰 Additional context used
📓 Path-based instructions (2)
*.md

📄 CodeRabbit inference engine (AGENTS.md)

Before making code changes, commits, or pull requests, load the maintenance and pytrendy skills; load test, cicd, debug, or pr-plots only when relevant.

Files:

  • AGENTS.md
**/AGENTS.md

⚙️ CodeRabbit configuration file

General overview about pytrendy

Files:

  • AGENTS.md
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: RussellSB/pytrendy

Timestamp: 2026-07-23T06:36:13.837Z
Learning: Pull requests must target the `develop` branch, not `main`.
Learnt from: CR
Repo: RussellSB/pytrendy

Timestamp: 2026-07-23T06:36:13.837Z
Learning: Use Conventional Commits with an allowed lowercase type (`fix`, `feat`, `chore`, `ci`, `docs`, `refactor`, `perf`, `test`, `build`, or `revert`), an imperative description under 72 characters, and no trailing period.
Learnt from: CR
Repo: RussellSB/pytrendy

Timestamp: 2026-07-23T06:36:13.837Z
Learning: Pull request titles must use the Conventional Commit-style `type: description` format with an allowed type, as enforced by `lint-pr-title.yml`.
Learnt from: CR
Repo: RussellSB/pytrendy

Timestamp: 2026-07-23T06:36:13.837Z
Learning: Use `feat:` when deprecating a public parameter; do not use `refactor:`.
Learnt from: CR
Repo: RussellSB/pytrendy

Timestamp: 2026-07-23T06:36:13.837Z
Learning: Use `chore:` or `ci:` for maintenance-only changes with zero user-facing code impact; reserve `fix:` for bug fixes because it triggers a patch release through semantic-release.
🪛 SkillSpector (2.3.11)
.opencode/skills/maintenance/SKILL.md

[error] 35: [AR2] Anti-Refusal Statement: Skill instructs the agent to omit warnings, disclaimers, or ethical commentary. Stripping safety caveats hides risk from the user and is a common jailbreak preamble.

Remediation: Remove instructions that suppress warnings, disclaimers, or ethical commentary. Let the agent surface safety-relevant caveats to the user.

(Anti-Refusal (AR2))


[error] 35: [AR2] Anti-Refusal Statement: Skill instructs the agent to omit warnings, disclaimers, or ethical commentary. Stripping safety caveats hides risk from the user and is a common jailbreak preamble.

Remediation: Remove instructions that suppress warnings, disclaimers, or ethical commentary. Let the agent surface safety-relevant caveats to the user.

(Anti-Refusal (AR2))

🪛 zizmor (1.26.1)
.github/workflows/check-base-branch.yml

[warning] 12-12: permissions without explanatory comments (undocumented-permissions): needs an explanatory comment

(undocumented-permissions)

🔇 Additional comments (3)
.github/workflows/check-base-branch.yml (1)

11-16: LGTM!

.opencode/skills/maintenance/SKILL.md (1)

8-10: LGTM!

Also applies to: 89-89

AGENTS.md (1)

22-22: LGTM!


📝 Walkthrough

Summary by CodeRabbit

  • Chores

    • Improved automated pull request validation by ensuring required read access is explicitly configured.
    • Added stronger checks for pull request titles and commit messages, helping maintain consistent release documentation.
  • Documentation

    • Clarified contribution guidance for Conventional Commits.
    • Added guidance distinguishing bug fixes from routine maintenance changes to support accurate release versioning.

Walkthrough

The PR grants the base-branch validation job read access to pull-request data and updates maintenance guidance to enforce Conventional Commits formatting for commits and PR titles, while distinguishing chore: from fix: usage.

Changes

Maintenance guardrails

Layer / File(s) Summary
PR validation permissions
.github/workflows/check-base-branch.yml
The validation job explicitly grants pull-requests: read permission while continuing to pass GITHUB_TOKEN to the validation step.
Commit and PR conventions
.opencode/skills/maintenance/SKILL.md, AGENTS.md
Agent guidance requires CI-compatible Conventional Commits formatting for commits and PR titles, and reserves fix: for actual bug fixes rather than maintenance work.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: documentation, automated

Suggested reviewers: russellsb

Poem

Tokens read, titles aligned,
Commit prefixes clearly signed.
Chores stay chores, fixes stay true,
CI knows what commits should do.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is Conventional Commits-formatted and matches the main change: enforcing commit-format guidance in the maintenance skill.
Description check ✅ Passed The description is on-topic and matches the commit-format enforcement work tied to issue #267.
Linked Issues check ✅ Passed The PR adds stronger commit-format guidance before every commit and aligns PR-title rules, which satisfies #267's enforcement goal.
Out of Scope Changes check ✅ Passed The workflow permission tweak supports the branch-check changes and does not introduce unrelated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch opencode/issue267-20260723060301

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
.github/workflows/check-base-branch.yml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@RussellSB
RussellSB merged commit f76650c into main Jul 23, 2026
6 of 7 checks passed
@RussellSB
RussellSB deleted the opencode/issue267-20260723060301 branch July 23, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Maintenance] OC agent commits don't follow Conventional Commits when amending in bulk

1 participant