Repository navigation
Preserve document task progress when form fields need correction - #189
madara-1112 wants to merge 1 commit into
Conversation
jerelvelarde
left a comment
There was a problem hiding this comment.
Reviewed bb1e7c262017ee18c1b6b3cd9e87ae78446005d1. Keeping this open for integration, not closing it.
Value and template fit: recovering from invalid document field names/types without losing valid values is useful and fits the persisted document workflow. The source PDF remains checkpointed and corrections continue to the existing action-review gate. The description provides sample-workspace verification and native-device limits; please also attach the screenshot or short recording requested by the repository PR template for the changed recovery UI.
Security review: traced owner-scoped source retrieval, field-name/type validation, preservation of the original PDF, avoidance of filled artifacts before correction, and the subsequent email action-approval boundary. Error strings render as React text. No actionable security defect found in the reviewed diff. This is fixture/static review, not live-provider, adversarial-PDF or native-device testing.
Verification: all 17 workflows tests passed on this exact head in a read-only, network-disabled Linux container (Node 24.17.0 + tsx, telemetry disabled). Dependencies were installed from main's manifest rather than the pnpm lockfile. The PR's GitHub CI supplies lockfile-based checks.
Merge blocker: #191 has now merged and changes the same production AgentService.answer state transition from state.answer to accumulated state.answers. Applying this PR on the combined tree conflicts in that method; blindly taking this PR's state assignment would discard the new answer-history behavior. Please rebase, retain #191's question/answer accumulation and legacy migration, then layer document-field merging plus clearing missingFields/fieldErrors onto that state. Run both tests/model-outcome.test.ts and tests/workflows.test.ts together, refresh CI, and include the recovery UI evidence. This is an integration hold rather than a demonstrated standalone security finding.
bb1e7c2 to
ce7e753
Compare
|
Rebased onto the latest main and resolved the overlap with #191.
The upstream GitHub Actions run is currently marked action_required and is waiting for maintainer approval. |
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:
waiting_inputwith field-specific errors instead of failing;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 lintpnpm typecheckpnpm test(485 passed)pnpm build:serverpnpm build:webpnpm build:iospnpm build:androidpnpm --dir apps/worker typecheckRegression 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