Skip to content

[Maintenance] Fix OC agent trigger reliability and response failures #240

Description

@RussellSB

Problem

The OpenCode (OC) agent in GitHub Actions sometimes fails to respond to /oc comments entirely, and sometimes enters loops when asked to create issues. This was observed consistently in PR #224.

Symptoms:

  • Some /oc commands produce no response at all (no eyes emoji, no workflow run)
  • Quote-reply comments with /oc after > blocks appear to not trigger the workflow
  • When triggered, the agent sometimes asks for confirmation instead of acting on explicit instructions
  • Git auth failures on the runner (Author identity unknown, could not read Username) suggest permission/scope issues

Observed in PR #224

Comment Result
/oc address coderabitai's recent unresolved comments and resolve Ran but failed — Author identity unknown (no git config)
/oc try again (quote-reply) Ran but failed — fatal: could not read Username for 'https://github.com'
/oc in your latest commit you didnt follow git conventions... Ran and responded with investigation/plan
/oc make an issue with your ideas so far, we will continue planning there Ran but asked for confirmation instead of creating the issue
/oc why didnt my previous latest comment mentioning you trigger a run from you? Ran and explained it did trigger, responded with analysis instead of action
/oc maybe it ran so quick i didnt see the eyes emoji... Ran but still didn't create the issue

Key failure case: The user's initial quote-reply commands (steps 1–2) produced no visible trigger, leading to confusion about whether OC was working at all.

Likely Root Causes

1. Workflow trigger doesn't handle quote-reply formatting

The current condition:

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

Fails for comments where /oc appears after markdown quote blocks (>), since the body starts with > not /oc, and /oc may not match depending on whitespace in the quoted text.

2. Insufficient runner permissions

Only id-token: write is granted. Git operations (push, commit) require contents: write and authenticated credentials (GITHUB_TOKEN or a PAT). The Author identity unknown and Username prompt errors confirm this.

3. Agent behaviour — confirmation loop

When asked to create an issue, the agent asked for confirmation instead of executing immediately, suggesting the system prompt or tool configuration may not be tuned for autonomous action on explicit user instructions.

Proposed Solution

  1. Fix the trigger regex — Account for quote-reply blocks, leading whitespace, and inline /oc commands anywhere in the comment body
  2. Grant necessary permissions — Add contents: write to the workflow permissions and ensure GITHUB_TOKEN is passed and git identity is configured on the runner
  3. Tune agent autonomy — Adjust the system prompt so that explicit /oc commands like "make an issue" execute immediately without confirmation loops

Commit type note

This is a CI/tooling improvement. Commits for this issue must use chore: or ci: prefix — not fix: or feat: — to avoid triggering an auto-release via semantic-release on main. The conventionalcommits preset maps fix: → patch bump and feat: → minor bump; only chore:/ci:/docs:/refactor: produce no version bump.

Acceptance Criteria

  • /oc commands inside quote-reply blocks (> /oc ...) trigger the workflow
  • Agent can commit/push without auth failures
  • Agent executes explicit instructions (e.g., "create an issue") without asking for confirmation
  • No false negatives on any valid /oc command format

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions