Skip to content

fix: disclose apply_patch failure reasons and classify recovery advice - #34

Merged
code-yeongyu merged 1 commit into
mainfrom
ulw/disclose-failure-reasons
Jul 30, 2026
Merged

fix: disclose apply_patch failure reasons and classify recovery advice#34
code-yeongyu merged 1 commit into
mainfrom
ulw/disclose-failure-reasons

Conversation

@code-yeongyu

@code-yeongyu code-yeongyu commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Summary

Issue #31: apply_patch hid failure reasons behind generic reread instructions. The underlying failures[].message was recorded but never surfaced to the model, and every failure classified as requiring a reread — including ENOENT, EACCES, and path errors that rereading cannot fix.

Changes

  • Surface each failure path, operation, and underlying message in the model-facing tool result text (Failed:\n- path (op): message).
  • Add code?: string | undefined to ApplyPatchFailure; capture the Node fs error code in both catch sites.
  • Classify recovery: only context-mismatch failures (no error code) emit Recovery: MUST read; ENOENT/EACCES/path errors omit reread advice.
  • Add failedFiles: string[] to ApplyPatchRecoveryInstructions.

Closes

Closes #31.

Verification

  • npm run check (tsgo + biome): clean
  • npm test (61 tests): all pass
  • RED captured before the fix: ENOENT test failed (message not surfaced, MUST read wrongly emitted); context-mismatch test failed (message not surfaced)
  • GREEN after the fix: both pass

Review in cubic

Surface the underlying failure message (failures[].message) for each
failed path in the model-facing tool result, and classify recovery
advice so ENOENT, EACCES, and path errors do not emit 'Recovery: MUST
read' — only genuine context-mismatch failures do. Adds code?: string
to ApplyPatchFailure and failedFiles to ApplyPatchRecoveryInstructions.

Closes #31
@code-yeongyu
code-yeongyu merged commit 8f0d8a6 into main Jul 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

apply_patch hides failure reasons behind generic reread instructions

1 participant