Skip to content

Preserve document task progress when form fields need correction - #189

Open
madara-1112 wants to merge 1 commit into
CopilotKit:mainfrom
madara-1112:fix/document-input-recovery
Open

madara-1112 wants to merge 1 commit into
CopilotKit:mainfrom
madara-1112:fix/document-input-recovery

Conversation

@madara-1112

Copy link
Copy Markdown

What changed

Document tasks previously failed when delegated input contained an unknown PDF field or a value with the wrong type. Retrying reused the same invalid input, so the task failed again even after it had already found and checkpointed the source document.

This change validates delegated values against the PDF's actual field definitions before filling it. When only part of the input is invalid, the task now:

  • keeps the checkpointed source document and fields that already passed validation;
  • enters waiting_input with field-specific errors instead of failing;
  • pre-fills the valid values in the task UI; and
  • merges the person's corrections before resuming the same task and continuing to action review.

The implementation deliberately does not coerce strings such as "true" into booleans. A value with the wrong type still requires an explicit correction.

Verification

  • pnpm lint
  • pnpm typecheck
  • pnpm test (485 passed)
  • pnpm build:server
  • pnpm build:web
  • pnpm build:ios
  • pnpm build:android
  • pnpm --dir apps/worker typecheck
  • Manually verified in the fictional local workspace: retry a document task with four valid values and one string-valued checkbox, preserve the original PDF and valid values, correct only the checkbox, continue to review, approve the local email action, and complete the same task.

Regression coverage includes both a wrong field type and an unknown field name, and verifies that no filled artifact is created until the invalid input is corrected.

Integration limits

  • The manual flow used local sample mail and a fictional fillable PDF; no Google/Gmail provider credentials were used.
  • Web UI behavior was exercised manually. iOS and Android exports passed, but native binaries were not run.

This branch has not been deployed

No deployments
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