fix: retain partial source edits in failed patch audits - #211
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 7:30 PM ET / 23:30 UTC. ClawSweeper reviewWhat this changesRecords files changed before a provider failure in the failed patch audit, with regression coverage and documentation. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main and v0.8.0 leave failed provider attempts with an empty file audit. No blocking defect was found in the patch. Priority: P2 Review scores
Verification
How this fits togetherClawpatch’s fix command sends a selected finding to a provider that can edit the project. Its patch audit records the resulting files, validation results, and failure status for later inspection. flowchart TD
A[Selected finding] --> B[Snapshot source changes]
B --> C[Provider edits project]
C --> D{Provider succeeds?}
D -->|Yes| E[Run validation]
D -->|No| F[Snapshot partial edits]
F --> G[Save failed audit and return error]
E --> H[Save validated patch audit]
Before mergeNone. Agent review detailsSecurityNone. Review metricsNone. Technical reviewBest possible solution: Use the same project-scoped snapshot comparison for successful and failed provider attempts while preserving failure semantics. Do we have a high-confidence way to reproduce the issue? Yes: current main’s catch branch preserves the initial empty file list even when the provider edits files before throwing. Source inspection establishes the defect; this review did not execute it. Is this the best way to solve the issue? Yes: reusing the existing snapshot comparison is a narrow repair that keeps the record format and downstream failure checks intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ead0ec4703e0. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
A provider can write source files and then fail or exit before returning its fix plan. Clawpatch recorded the attempt as failed but left
filesChangedempty, hiding the partial edits from its patch audit.User Impact
Failed patch attempts retain the source edits observed before the provider failed. The command still fails, and the patch remains failed; no commit, push, or automatic rollback is introduced.
Why This Change Was Made
Use the same before/after source snapshots in the provider-error path as in the successful path. Preserve the original provider error and the finding's patch link.
Evidence
codexeditssrc/index.tsthen exits 1. The real built CLI recordsfailed,filesChanged: [], despite the changed file.failed, but recordsfilesChanged: ["src/index.ts"]matching the actual edit.pnpm typecheck,pnpm lint, audit/workflow tests (130 passed), andpnpm buildpass. The original no-write provider failure case remains intact.