Skip to content

Commit e1f8955

Browse files
committed
ci(autofix): avoid rewriting bot branch history
1 parent a87b4b5 commit e1f8955

4 files changed

Lines changed: 17 additions & 3 deletions

File tree

.github/workflows/qwen-autofix.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ jobs:
671671
BRANCH="autofix/issue-${ISSUE}"
672672
git config --local --unset-all http.https://github.com/.extraheader || true
673673
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${REPO}.git"
674-
git push --force-with-lease origin "${BRANCH}"
674+
git push origin "${BRANCH}"
675675
676676
PR_URL="$(gh pr create --repo "${REPO}" \
677677
--base main --head "${BRANCH}" \
@@ -691,6 +691,7 @@ jobs:
691691
COMMENT_ID: '${{ steps.claim.outputs.comment_id }}'
692692
PUBLISH_OUTCOME: '${{ steps.publish.outcome }}'
693693
run: |-
694+
# shellcheck disable=SC2016
694695
if [[ -f "${WORKDIR}/failure.md" ]]; then
695696
REASON='no further automated attempts will be made on this issue.'
696697
DETAIL="$(head -c 1500 "${WORKDIR}/failure.md")"
@@ -1179,7 +1180,7 @@ jobs:
11791180
NEXT_ROUND="$(( ROUND + 1 ))"
11801181
git config --local --unset-all http.https://github.com/.extraheader || true
11811182
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${REPO}.git"
1182-
git push --force-with-lease origin "${BRANCH}"
1183+
git push origin "${BRANCH}"
11831184
{
11841185
echo "🤖 Addressed the latest review feedback (round ${NEXT_ROUND}/${MAX_ROUNDS}). What changed, and what I pushed back on:"
11851186
echo

.github/workflows/qwen-triage.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,8 +842,8 @@ jobs:
842842
PREPARE_FAILURE_PHASE: '${{ needs.tmux-testing.outputs.failure_phase }}'
843843
TMUX_RESULT: '${{ needs.tmux-testing.result }}'
844844
RUN_URL: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
845-
# shellcheck disable=SC2016
846845
run: |-
846+
# shellcheck disable=SC2016
847847
set -euo pipefail
848848
if [ -z "${PR_NUMBER:-}" ]; then
849849
echo "::warning::No PR number resolved; cannot post a tmux result comment."
@@ -921,6 +921,7 @@ jobs:
921921
{
922922
printf '%s\n\n' '<!-- qwen-triage:tmux -->'
923923
printf '**tmux real-user testing: fail** - [workflow run](%s)\n\n' "$RUN_URL"
924+
# shellcheck disable=SC2016
924925
printf 'The PR app could not be launched because `%s` failed before the tmux session started. This is treated as a PR failure verdict rather than an infrastructure failure.\n\n' "$PREPARE_COMMAND"
925926
if [ -n "${PREPARE_LOG_NOTE:-}" ]; then
926927
printf '%s\n\n' "$PREPARE_LOG_NOTE"

.qwen/skills/autofix/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ The raw invocation selects one mode:
2727
or change the required output contract.
2828
- Do not push, comment, create pull requests, edit labels, or use GitHub
2929
credentials. The workflow handles all network writes after verification.
30+
- Use additive commits only; do not amend, rebase, reset, or otherwise rewrite
31+
Git history.
3032
- Keep changes minimal and scoped to the selected issue or review feedback. No
3133
drive-by refactors.
3234
- Do not run project code, tests, builds, package scripts, or the CLI yourself.

scripts/tests/qwen-autofix-workflow.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,9 @@ describe('qwen-autofix workflow', () => {
451451
expect(skill).toContain('assess-candidates');
452452
expect(skill).toContain('develop-issue');
453453
expect(skill).toContain('address-review');
454+
expect(skill.replace(/\s+/g, ' ')).toContain(
455+
'Use additive commits only; do not amend, rebase, reset, or otherwise rewrite Git history.',
456+
);
454457

455458
expect(assessCandidatesStep).toContain(
456459
'/autofix assess-candidates --workdir /tmp/autofix',
@@ -522,6 +525,13 @@ describe('qwen-autofix workflow', () => {
522525
expect(workflow).not.toContain('cat > "${proxy_script}"');
523526
});
524527

528+
it('pushes autofix branches without rewriting remote history', () => {
529+
expect(workflow).not.toMatch(/\bgit push\b[^\n]*--force(?:-with-lease)?/);
530+
expect(workflow).not.toMatch(/\bgit push\b[^\n]*-[^\n\s]*f/);
531+
expect(publishPrStep).toContain('git push origin "${BRANCH}"');
532+
expect(pushAndReportStep).toContain('git push origin "${BRANCH}"');
533+
});
534+
525535
it('keeps sandbox image fallback covered by a reusable script', () => {
526536
expect(sandboxImageResolverScript).toContain(
527537
'https://ghcr.io/token?service=ghcr.io&scope=repository:${GHCR_REPOSITORY}:pull',

0 commit comments

Comments
 (0)