From d2a4780c709eb8b43269b9b3202a7f56e5aed24c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 23:20:27 +0000 Subject: [PATCH 1/6] Initial plan From 578bcc449c90f10a4ea9ffdce2dc8d9a0d58db7b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 23:25:16 +0000 Subject: [PATCH 2/6] Add rebase-upstream-prod workflow and conflict resolution guide Co-authored-by: brettheap <1513478+brettheap@users.noreply.github.com> --- .github/rebase-upstream-prod-conflict.md | 131 +++++++++++++++ .github/workflows/rebase-upstream-prod.yml | 183 +++++++++++++++++++++ 2 files changed, 314 insertions(+) create mode 100644 .github/rebase-upstream-prod-conflict.md create mode 100644 .github/workflows/rebase-upstream-prod.yml diff --git a/.github/rebase-upstream-prod-conflict.md b/.github/rebase-upstream-prod-conflict.md new file mode 100644 index 00000000000..f36409a4ded --- /dev/null +++ b/.github/rebase-upstream-prod-conflict.md @@ -0,0 +1,131 @@ +# Manual Rebase Conflict Resolution Guide + +This guide explains how to manually resolve rebase conflicts when the automated rebase workflow fails. + +## Overview + +The automated workflow attempts to rebase the `opensoft-prod` branch onto the upstream `production` branch. When conflicts occur, they must be resolved manually. + +## Prerequisites + +- Git installed locally +- Write access to the opensoft/opencode repository +- Familiarity with Git rebase and conflict resolution + +## Steps to Resolve Conflicts + +### 1. Clone the Repository (if not already done) + +```bash +git clone https://github.com/opensoft/opencode.git +cd opencode +``` + +### 2. Add the Upstream Remote + +```bash +git remote add upstream https://github.com/sst/opencode.git +``` + +If the remote already exists, you can skip this step or update it: + +```bash +git remote set-url upstream https://github.com/sst/opencode.git +``` + +### 3. Fetch All Remotes + +```bash +git fetch origin +git fetch upstream +``` + +### 4. Checkout the opensoft-prod Branch + +```bash +git checkout opensoft-prod +``` + +### 5. Start the Rebase + +```bash +git rebase upstream/production +``` + +### 6. Resolve Conflicts + +When conflicts occur, Git will pause and show you which files have conflicts: + +``` +CONFLICT (content): Merge conflict in +``` + +For each conflicted file: + +1. Open the file in your editor +2. Look for conflict markers: + ``` + <<<<<<< HEAD + (your changes) + ======= + (upstream changes) + >>>>>>> upstream/production + ``` +3. Edit the file to resolve the conflict, keeping the appropriate changes +4. Remove the conflict markers +5. Save the file + +### 7. Mark Files as Resolved + +After resolving conflicts in a file: + +```bash +git add +``` + +### 8. Continue the Rebase + +```bash +git rebase --continue +``` + +Repeat steps 6-8 for each conflict that occurs during the rebase. + +### 9. Force Push to Update opensoft-prod + +⚠️ **Warning**: This is a force push operation. Make sure you've resolved all conflicts correctly. + +```bash +git push --force-with-lease origin opensoft-prod +``` + +Using `--force-with-lease` is safer than `--force` as it will fail if someone else has pushed changes since you last fetched. + +## Aborting the Rebase + +If you need to abort the rebase and start over: + +```bash +git rebase --abort +``` + +This will return your branch to the state before the rebase started. + +## Tips + +- **Review changes carefully**: Use `git diff` to review changes before continuing +- **Test after resolution**: If possible, test the code after resolving conflicts +- **Ask for help**: If you're unsure about a conflict, consult with team members +- **Document complex resolutions**: If a conflict required non-obvious resolution, document it in the commit message + +## Verification + +After successfully pushing, verify the rebase: + +1. Check the commit history: `git log --oneline -10` +2. Verify the branch has the expected upstream changes +3. Ensure any custom opensoft changes are preserved + +## Re-running the Automated Workflow + +After manually resolving and pushing, the automated workflow should succeed on its next run (or you can trigger it manually using workflow_dispatch). diff --git a/.github/workflows/rebase-upstream-prod.yml b/.github/workflows/rebase-upstream-prod.yml new file mode 100644 index 00000000000..0d1316f49dc --- /dev/null +++ b/.github/workflows/rebase-upstream-prod.yml @@ -0,0 +1,183 @@ +name: Rebase opensoft-prod onto upstream production + +on: + schedule: + # Run every Sunday at 23:00 UTC (Sunday night) + - cron: "0 23 * * 0" + workflow_dispatch: + +jobs: + rebase: + runs-on: ubuntu-latest + permissions: + contents: write + issues: write + steps: + - name: Checkout opensoft-prod branch + uses: actions/checkout@v4 + with: + ref: opensoft-prod + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Configure Git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Add upstream remote + run: | + if ! git remote | grep -q '^upstream$'; then + git remote add upstream https://github.com/sst/opencode.git + fi + git remote -v + + - name: Fetch upstream + run: | + git fetch upstream production + + - name: Rebase onto upstream/production + id: rebase + continue-on-error: true + run: | + echo "Attempting rebase of opensoft-prod onto upstream/production..." + if git rebase upstream/production; then + echo "result=success" >> $GITHUB_OUTPUT + echo "Rebase successful" + else + echo "result=conflict" >> $GITHUB_OUTPUT + echo "Rebase failed with conflicts" + git rebase --abort + exit 1 + fi + + - name: Force push to origin + if: steps.rebase.outputs.result == 'success' + run: | + echo "Pushing rebased opensoft-prod to origin..." + git push --force-with-lease origin opensoft-prod + echo "Successfully pushed rebased branch" + + - name: Create issue on conflict + if: steps.rebase.outputs.result == 'conflict' + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const path = require('path'); + + // Read the conflict resolution instructions + const instructionsPath = path.join( + process.env.GITHUB_WORKSPACE, + '.github/rebase-upstream-prod-conflict.md' + ); + let instructions = ''; + try { + instructions = fs.readFileSync(instructionsPath, 'utf8'); + } catch (error) { + instructions = [ + 'See .github/rebase-upstream-prod-conflict.md', + 'for manual resolution instructions.' + ].join(' '); + } + + const issueTitle = [ + '🔄 Rebase Conflict: opensoft-prod onto', + 'upstream/production', + `(${new Date().toISOString().split('T')[0]})` + ].join(' '); + const issueBody = `## Automated Rebase Failed + + The automated rebase of \`opensoft-prod\` onto + \`upstream/production\` has encountered conflicts that require + manual resolution. + + **Workflow Run:** [#${context.runNumber}](${ + context.payload.repository.html_url + }/actions/runs/${context.runId}) + + ## What Happened + + The GitHub Actions workflow attempted to: + 1. Fetch the latest \`production\` branch from upstream + (sst/opencode) + 2. Rebase \`opensoft-prod\` onto \`upstream/production\` + 3. The rebase encountered merge conflicts and was aborted + + ## Next Steps + + A maintainer needs to manually resolve the conflicts and + push the rebased branch. Please follow the instructions + below: + + --- + + ${instructions} + + --- + + ## After Resolution + + Once you've manually resolved and pushed the changes: + - [ ] Verify \`opensoft-prod\` is up to date with + \`upstream/production\` + - [ ] Close this issue + - [ ] The next automated run should succeed + + ## Labels + + - \`automated\`: Created by automated workflow + - \`maintenance\`: Repository maintenance task + `; + + // Check if an issue already exists + const existingIssues = await github.rest.issues.listForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open', + labels: 'rebase-conflict', + per_page: 10 + }); + + // Only create a new issue if one doesn't already exist + if (existingIssues.data.length === 0) { + const issue = await github.rest.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: issueTitle, + body: issueBody, + labels: [ + 'rebase-conflict', + 'maintenance', + 'automated' + ] + }); + + console.log(`Created issue #${issue.data.number}`); + } else { + const existingNum = existingIssues.data[0].number; + console.log(`Issue already exists: #${existingNum}`); + + // Add a comment to the existing issue + const date = new Date().toISOString().split('T')[0]; + const runUrl = [ + context.payload.repository.html_url, + '/actions/runs/', + context.runId + ].join(''); + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: existingIssues.data[0].number, + body: [ + `Another rebase conflict detected on ${date}.\n\n`, + `Workflow Run: [#${context.runNumber}](${runUrl})` + ].join('') + }); + } + + - name: Notify on failure + if: failure() && steps.rebase.outputs.result != 'conflict' + run: | + echo "::error::Rebase workflow failed unexpectedly. Check logs." + exit 1 From 982bab5774fbc398279a932818f442351de7bd41 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Thu, 15 Jan 2026 15:54:57 -0800 Subject: [PATCH 3/6] Update .github/workflows/rebase-upstream-prod.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/rebase-upstream-prod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rebase-upstream-prod.yml b/.github/workflows/rebase-upstream-prod.yml index 0d1316f49dc..99d017ec058 100644 --- a/.github/workflows/rebase-upstream-prod.yml +++ b/.github/workflows/rebase-upstream-prod.yml @@ -6,6 +6,7 @@ on: - cron: "0 23 * * 0" workflow_dispatch: +concurrency: ${{ github.workflow }} jobs: rebase: runs-on: ubuntu-latest From 5b55b21a54bed8022f4ecc99fc5b8224192bec56 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Thu, 15 Jan 2026 15:55:18 -0800 Subject: [PATCH 4/6] Update .github/workflows/rebase-upstream-prod.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/rebase-upstream-prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-upstream-prod.yml b/.github/workflows/rebase-upstream-prod.yml index 99d017ec058..05b44d3a15b 100644 --- a/.github/workflows/rebase-upstream-prod.yml +++ b/.github/workflows/rebase-upstream-prod.yml @@ -9,7 +9,7 @@ on: concurrency: ${{ github.workflow }} jobs: rebase: - runs-on: ubuntu-latest + runs-on: blacksmith-4vcpu-ubuntu-2404 permissions: contents: write issues: write From ab10b4adaffcea049c35cb8ab7ea94646d80da11 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Thu, 15 Jan 2026 15:56:44 -0800 Subject: [PATCH 5/6] Update .github/rebase-upstream-prod-conflict.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/rebase-upstream-prod-conflict.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/rebase-upstream-prod-conflict.md b/.github/rebase-upstream-prod-conflict.md index f36409a4ded..f7a71d5f0f2 100644 --- a/.github/rebase-upstream-prod-conflict.md +++ b/.github/rebase-upstream-prod-conflict.md @@ -66,10 +66,10 @@ For each conflicted file: 2. Look for conflict markers: ``` <<<<<<< HEAD - (your changes) + (upstream/production changes) ======= - (upstream changes) - >>>>>>> upstream/production + (your opensoft-prod changes) + >>>>>>> opensoft-prod ``` 3. Edit the file to resolve the conflict, keeping the appropriate changes 4. Remove the conflict markers From 0adcd984222906f4cd67ecf785c54a60f325c6e1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 23:59:53 +0000 Subject: [PATCH 6/6] Fix workflow: remove continue-on-error, fix issue body formatting, remove Labels section Co-authored-by: brettheap <1513478+brettheap@users.noreply.github.com> --- .github/workflows/rebase-upstream-prod.yml | 28 ++++++---------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/.github/workflows/rebase-upstream-prod.yml b/.github/workflows/rebase-upstream-prod.yml index 05b44d3a15b..c5200a2e746 100644 --- a/.github/workflows/rebase-upstream-prod.yml +++ b/.github/workflows/rebase-upstream-prod.yml @@ -39,7 +39,6 @@ jobs: - name: Rebase onto upstream/production id: rebase - continue-on-error: true run: | echo "Attempting rebase of opensoft-prod onto upstream/production..." if git rebase upstream/production; then @@ -60,7 +59,7 @@ jobs: echo "Successfully pushed rebased branch" - name: Create issue on conflict - if: steps.rebase.outputs.result == 'conflict' + if: failure() && steps.rebase.outputs.result == 'conflict' uses: actions/github-script@v7 with: script: | @@ -89,27 +88,20 @@ jobs: ].join(' '); const issueBody = `## Automated Rebase Failed - The automated rebase of \`opensoft-prod\` onto - \`upstream/production\` has encountered conflicts that require - manual resolution. + The automated rebase of \`opensoft-prod\` onto \`upstream/production\` has encountered conflicts that require manual resolution. - **Workflow Run:** [#${context.runNumber}](${ - context.payload.repository.html_url - }/actions/runs/${context.runId}) + **Workflow Run:** [#${context.runNumber}](${context.payload.repository.html_url}/actions/runs/${context.runId}) ## What Happened The GitHub Actions workflow attempted to: - 1. Fetch the latest \`production\` branch from upstream - (sst/opencode) + 1. Fetch the latest \`production\` branch from upstream (sst/opencode) 2. Rebase \`opensoft-prod\` onto \`upstream/production\` 3. The rebase encountered merge conflicts and was aborted ## Next Steps - A maintainer needs to manually resolve the conflicts and - push the rebased branch. Please follow the instructions - below: + A maintainer needs to manually resolve the conflicts and push the rebased branch. Please follow the instructions below: --- @@ -120,16 +112,10 @@ jobs: ## After Resolution Once you've manually resolved and pushed the changes: - - [ ] Verify \`opensoft-prod\` is up to date with - \`upstream/production\` + - [ ] Verify \`opensoft-prod\` is up to date with \`upstream/production\` - [ ] Close this issue - [ ] The next automated run should succeed - - ## Labels - - - \`automated\`: Created by automated workflow - - \`maintenance\`: Repository maintenance task - `; + `.trim(); // Check if an issue already exists const existingIssues = await github.rest.issues.listForRepo({