Skip to content

fix(code): skip hook re-run when the branch is already on origin - #19

Merged
danii1 merged 1 commit into
mainfrom
fix/hook-fixer-already-pushed
Aug 19, 2026
Merged

fix(code): skip hook re-run when the branch is already on origin#19
danii1 merged 1 commit into
mainfrom
fix/hook-fixer-already-pushed

Conversation

@danii1

@danii1 danii1 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Hook-fix verification treated a failed git push --dry-run as “the agent didn’t amend.” That dry-run re-runs the full pre-push suite. After Codex had already published feature/dev-74, a 30s CLI test timeout (should handle task keys that look like options) failed the dry-run, there were no dirty files to amend, and PR creation aborted even though the branch was already on GitHub.

Changes

  • If HEAD already matches origin/<branch>, skip the hook-rerunning dry-run and treat verification as success.
  • pushCurrentBranch also skips a no-op git push in that case, so the follow-up push cannot flake the same way (a no-op push still invokes pre-push hooks).
  • When the commit is not on origin and the dry-run fails, report the actual hook/push error instead of “didn’t amend.”
  • Regression tests: already-on-origin with a failing hook succeeds; unpublished commit with a failing hook still fails; leftover dirty files still get amended.

This is the failure that blocked DEV-74 from opening automatically.

Test plan

  • bun run test git-hook-fixer.test.ts protected-branch-safety.test.ts
  • Pre-push suite (full monorepo tests + typecheck)

Hook-fix verification used git push --dry-run, which re-executes the
full pre-push suite. A flaky test timeout then aborted PR creation with
a misleading "didn't amend" error even after the agent had already
published HEAD. Treat origin/<branch> matching HEAD as success and skip
the no-op follow-up push so hooks cannot flake twice.
@danii1
danii1 force-pushed the fix/hook-fixer-already-pushed branch from e8ab3bf to 8d3b401 Compare August 19, 2026 04:31
@danii1
danii1 merged commit a4b7fec into main Aug 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant