Skip to content

pdd sync (single-module) exits 0 despite 'Overall status: Failed' #1979

Description

@sohni-tagirisa

Summary

Single-module pdd sync <basename> prints Overall status: Failed (red) in the final summary panel but exits with code 0. CI, scripts, and agentic child runners that check the exit code read the failed sync as success.

Found during the non-billable agentic-sync E2E validation (epic PR #1868); re-confirmed 2026-07-07 against a write-mode failure scenario: pdd sync on a module whose generate step failed printed Overall status: Failed and exited 0.

Where

  • pdd/sync_main.py:1387 — computes overall_success, prints it in the summary panel, and returns it inside aggregated_results["overall_success"].
  • pdd/commands/maintenance.py (sync command, ~line 514) — receives the result and does return str(result), total_cost, model_name unconditionally. No non-zero exit when overall_success is False.

Why it matters

  • Downstream tooling has already grown a workaround: pdd/agentic_sync_runner.py:2806 does a "sticky capture" scrape of the child's stdout for Overall status: ... Failed because it cannot trust the exit code. Direct invocations (CI gates, shell scripts, && chains) have no such protection.
  • This blocks trusting any benchmark or GO/NO-GO evaluation of sync modes that keys off exit codes.
  • Note: the issue-URL agentic parent path exits non-zero correctly; this bug is specific to the single-module path.

Established convention

The #1677 fix (AmbiguousModuleError in the same command) sets the pattern: print the error, then raise click.exceptions.Exit(1) so quiet runs and agentic child runners never read failure as success.

Acceptance criteria

  • pdd sync <basename> exits non-zero when the aggregated result has overall_success == False.
  • Exit code remains 0 for success and for --dry-run reporting-only runs that succeed.
  • The Overall status: stdout contract is unchanged (the runner's sticky capture must keep working).
  • Regression test reproducing the failed-sync-exit-0 case, plus tests for the success path.

Refs: epic PR #1868 (validation that found this), #1677 (exit-code convention).

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions