Skip to content

opencode-bot job never triggers on comments that start with /oc or /opencode #12

Description

@dceoy

Problem

The opencode-bot job gate in .github/workflows/opencode.yml requires a space before the trigger phrase for issue_comment / pull_request_review_comment events:

&& (contains(github.event.comment.body, ' /oc') || contains(github.event.comment.body, ' /opencode'))

A comment whose body starts with the trigger (e.g. /opencode explain this issue) does not contain the substring ' /oc', so the job is skipped and the bot never responds.

Evidence

  • .github/workflows/opencode.yml:58 — the comment branch requires ' /oc' / ' /opencode' with a leading space.
  • The other branches of the same condition match without the space: pull_request_review (line 62) and issues (lines 67–68) — inconsistent handling within one expression.
  • Documented usage is start-of-comment: README.md:46 ("Then comment /opencode or /oc …"), the ## Examples section (/opencode explain this issue, /opencode fix this, /oc add error handling here), and .opencode/skills/review-pr/SKILL.md:174 ("Re-run by commenting /opencode or /oc on the PR").
  • The README consumer example (README.md:29) uses contains(github.event.comment.body, '/oc') without a space, so this repo's own workflow is stricter than both the documented pattern and the action's own mention matching (mentions default /opencode,/oc, matched by opencode github run itself).

Impact

The primary documented interaction — commenting /oc … or /opencode … at the start of a comment on an issue or PR in this repository — silently does nothing (job skipped). Mid-sentence mentions still work, which makes the failure look intermittent and hard to diagnose.

Suggested fix

Also match the trigger at the start of the body, e.g.:

&& (
  startsWith(github.event.comment.body, '/oc')
  || contains(github.event.comment.body, ' /oc')
  || startsWith(github.event.comment.body, '/opencode')
  || contains(github.event.comment.body, ' /opencode')
)

(startsWith(body, '/oc') already covers /opencode, so this can be simplified.) Alternatively drop the leading space entirely, matching the README example — opencode github run performs its own mention matching, so the workflow gate only needs to be a cheap pre-filter against wasted runner spins.

Validation

Comment /oc ping (at the very start of the comment body) on a PR or issue and confirm the opencode-bot job actually runs instead of showing as skipped in gh run list --workflow=opencode.yml.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions