Add failing tests for #1648: pdd sync subprocess runner may use installed pdd instead of checkout#1659
Draft
prompt-driven-github[bot] wants to merge 1 commit into
Draft
Add failing tests for #1648: pdd sync subprocess runner may use installed pdd instead of checkout#1659prompt-driven-github[bot] wants to merge 1 commit into
prompt-driven-github[bot] wants to merge 1 commit into
Conversation
Adds tests that detect the bug where _find_pdd_executable() in
pdd/agentic_sync_runner.py, pdd/server/routes/commands.py, and
pdd/server/jobs.py prefers shutil.which("pdd") over sys.executable -m pdd,
causing sync subprocesses to execute an installed binary rather than the
current checkout version.
Also fixes prompt specifications that encoded the wrong executable-resolution
strategy in utils/mcp/prompts/runner_python.prompt,
pdd/prompts/agentic_sync_runner_python.prompt,
pdd/prompts/server/routes/commands_python.prompt, and
pdd/prompts/server/jobs_python.prompt.
Tests fail on current buggy code and will pass once the fix is applied.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 failing tests that detect the bug reported in #1648, where
_find_pdd_executable()in multiple modules prefersshutil.which("pdd")over[sys.executable, "-m", "pdd"], causing sync subprocesses to execute an installed binary (e.g., 0.0.276) rather than the current source-checkout version (e.g., 0.0.278.dev0).Root Cause
_find_pdd_executable()in three separate files returnsshutil.which("pdd")immediately when anypddbinary exists onPATH, so theelse: [sys.executable, "-m", "pdd"]branch in callers is never reached. The same antipattern exists in the MCP runner tool. This contradicts the documented intent inpdd/__main__.pyand the correct pattern already used inpdd/agentic_change_orchestrator.py.Files with the bug:
pdd/agentic_sync_runner.py:236— primary_find_pdd_executable()pdd/server/routes/commands.py:434— duplicate copypdd/server/jobs.py:199— duplicate copyutils/mcp/pdd_mcp_server/tools/runner.py:66— MCP runnerTest Files
tests/test_agentic_sync_runner.py(Tests 1 & 6:TestBuildCommandInterpreterParity)tests/test_jobs_sync_failure_detection.py(Test 2:TestBuildSubprocessCommandArgsInterpreterParity)tests/test_server_routes_commands.py(Test 3:TestBuildPddCommandArgsInterpreterParity) — new filetests/test_mcp_runner.py(Test 4:TestRunPddCommandInterpreterParity+ prompt regression guards) — new filetests/test_run_pdd_sync_helper.py(Test 5) — new filetests/test_e2e_sync_interpreter_parity.py— new file (real PATH manipulation, no mocks)Prompt Files Fixed
Prompt specifications encoded the wrong executable-resolution strategy and have been corrected to mandate
[sys.executable, "-m", "pdd"]:utils/mcp/prompts/runner_python.promptpdd/prompts/agentic_sync_runner_python.promptpdd/prompts/server/routes/commands_python.promptpdd/prompts/server/jobs_python.promptWhat This PR Contains
shutil.whichmocking)Test Verification
All 6 behavioral unit tests and 4 E2E tests fail on current buggy code with clear error messages pointing to the exact binary path resolved incorrectly. Example:
Next Steps
_find_pdd_executable()inpdd/agentic_sync_runner.pyto always returnNone_find_pdd_executable()inpdd/server/routes/commands.pyto always returnNone_find_pdd_executable()inpdd/server/jobs.pyto always returnNonerun_pdd_command()inutils/mcp/pdd_mcp_server/tools/runner.pyto use[sys.executable, "-m", "pdd"]_run_pdd_sync()intests/test_one_session_eval.pyTo auto-fix using PDD:
Fixes #1648
Generated by PDD agentic bug workflow