Skip to content

Conversation

@jiaminc-cmu
Copy link
Collaborator

Summary

Adds failing tests that detect the bug reported in #364.

Test Files

  • Unit test: tests/test_fix_code_loop.py (TestCumulativeCostDisplay class)
  • E2E test: tests/test_e2e_issue_364_cumulative_cost.py

What This PR Contains

  • Failing unit test that reproduces the reported bug
  • Failing E2E test that verifies the bug at integration level
  • Tests are verified to fail on current code and will pass once the bug is fixed

Root Cause

The fix_code_loop function in pdd/fix_code_loop.py initializes a local total_cost = 0.0 variable (line 442) and displays only this loop-local cost (line 684). When auto-deps costs $3 before the fix loop runs, the displayed "Total Cost: $0.50" is misleading - it should show the cumulative "$3.50".

The budget enforcement is correct (it properly passes budget - prior_cost), but the display is misleading because it doesn't include prior operation costs.

Next Steps

  1. Implement the fix by adding a prior_cost parameter to fix_code_loop() and fix_verification_errors_loop()
  2. Update the display logic to show prior_cost + total_cost as "Total Cost"
  3. Verify the unit test passes
  4. Verify the E2E test passes
  5. Run full test suite
  6. Mark PR as ready for review

Fixes #364


Generated by PDD agentic bug workflow

- Add unit tests in test_fix_code_loop.py to verify Total Cost includes prior operation costs
- Add E2E tests in test_e2e_issue_364_cumulative_cost.py to test integration-level behavior

Tests are designed to fail on current code (demonstrating the bug) and pass once
the fix is implemented. The bug is that fix_code_loop displays only loop-local
costs instead of cumulative costs including prior operations (like auto-deps).

Refs #364

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jiaminc-cmu jiaminc-cmu marked this pull request as ready for review January 22, 2026 05:08
@jiaminc-cmu jiaminc-cmu merged commit 6ace358 into main Jan 22, 2026
4 checks passed
Enfoirer pushed a commit to Enfoirer/pdd that referenced this pull request Jan 24, 2026
Add failing tests for promptdriven#364: Cumulative cost display bug
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.

PDD sync doesn't accumulate cost when comparing with the max-budget

2 participants