Skip to content

Comments

Add failing tests for #419: Unpushed commits in early exit#422

Merged
gltanaka merged 5 commits intopromptdriven:mainfrom
Serhan-Asad:fix/issue-419
Jan 29, 2026
Merged

Add failing tests for #419: Unpushed commits in early exit#422
gltanaka merged 5 commits intopromptdriven:mainfrom
Serhan-Asad:fix/issue-419

Conversation

@Serhan-Asad
Copy link
Collaborator

Summary

Adds comprehensive failing tests that detect the bug reported in #419 where commits created by LLM agents during Step 1 of the agentic E2E fix workflow are not pushed to the remote repository when the workflow exits early at Step 2.

Test Files

  • Unit test: tests/test_e2e_issue_419_unpushed_commits.py

    • Tests the _commit_and_push() function directly
    • Contains 3 test cases covering the bug scenario and edge cases
    • 1 test FAILS (the bug), 2 tests PASS (existing functionality)
  • E2E test: tests/test_e2e_issue_419_cli_unpushed_commits.py

    • Tests the full pdd fix CLI workflow from user perspective
    • Simulates real git operations with a remote repository
    • Verifies commits are pushed after early exit at Step 2
    • Currently FAILS, demonstrating the bug

What This PR Contains

  • Failing unit test that isolates and reproduces the bug in _commit_and_push()
  • Failing E2E test that verifies the bug at the full workflow integration level
  • Tests use real git operations (not mocked) to verify actual push behavior
  • Tests are verified to fail on current code and will pass once the bug is fixed
  • Comprehensive test coverage following project conventions

Root Cause

The _commit_and_push() function at lines 237-238 in pdd/agentic_e2e_fix_orchestrator.py returns early with "No changes to commit" without executing git push when the working tree is clean. The function uses _get_file_hashes() which only detects uncommitted files via git diff --name-only HEAD, missing commits already created by LLM agents during Step 1 of the workflow.

Why it fails:

  1. initial_file_hashes captured before workflow = {} (no uncommitted files)
  2. LLM agent modifies files and creates commit during Step 1
  3. Workflow exits early at Step 2 (ALL_TESTS_PASS detected)
  4. _commit_and_push() is called, but current_hashes = {} (working tree is clean)
  5. Function returns "No changes to commit" without executing git push
  6. Commits remain unpushed despite workflow reporting success

Next Steps

  1. Implement the fix at pdd/agentic_e2e_fix_orchestrator.py:237-238
  2. Verify the unit test passes after fix
  3. Verify the E2E test passes after fix
  4. Run full test suite to check for regressions
  5. Mark PR as ready for review

Fixes #419


Generated by PDD agentic bug workflow - Step 10

…ly exit

This commit adds comprehensive test coverage for the bug where commits
created by LLM agents during Step 1 of the agentic E2E fix workflow are
not pushed to the remote repository when the workflow exits early at Step 2.

Test files:
- tests/test_e2e_issue_419_unpushed_commits.py: Unit tests for _commit_and_push()
- tests/test_e2e_issue_419_cli_unpushed_commits.py: E2E integration test

The tests verify the expected behavior documented in CHANGELOG v0.0.121:
"pdd fix now automatically commits and pushes changes after successful completion"

These tests fail on the current buggy code and will pass once the fix
is implemented in pdd/agentic_e2e_fix_orchestrator.py lines 237-238.

Related to promptdriven#419
This file was a duplicate implementation of _commit_and_push that's already
properly fixed in pdd/agentic_e2e_fix_orchestrator.py. The file was:
- In the wrong location (pdd/ instead of tests/)
- Missing proper imports
- Using a different implementation approach

The actual fix is at pdd/agentic_e2e_fix_orchestrator.py:237-262
- Shortened excessive docstrings and comments
- Removed redundant bug explanations
- Simplified pytest.fail messages
- Reduced verbosity while maintaining clarity
- Removed unnecessary inline comments
@Serhan-Asad Serhan-Asad marked this pull request as ready for review January 28, 2026 18:33
@gltanaka gltanaka requested a review from Copilot January 28, 2026 19:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive test coverage for issue #419, which identifies a bug where commits created by LLM agents during Step 1 of the agentic E2E fix workflow are not pushed to the remote repository when the workflow exits early at Step 2.

Changes:

  • Adds unit tests that directly test the _commit_and_push() function to verify it handles unpushed commits
  • Adds E2E tests that simulate the full CLI workflow to verify commits are pushed after early exit
  • Includes a proposed fix to _commit_and_push() that checks for and pushes unpushed commits even when the working tree is clean

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/test_e2e_issue_419_unpushed_commits.py Unit tests for _commit_and_push() covering the bug scenario and edge cases
tests/test_e2e_issue_419_cli_unpushed_commits.py E2E CLI tests simulating the full orchestrator workflow with mocked LLM calls
pdd/agentic_e2e_fix_orchestrator.py Proposed fix that checks for unpushed commits before returning early

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ore pushing

Addresses Copilot PR review comments on promptdriven#422. The previous implementation
attempted to push first, then checked for unpushed commits, which made the
check ineffective since commits would already be pushed.

Changes:
- Check for unpushed commits BEFORE attempting push using git log @{u}..HEAD
- Return early if no unpushed commits exist (more efficient)
- Only push if unpushed commits are found
- Return proper error if push fails instead of silently succeeding

This ensures the fix for promptdriven#419 works correctly while being more efficient
by avoiding unnecessary push operations.
@gltanaka gltanaka merged commit 1523b17 into promptdriven:main Jan 29, 2026
beknobloch pushed a commit to beknobloch/pdd that referenced this pull request Feb 7, 2026
…ore pushing

Addresses Copilot PR review comments on promptdriven#422. The previous implementation
attempted to push first, then checked for unpushed commits, which made the
check ineffective since commits would already be pushed.

Changes:
- Check for unpushed commits BEFORE attempting push using git log @{u}..HEAD
- Return early if no unpushed commits exist (more efficient)
- Only push if unpushed commits are found
- Return proper error if push fails instead of silently succeeding

This ensures the fix for promptdriven#419 works correctly while being more efficient
by avoiding unnecessary push operations.
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.

Bug: Agentic fix doesn't push commits when exiting early at Step 2

2 participants