Skip to content

pdd sync subprocess runner may use installed pdd instead of checkout during self-sync #1648

Description

@Serhan-Asad

Problem

During local investigation of #1641 / PR #1644, one pdd sync agentic_bug_orchestrator failure block showed that the subprocess path was using the installed package instead of the checkout:

pdd.__file__: /opt/anaconda3/lib/python3.12/site-packages/pdd/__init__.py
pdd --version: pdd, version 0.0.276
git SHA: cf1a456a2e3e0bf45a12bbd3ae534393da4078d8
git status: dirty
source: site-packages

From the same checkout, python -m pdd --version reported 0.0.278.dev0.

This may make self-sync/debugging misleading: the user thinks they are testing the current branch, but subprocess sync can execute whatever pdd binary appears first on PATH.

Suspected area

pdd/agentic_sync_runner.py has _find_pdd_executable() that currently prefers shutil.which("pdd"), then builds subprocess commands from that executable.

That behavior is reasonable for normal installed CLI usage, but it may be risky inside a source checkout, especially when syncing PDD itself or when the parent process was invoked as python -m pdd.

Possible direction, not a final design

Consider making subprocess sync prefer the same codebase/interpreter as the parent process when running from a checkout, for example:

  • use [sys.executable, "-m", "pdd"] when imported pdd.__file__ is under the current repo/worktree
  • only use shutil.which("pdd") when the parent process is also an installed CLI path
  • add a warning when pdd on PATH and imported pdd.__file__ disagree
  • include the resolved command in sync logs/core dumps

The sync owner should decide the exact policy because installed CLI behavior may still be desired in some automation contexts.

Acceptance criteria ideas

  • A test covers a repo-checkout invocation where PATH contains an older pdd, and sync subprocess command still targets the checkout/interpreter.
  • A diagnostic warning or core-dump field makes version/source mismatch obvious.
  • Existing installed-package usage is not broken.

Related

This is separate from the compatibility-surface question in #1647. It does not explain every sync failure, but it can make investigation results unreliable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcliCommand-line interface improvementspdd-syncPDD: sync prompts with code

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions