Skip to content

Decouple GitHub orchestration from the OpenCode runtime #60

Description

@dceoy

Problem

General opencode-action behavior currently depends on opencode github run, which owns both GitHub orchestration and model execution. It handles event parsing, reactions and progress comments, issue and pull-request context, local and fork branch checkout, commits, pushes, pull-request creation, attachments, session sharing, and token cleanup.

OpenCode v2 does not currently expose a compatible github run command. Calling opencode2 run directly can execute an agent, but it cannot preserve the action's full issue-to-PR and PR-update behavior by itself.

Continuing to depend on the upstream GitHub handler also couples the action to OpenCode internal behavior and prevents the same orchestration from supporting multiple runtime generations.

Goal

Own the GitHub event lifecycle in opencode-action and expose OpenCode v1 and v2 through narrow runtime adapters.

Proposed architecture

GitHub event
    -> action-owned GitHub runner
        -> normalized task and repository context
            -> OpenCode runtime adapter
                - v1 adapter
                - v2 adapter
        -> normalized result and worktree state
    -> GitHub comment, review, commit, push, or PR mutation

Proposed changes

  • Implement an action-owned runner for the currently supported GitHub event types.
  • Separate GitHub API and git mutations from LLM execution.
  • Define a minimal runtime adapter contract for:
    • executable and installation strategy;
    • model, variant, agent, prompt, and configuration inputs;
    • noninteractive execution;
    • structured output or final response capture;
    • timeout and failure reporting.
  • Port the existing behavior for:
    • issue comments and PR review comments;
    • issues, pull requests, workflow dispatch, and schedule events;
    • local and fork pull requests;
    • branch creation, commit, push, and pull-request creation;
    • attachment handling;
    • reactions, progress comments, and final updates;
    • session sharing where supported.
  • Reuse the action-owned authentication lifecycle from Extract GitHub App token exchange from opencode github run #57.
  • Keep /review-pr on its stricter review-only path rather than routing structured review submission through the general mutation runner.
  • Add contract tests that run identical event fixtures against v1 and v2 adapters.
  • Define a compatibility matrix for runtime-specific features that cannot be implemented identically.

Acceptance criteria

  • GitHub event routing and mutations no longer require opencode github run.
  • The v1 adapter preserves existing observable behavior.
  • A v2 adapter can support issue explanation, issue fixes, PR changes, and scheduled or dispatched tasks without importing OpenCode internal source modules.
  • Local and fork PR workflows have integration coverage.
  • Authentication, cleanup, timeout, and error behavior are deterministic across runtimes.
  • Runtime-specific limitations are explicit and fail clearly rather than silently degrading.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions