Skip to content

feat(retry): support model selection when retrying failed pages - #76

Merged
jorben merged 5 commits into
MarkPDFdown:masterfrom
AhmedCoolProjects:feat/retry-failed-with-model-selection
Sep 3, 2026
Merged

feat(retry): support model selection when retrying failed pages#76
jorben merged 5 commits into
MarkPDFdown:masterfrom
AhmedCoolProjects:feat/retry-failed-with-model-selection

Conversation

@AhmedCoolProjects

@AhmedCoolProjects AhmedCoolProjects commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Description

This PR enhances task recovery and partial-failure handling in the desktop application by enabling users to select any configured model when retrying failed pages or partially failed tasks.

📸 Preview

Retry Task With Model Selection


Key Features & Improvements

  1. Model Selection for retryFailed:

    • Updated TASK_DETAIL.RETRY_FAILED IPC handler in src/main/ipc/handlers/taskDetail.handler.ts to accept optional providerId and modelId.
    • When overridden, only failed pages (status = FAILED) are updated to status = PENDING with the newly chosen provider and model, while preserving all previously completed pages.
  2. UI Enhancements in Preview.tsx:

    • Updated handleRetryFailed in Preview.tsx to show a model selection modal (consistent with handleRetryPage and handleRetryTask).
    • Retries all failed pages using the newly selected model without restarting or re-running completed pages.
  3. List Action Column in List.tsx:

    • Enabled the Retry action on tasks in PARTIAL_FAILED status (status 8) in addition to FAILED status (status 0).
  4. Preload & TypeScript Definitions:

    • Updated preload/electron.d.ts, preload/index.ts, and renderer/electron.d.ts to support the updated retryFailed payload signature.
  5. Tests:

    • Added unit tests in taskDetail.handler.test.ts verifying that failed pages update with provider and model overrides.
    • All 937 unit tests and 279 renderer tests pass cleanly.

@jorben jorben left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this contribution! The retry experience for partially failed tasks is much better with model selection, and preserving already completed pages is exactly the behavior we want. I also checked the cloud-task flow and did not see an impact there.

Before merging, I'd suggest a few changes:

  1. The database / userData path changes in src/main/index.ts, src/core/infrastructure/db/index.ts, and src/core/infrastructure/services/FileService.ts have a larger blast radius than the retry feature. They can make existing dev data inaccessible because existing local data may not be found in the new markpdfdown userData path. It's fine to keep them in this PR if intentional, but please add a backward-compatible migration or fallback for existing databases and task files, and update the PR description to explicitly cover this behavior change and migration plan.

  2. There are 3 TypeScript errors in src/renderer/pages/Preview.tsx around lines 463-464 (TS7006 implicit any). Please add explicit parameter types so npm run typecheck passes.

  3. The retryFailed IPC handler should explicitly allow only the intended task statuses. Right now it only rejects CANCELLED, so a caller could trigger it for tasks that are still processing or otherwise not in a safe retry state. Please restrict it to FAILED / PARTIAL_FAILED and add tests for rejected statuses.

Thanks again for the careful work here!

@AhmedCoolProjects

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed review. I addressed all three points:

  • Reverted the unrelated userData, database, and task-file path changes, so existing storage behavior remains unchanged and no data migration is required.
  • Added explicit parameter types in Preview.tsx; npm run typecheck now passes.
  • Restricted retryFailed to FAILED and PARTIAL_FAILED, with tests covering both allowed statuses and rejecting every other task status.

The focused task-detail handler suite passes with 29 tests.

@jorben
jorben merged commit a1fa34a into MarkPDFdown:master Sep 3, 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.

2 participants