Add failing tests for #1695#1696
Draft
prompt-driven-github[bot] wants to merge 1 commit into
Draft
Conversation
Two new tests in tests/test_incremental_code_generator.py verify that when llm_invoke returns the exact production error string from #1695 ("ERROR: [ERROR] Cache bypass retry also returned None for item 0"), incremental_code_generator returns the graceful fallback tuple instead of crashing with AttributeError: 'str' object has no attribute 'is_big_change'. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds regression tests that detect the bug reported in #1695.
Test Files
tests/test_incremental_code_generator.pyWhat This PR Contains
test_diff_analyzer_returns_exact_1695_error_string_falls_back_gracefully— verifies that the exact production error string from pdd sync conformance repair retries enter incremental generation #1695 ("ERROR: [ERROR] Cache bypass retry also returned None for item 0") causesincremental_code_generatorto return the graceful fallback tuple(None, False, cost, model_name)without raisingAttributeError.test_diff_analyzer_malformed_result_shows_warning_not_crash_message_issue_1695— verifies that withverbose=True, the recovery warning ("Diff analyzer returned a malformed result") appears in output and the crash message ("Error in incremental_code_generator") does not.Root Cause
When both the primary LLM call and the cache-bypass retry return
None,pdd/llm_invoke.py(lines 5784–5787, 6156, 6205) appends a raw error string into theresultslist and returns{'result': "ERROR: [ERROR] Cache bypass retry also returned None for item 0", ...}. Inpdd/incremental_code_generator.py(line 97), the caller unpacksdiff_response['result']expecting aDiffAnalysisPydantic model but receives the error string instead. Without theisinstanceguard,diff_result.is_big_changeraisesAttributeError: 'str' object has no attribute 'is_big_change', causingpdd syncto mark the module failed with the cryptic error observed in the production log.The fix (isinstance guard at
incremental_code_generator.py:104) was already applied in a prior commit; these tests provide specific regression coverage for the #1695 production error string (which has a[ERROR]prefix andfor item 0suffix not covered by the existing #1612 tests).Next Steps
pytest -vv tests/) to check for regressionsFixes #1695
Generated by PDD agentic bug workflow