You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GitHub Integration is not pushing changes in PRs #1417
In my private repository a PR was opened by the renovate bot, updating a dependency.
This resulted in a test failure, and I described in a comment how I wanted this to be fixed and used /oc fix this.
The opencode.yml workflow was triggered, and according to the logs it fixed the issue, and created a commit:
{"command":"cd /home/runner/work/my-project/my-project && git commit -m \"...\"","description":"Commit the changes"}
Then opencode created the summary and posted this as a comment in the PR.
Unfortunately, the commit was never pushed to the PR branch and seems to be lost.
Think I've hit this too, couldn't find this issue (Thanks bot for telling me): #3893
As far as I can tell it's because the branchIsDirty() check is false because git status --porcelain returns nothing if we've committed the changes, even if they haven't been pushed
The bug has been identified. There are two separate implementations of branchIsDirty():
1. github/index.ts (Used by GitHub Action) — BUGGY ❌
// Line 751-755asyncfunctionbranchIsDirty(){console.log("Checking if branch is dirty...")constret=await$`git status --porcelain`returnret.stdout.toString().trim().length>0}
This only checks for uncommitted changes via git status --porcelain. If the AI agent already committed the changes (via git commit), git status --porcelain returns empty — so this function returns false, and the push is skipped.
2. packages/opencode/src/cli/cmd/github.ts (Used by CLI opencode github) — FIXED ✅
// Line 1112-1127asyncfunctionbranchIsDirty(originalHead: string){console.log("Checking if branch is dirty...")constret=await$`git status --porcelain`conststatus=ret.stdout.toString().trim()if(status.length>0){return{dirty: true,uncommittedChanges: true}}consthead=await$`git rev-parse HEAD`return{dirty: head.stdout.toString().trim()!==originalHead,uncommittedChanges: false,}}
This correctly captures originalHead before AI work, then compares HEAD after — detecting both uncommitted changes AND new commits.
The Fix
The github/index.ts implementation needs to be updated to match the CLI version:
In branchIsDirty(), check both git status --porcelain AND HEAD !== originalHead
Pass uncommittedChanges flag to push functions so they know whether to git add . && git commit first
As @AKTheKnight correctly identified in #3893, the branchIsDirty() check is false because git status --porcelain returns nothing after committed changes.
The fix already exists in the CLI version (packages/opencode/src/cli/cmd/github.ts), it just needs to be ported to the GitHub Action version (github/index.ts).
Activity
fwang commentedon Aug 22, 2025
hmm that's weird... does this happen everytime?
AKTheKnight commentedon Nov 4, 2025
Think I've hit this too, couldn't find this issue (Thanks bot for telling me): #3893
As far as I can tell it's because the branchIsDirty() check is false because
git status --porcelainreturns nothing if we've committed the changes, even if they haven't been pushedcode-yeongyu commentedon Feb 7, 2026
Root Cause Analysis
The bug has been identified. There are two separate implementations of
branchIsDirty():1.
github/index.ts(Used by GitHub Action) — BUGGY ❌This only checks for uncommitted changes via
git status --porcelain. If the AI agent already committed the changes (viagit commit),git status --porcelainreturns empty — so this function returnsfalse, and the push is skipped.2.
packages/opencode/src/cli/cmd/github.ts(Used by CLIopencode github) — FIXED ✅This correctly captures
originalHeadbefore AI work, then comparesHEADafter — detecting both uncommitted changes AND new commits.The Fix
The
github/index.tsimplementation needs to be updated to match the CLI version:originalHead = git rev-parse HEADbefore callingchat()branchIsDirty(), check bothgit status --porcelainANDHEAD !== originalHeaduncommittedChangesflag to push functions so they know whether togit add . && git commitfirstAs @AKTheKnight correctly identified in #3893, the
branchIsDirty()check is false becausegit status --porcelainreturns nothing after committed changes.The fix already exists in the CLI version (
packages/opencode/src/cli/cmd/github.ts), it just needs to be ported to the GitHub Action version (github/index.ts).github-actions commentedon Apr 9, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.