Skip to content

Fix: Handle file read errors gracefully in resolving file states#7

Merged
FL4TLiN3 merged 3 commits intomainfrom
fix/file-operation-error-handling
Dec 4, 2025
Merged

Fix: Handle file read errors gracefully in resolving file states#7
FL4TLiN3 merged 3 commits intomainfrom
fix/file-operation-error-handling

Conversation

@FL4TLiN3
Copy link
Contributor

@FL4TLiN3 FL4TLiN3 commented Dec 4, 2025

Summary

  • Add try-catch blocks in resolving-pdf-file.ts and resolving-image-file.ts
  • File read errors are now returned as text parts to the LLM instead of crashing
  • LLM can then inform the user about the error and potentially retry

Test plan

  • Unit tests added for error scenarios
  • Existing tests pass
  • E2E tests pass
  • Typecheck passes

Note

Gracefully handles file read failures in PDF/image resolving states, adds unit tests for error paths, and updates review report/changeset.

  • Runtime:
    • Add try-catch around readFile in packages/runtime/src/states/resolving-pdf-file.ts and resolving-image-file.ts, returning textPart errors instead of crashing.
  • Tests:
    • Update resolving-pdf-file.test.ts and resolving-image-file.test.ts to mock readFile, validate base64 success paths, and add error-handling cases.
  • Docs/Meta:
    • Update CODE_REVIEW_REPORT.md to mark file operation handling as fixed and add commit 796f981.
    • Add changeset: @perstack/runtime patch.

Written by Cursor Bugbot for commit a609100. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Dec 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
perstack Ready Ready Preview Comment Dec 4, 2025 1:38am

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ackages/runtime/src/states/resolving-image-file.ts 80.00% 0 Missing and 1 partial ⚠️
packages/runtime/src/states/resolving-pdf-file.ts 80.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

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.

1 participant